cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: https via proxy may stuck when using multi interface

From: Lau, Hang Kin <hklau_at_avistar.com>
Date: Fri, 18 Jan 2008 13:34:48 -0800

> I read your original email again:
> http://curl.haxx.se/mail/lib-2008-01/0116.html
>
> I disagree with the explanation for the cause and therefore
> also the conclusion about what needs to be done. Can you
> provide any further details or logs or anything that backs up
> your observations?
>
> Could it possibly be so that the entire CONNECT request isn't
> sent in the
> (only) send()? AFAIS, there's no code to send any remainders
> if it didn't sent the entire chunk in one go...

I believe I found something that may be causing the problem:

In multi_getsock(), fdset is not added appropriately for state
CURLM_STATE_WAITPROXYCONNECT. Thus if we are in the WAITPROXYCONNECT
state, the file descriptors may not be added to the FD_SET when we call
curl_multi_fdset(), causing curl to stuck even there are something to
read from the proxy server.

The following patch seems to fix the problem in my case:

Index: multi.c
===================================================================
--- multi.c (revision 7.17.1)
+++ multi.c (working copy)
@@ -772,6 +772,7 @@
   case CURLM_STATE_DOING:
     return Curl_doing_getsock(easy->easy_conn, socks, numsocks);
 
+ case CURLM_STATE_WAITPROXYCONNECT:
   case CURLM_STATE_WAITCONNECT:
     return waitconnect_getsock(easy->easy_conn, socks, numsocks);
--------------------------------------------------------

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--------------------------------------------------------
Received on 2008-01-18