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: Tue, 11 Sep 2012 20:08:52 -0700

Bugs item #3566860, was opened at 2012-09-11 20:08
Message generated for change (Tracker Item Submitted) made by scott_bailey
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: None
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Scott Bailey (scott_bailey)
Assigned to: Nobody/Anonymous (nobody)
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;

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

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

These mail archives are generated by hypermail.

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

File upload with ASP.NET