cURL / Mailing Lists / curl-library / Single Mail


https via proxy may stuck when using multi interface

From: Lau, Hang Kin <>
Date: Thu, 10 Jan 2008 16:38:50 -0800

Hi all,
I was having problem with libcurl 7.16.2 when connecting to an https
server via an http proxy using multi interface.
It seems if the reply from the http proxy is not received fast enough,
the CONNECT process is not continued.
After looking at the code, it was found that in Curl_proxyCONNECT(),
curl returns immediately if Curl_socket_ready() has nothing to process,
and Curl_proxyCONNECT() is not called again later to continue with the
proxy connect process (contrary to what the comments say).
My colleague worked out a fix to this problem as attached at the end of
this post. It's working fine in our case but it didn't fix the problem
where the state CURLM_STATE_WAITPROXYCONNECT doesn't seem to work as
expected (in our case, we never got to the WAITPROXYCONNECT state).
Index: lib/multi.c
--- lib/multi.c (revision 7.16.2)
+++ lib/multi.c (working copy)
@@ -997,7 +997,7 @@
- if(connected) {
+ if(connected && !easy->easy_conn->bits.tunnel_connecting) {
         if(!protocol_connect) {
           /* We have a TCP connection, but 'protocol_connect' may be
              and then we continue to 'STATE_PROTOCONNECT'. If protocol
Index: lib/url.c
--- lib/url.c (revision 7.16.2)
+++ lib/url.c (working copy)
@@ -2458,7 +2458,7 @@
- if(!conn->bits.protoconnstart) {
+ if(!conn->bits.protoconnstart || conn->bits.tunnel_connecting) {
     if(conn->curl_connect) {
       /* is there a protocol-specific connect() procedure? */

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-11