cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem resolving localhost with IPv6 disabled

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

Hello

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
> 127.0.0.1 localhost
> ::1 localhost
>
> $ curl localhost
> curl: (2) Failed initialization

Looks like this was already mentioned here:
http://curl.haxx.se/mail/lib-2012-02/0031.html

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 127.0.0.1
Curl tries to access ::1 first, which silently fails cause of disabled ipv6.

Ofc. simply removing entry about ::1 resolves this.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-08