cURL / Mailing Lists / curl-library / Single Mail


Problem resolving localhost with IPv6 disabled

From: Maxim Prohorov <>
Date: Thu, 8 Mar 2012 19:20:06 +0300


I've only recently switched from 7.23.1 to 7.24.0 and discovered strange
issue when accessing localhost

curl configured with:
c-ares enabled
ipv6 enabled

local system got ipv6 disabled (not even configured in kernel)

> $ cat /etc/hosts
> localhost
> ::1 localhost
> $ curl localhost
> curl: (2) Failed initialization

Looks like this was already mentioned here:

Suse bugtracker got no explanation of how they fixed it.

After searching a bit, the issue seems to be caused by two calls to c-ares
where it successfully returns two results for localhost - ::1 and
Curl tries to access ::1 first, which silently fails cause of disabled ipv6.

Ofc. simply removing entry about ::1 resolves this.
List admin:
Received on 2012-03-08