cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3566860 ] parse_proxy interprets "socks://x" as http proxy

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 13 Sep 2012 14:00:13 -0700

Bugs item #3566860, was opened at 2012-09-11 20:08
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3566860&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: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Scott Bailey (scott_bailey)
>Assigned to: Daniel Stenberg (bagder)
Summary: parse_proxy interprets "socks://x" as http proxy

Initial Comment:
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;

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

Comment By: Daniel Stenberg (bagder)
Date: 2012-09-13 14:00

Message:
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/

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3566860&group_id=976
Received on 2012-09-13

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET