cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: host name with hyphen or underscore at the beginning

From: Haejoong Lee <haejoong_at_ldc.upenn.edu>
Date: Fri, 15 Jun 2007 06:26:31 -0400

Daniel Stenberg wrote:
> On Fri, 15 Jun 2007, Haejoong Lee wrote:
>
>> I get an error message like the following if the host name begins
>> with a hyphen or underscore.
>>
>> curl: (6) Couldn't resolve host ...
>
> What curl version on what platform using what resolver?

$ curl --version
curl 7.16.2 (i686-pc-linux-gnu) libcurl/7.16.2 OpenSSL/0.9.8e zlib/1.2.3
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: IPv6 Largefile NTLM SSL libz

I'm not sure how to find the resolver version. The following is an
output from libc. Is this what you are looking for?

$ /lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.2.
Compiled on a Linux >>2.6.18.3<< system on 2007-03-27.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        GNU libio by Per Bothner
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

>> I looked at RFC 3936 and it allows such host names.
>>
>> host = IP-literal / IPv4address / reg-name
>> reg-name = *( unreserved / pct-encoded / sub-delims )
>> unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
>>
>> Does anyone know what the problem is?
>
> I can't see anything in (lib)curl that limits the name like this. In
> fact libcurl allows far more letters than that...
>
> I just tested with several curl versions, but then I don't have any
> host names starting with these letters.
>
> For host names that start with a dash, you might need to do it like:
> "curl -- -host"

Here's an example: http://-islam.maktoobblog.com/.

Actually, I started feeling that this problem is not related to curl. I
tried this url with firefox on 3 machines: linux, freebsd and windows.
It only works on windows machine. So, I guess the culprit is the
resolver that you talked about.

By the way, thank you for your quick response!

-Haejoong
Received on 2007-06-15