#1141 parse_proxy interprets "socks://x" as http proxy

closed-fixed
libcurl (356)
5
2014-08-19
2012-09-12
No

Found in current pull from git repository while developing an app in Debian Linux.

Selected socks proxy in Google's Chrome browser. Resulting in the following environment variables:

NO_PROXY=localhost,127.0.0.0/8
ALL_PROXY=socks://localhost:1080/
all_proxy=socks://localhost:1080/
no_proxy=localhost,127.0.0.0/8

The function parse_proxy() in lib/url.c parses as follows:

/* Parse the protocol part if present */
endofprot = strstr(proxy, "://");
if(endofprot) {
proxyptr = endofprot+3;
if(checkprefix("socks5h", proxy))
conn->proxytype = CURLPROXY_SOCKS5_HOSTNAME;
else if(checkprefix("socks5", proxy))
conn->proxytype = CURLPROXY_SOCKS5;
else if(checkprefix("socks4a", proxy))
conn->proxytype = CURLPROXY_SOCKS4A;
else if(checkprefix("socks4", proxy))
conn->proxytype = CURLPROXY_SOCKS4;
/* Any other xxx:// : change to http proxy */
}
else
proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */

The unfortunate result is that "socks://x" is interpreted as an http proxy resulting in a failure to provide data (error code 52).

I suspect an acceptable default behavior for this tag is a final else if BEFORE defaulting to http:

else if(checkprefix("socks", proxy))
conn->proxytype = CURLPROXY_SOCKS4;

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2012-09-13
    • assigned_to: nobody --> bagder
    • labels: --> libcurl
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks