cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: IPv6 Proxy Server

From: Todd Kulesza <todd_at_dropline.net>
Date: Tue, 31 May 2005 11:06:22 -0400

Here's the response from the user who had been having trouble. Thanks
for the help! :)

Cheers,
Todd

-------- Original Message --------
Subject: Re: [Fwd: Re: IPv6 Proxy Server]
Date: Tue, 31 May 2005 09:02:06 -0600
From: Aredridel <aredridel_at_nbtsc.org>
To: Todd Kulesza <todd_at_dropline.net>
References: <429C6269.8020502_at_dropline.net>

On Tue, 2005-05-31 at 09:11 -0400, Todd Kulesza wrote:
> Here's a patch from the Curl maintainer:

Excellent!

> Do let me know how it works if you decide to try it!

It works! Since this comes from the GNOME proxy settings, I have to put
in the [] which breaks other apps, but it works as a test. Adjusting
Drivel to match would be spiffy. (Can't see any harm in handling that
case differently, since it's broken no matter what with older curls.)

> A quick work-around for this existing user would of course be to simply add
> "ip6-hostname 2001:470:1f01:301::1" to /etc/hosts and then use
>
> curl -x ip6-hostname localhost

That's what I did as a workaround -- which does work, but not what I
want to have to do.

>
> plain text document attachment (ipv6proxy.patch)
> Index: lib/url.c
> ===================================================================
> RCS file: /cvsroot/curl/curl/lib/url.c,v
> retrieving revision 1.463
> diff -u -r1.463 url.c
> --- lib/url.c 19 May 2005 07:21:18 -0000 1.463
> +++ lib/url.c 31 May 2005 12:35:45 -0000
> @@ -2943,25 +2943,44 @@
>
> /* We use 'proxyptr' to point to the proxy name from now on... */
> char *proxyptr=proxydup;
> + char *portptr;
>
> if(NULL == proxydup) {
> failf(data, "memory shortage");
> return CURLE_OUT_OF_MEMORY;
> }
>
> - /* Daniel Dec 10, 1998:
> - We do the proxy host string parsing here. We want the host name and the
> - port name. Accept a protocol:// prefix, even though it should just be
> - ignored. */
> + /* We do the proxy host string parsing here. We want the host name and the
> + * port name. Accept a protocol:// prefix, even though it should just be
> + * ignored.
> + */
>
> - /* 1. skip the protocol part if present */
> + /* Skip the protocol part if present */
> endofprot=strstr(proxyptr, "://");
> - if(endofprot) {
> + if(endofprot)
> proxyptr = endofprot+3;
> +
> + /* start scanning for port number at this point */
> + portptr = proxyptr;
> +
> + /* detect and extract RFC2732-style IPv6-addresses */
> + if(*proxyptr == '[') {
> + char *ptr = ++proxyptr; /* advance beyond the initial bracket */
> + while(*ptr && (isxdigit((int)*ptr) || (*ptr == ':')))
> + ptr++;
> + if(*ptr == ']') {
> + /* yeps, it ended nicely with a bracket as well */
> + *ptr = 0;
> + portptr = ptr+1;
> + }
> + /* Note that if this didn't end with a bracket, we still advanced the
> + * proxyptr first, but I can't see anything wrong with that as no host
> + * name nor a numeric can legally start with a bracket.
> + */
> }
>
> - /* allow user to specify proxy.server.com:1080 if desired */
> - prox_portno = strchr (proxyptr, ':');
> + /* Get port number off proxy.server.com:1080 */
> + prox_portno = strchr(portptr, ':');
> if (prox_portno) {
> *prox_portno = 0x0; /* cut off number from host name */
> prox_portno ++;
Received on 2005-05-31