cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1965199 ] Failing to download IPV6 URLS with IPV4 mapped last 32 bits

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Wed, 21 May 2008 16:05:49 -0700

Bugs item #1965199, was opened at 2008-05-16 02:21
Message generated for change (Comment added) made by dfandrich
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1965199&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: bad behaviour
Status: Open
Resolution: Out of Date
Priority: 5
Private: No
Submitted By: angshuman rudra (angshur)
Assigned to: Daniel Stenberg (bagder)
Summary: Failing to download IPV6 URLS with IPV4 mapped last 32 bits

Initial Comment:
operating system's name and version number : Windows XP SP2 - (IPv6 installed using netsh interface ipv6 install)

what version of curl you're using: 7.15

what URL you were working with: http://[2001:1890:110b:15ce:250:56ff:254.187.40.177] This is an IPv4 mapped address corresponding to the v6 address:
http://[2001:1890:110b:15ce:250:56ff:febb:28b1]

Details:
Using the curl library, we are facing some issues in downloading details from an IPv4 mapped IPv6 address.

----------------------------------------------------------------------

>Comment By: Dan Fandrich (dfandrich)
Date: 2008-05-21 16:05

Message:
Logged In: YES
user_id=236775
Originator: NO

Is your libcurl using your system's inet_pton() function or curl's own
Curl_inet_pton()? curl's should handle this address format fine.

----------------------------------------------------------------------

Comment By: angshuman rudra (angshur)
Date: 2008-05-21 15:00

Message:
Logged In: YES
user_id=2088915
Originator: YES

The method Curl_getaddrinfo fails:
Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
                                char *hostname,
                                int port,
                                int *waitp)
{
  struct addrinfo hints, *res;
  int error;
  char sbuf[NI_MAXSERV];
  char *sbufptr = NULL;
  char addrbuf[128];
  curl_socket_t s;
  int pf;
  struct SessionHandle *data = conn->data;
  int ai_flags;

  *waitp=0; /* don't wait, we have the response now */

  /* see if we have an IPv6 stack */
  s = socket(PF_INET6, SOCK_DGRAM, 0);
  if (s < 0) {
    /* Some non-IPv6 stacks have been found to make very slow name
resolves
     * when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup
if
     * the stack seems to be a non-ipv6 one. */

    pf = PF_INET;
  }
  else {
    /* This seems to be an IPv6-capable stack, use PF_UNSPEC for the
widest
     * possible checks. And close the socket again.
     */
    sclose(s);

    /*
     * Check if a more limited name resolve has been requested.
     */
    switch(data->set.ip_version) {
    case CURL_IPRESOLVE_V4:
      pf = PF_INET;
      break;
    case CURL_IPRESOLVE_V6:
      pf = PF_INET6;
      break;
    default:
      pf = PF_UNSPEC;
      break;
    }
  }

  if((1 == Curl_inet_pton(AF_INET, hostname, addrbuf)) ||
     (1 == Curl_inet_pton(AF_INET6, hostname, addrbuf))) {
    /* the given address is numerical only, prevent a reverse lookup */
    ai_flags = AI_NUMERICHOST;
  }
  else
    ai_flags = AI_CANONNAME;

  memset(&hints, 0, sizeof(hints));
  hints.ai_family = pf;

  hints.ai_socktype = conn->socktype;

  hints.ai_flags = ai_flags;
  if(port) {
    snprintf(sbuf, sizeof(sbuf), "%d", port);
    sbufptr=sbuf;
  }
  error = getaddrinfo(hostname, sbufptr, &hints, &res);
  if (error) {
    infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port);
    return NULL;
  }

  return res;
}

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-05-21 14:50

Message:
Logged In: YES
user_id=1110
Originator: NO

Please respond or this will be closed with no further action.

----------------------------------------------------------------------

Comment By: Dan Fandrich (dfandrich)
Date: 2008-05-16 10:00

Message:
Logged In: YES
user_id=236775
Originator: NO

Are you encountering by any chance KNOWN_BUG #30?
http://curl.haxx.se/docs/knownbugs.html

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-05-16 02:27

Message:
Logged In: YES
user_id=1110
Originator: NO

Please try a much more recent curl version as 7.15 is quite outdated.
7.18.1 is the most recent one that we believe works correctly in this
aspect.

The, exactly in what way does it fail when you run what command? Can you
please show us the source code for a small stand-alone program that repeats
the problem?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1965199&group_id=976
Received on 2008-05-22

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET