]>
Commit | Line | Data |
---|---|---|
2b3c65ec | 1 | Index: lib/url.c |
2 | =================================================================== | |
3 | RCS file: /cvsroot/curl/curl/lib/url.c,v | |
4 | retrieving revision 1.463 | |
5 | diff -u -r1.463 url.c | |
6 | --- lib/url.c 19 May 2005 07:21:18 -0000 1.463 | |
7 | +++ lib/url.c 31 May 2005 12:35:45 -0000 | |
8 | @@ -2943,25 +2943,44 @@ | |
9 | ||
10 | /* We use 'proxyptr' to point to the proxy name from now on... */ | |
11 | char *proxyptr=proxydup; | |
12 | + char *portptr; | |
13 | ||
14 | if(NULL == proxydup) { | |
15 | failf(data, "memory shortage"); | |
16 | return CURLE_OUT_OF_MEMORY; | |
17 | } | |
18 | ||
19 | - /* Daniel Dec 10, 1998: | |
20 | - We do the proxy host string parsing here. We want the host name and the | |
21 | - port name. Accept a protocol:// prefix, even though it should just be | |
22 | - ignored. */ | |
23 | + /* We do the proxy host string parsing here. We want the host name and the | |
24 | + * port name. Accept a protocol:// prefix, even though it should just be | |
25 | + * ignored. | |
26 | + */ | |
27 | ||
28 | - /* 1. skip the protocol part if present */ | |
29 | + /* Skip the protocol part if present */ | |
30 | endofprot=strstr(proxyptr, "://"); | |
31 | - if(endofprot) { | |
32 | + if(endofprot) | |
33 | proxyptr = endofprot+3; | |
34 | + | |
35 | + /* start scanning for port number at this point */ | |
36 | + portptr = proxyptr; | |
37 | + | |
38 | + /* detect and extract RFC2732-style IPv6-addresses */ | |
39 | + if(*proxyptr == '[') { | |
40 | + char *ptr = ++proxyptr; /* advance beyond the initial bracket */ | |
41 | + while(*ptr && (isxdigit((int)*ptr) || (*ptr == ':'))) | |
42 | + ptr++; | |
43 | + if(*ptr == ']') { | |
44 | + /* yeps, it ended nicely with a bracket as well */ | |
45 | + *ptr = 0; | |
46 | + portptr = ptr+1; | |
47 | + } | |
48 | + /* Note that if this didn't end with a bracket, we still advanced the | |
49 | + * proxyptr first, but I can't see anything wrong with that as no host | |
50 | + * name nor a numeric can legally start with a bracket. | |
51 | + */ | |
52 | } | |
53 | ||
54 | - /* allow user to specify proxy.server.com:1080 if desired */ | |
55 | - prox_portno = strchr (proxyptr, ':'); | |
56 | + /* Get port number off proxy.server.com:1080 */ | |
57 | + prox_portno = strchr(portptr, ':'); | |
58 | if (prox_portno) { | |
59 | *prox_portno = 0x0; /* cut off number from host name */ | |
60 | prox_portno ++; |