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;
Thanks for the report, this problem is now fixed in the git repository.
To try it out, you either checkout/update your git clone: http://curl.haxx.se/source.html
or you try tomorrow's daily snapshot: http://curl.haxx.se/snapshots/