cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2784055 ] connect race with multi and socks proxy

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 01 May 2009 20:13:44 +0000

Bugs item #2784055, was opened at 2009-04-30 02:11
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2784055&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: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Constantine Sapuntzakis (csapuntz)
Assigned to: Daniel Stenberg (bagder)
Summary: connect race with multi and socks proxy

Initial Comment:
Symptom: connections through SOCKS proxy fail when using multi interface - especially SOCKS4A.

Problem: socket is being used by Curl_SOCKS4 before it is connected

Solution: block on connect

Seen on Windows.

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

>Comment By: Daniel Stenberg (bagder)
Date: 2009-05-01 22:13

Message:
Ah, yes thanks for clarifying!

But instead of taking the route of making the behavior even more blocking,
I would instead suggest that we make the socks proxy approach more similar
to the http proxy one.

It uses the asynch connection approch, so for the case when we use the
multi interface and Curl_connecthost() doesn't complete the connect, we
could instead make the socks negotiation magic get called when we reach the
CURLM_STATE_PROTOCONNECT state in lib/multi.c. Wouldn't that work (better)
you think?

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

Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-04-30 15:02

Message:
Better description of problem: I was seeing 75% of my Socks4a connections
failing on setup with socket not connected. Now I see 0%.

The flow I was seeing (before the patch) is the following:

ConnectPlease calls Curl_connecthere which returns immediately in case of
curl_multi, not waiting for connet to finish

ConnectPlease calls Curl_SOCKS4
   which (in the case of SOCKS4a) calls Curl_write_plain
        which calls send() which gets back socket is not connected

The eventual solution is to make Curl_SOCKS support multi directly and not
require blocking, but that will take a lot more time. In the meantime,
there is bug on the known bugs list that says that curl blocks during proxy
connect and multi, but it actually doesn't on Windows.

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

Comment By: Daniel Stenberg (bagder)
Date: 2009-04-30 09:51

Message:
Your patch makes the connect phase blocking. I don't see why that is
necessary. libcurl should simply proceed as usual until connected, why is
using a (socks) proxy any different that any other proxy or connection?

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

Comment By: Constantine Sapuntzakis (csapuntz)
Date: 2009-04-30 02:12

Message:
See attached patch. Not all connections fail - some succeed.

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2784055&group_id=976
Received on 2009-05-01

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET