cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] Re: http proxy tunnel, connect-only and authentication

From: Shmulik Regev <shmulbox_at_gmail.com>
Date: Wed, 11 Jul 2007 09:57:03 +0300

Oddly enough I noticed the same problem Giancarlo patched just the
same day. In my scenario it happened during plain proxy authentication
negotiation (FreeProxy). Anyway the patch handles it perfectly.

While debugging this however I noticed another problem that caused
libcurl to endlessly loop. The situation is admittedly a bit contrived
- I had a breakpoint in in SetupConnection loop (the one calls
ConnectPlease). While debugging enough time passed (I had coffee or
something :) which caused Curl_connecthost to fail on a timeout (i.e.
CURLE_OPERATION_TIMEOUTED is returned). This in turn caused an endless
loop in SetupConnection (as the condition
conn->bits.proxy_connect_closed stays true). The fix below handles
this situation. It might even need to be enhanced to support a wider
range of errors.

Cheers,
Shmul

Index: url.c
===================================================================
--- url.c (revision 1756)
+++ url.c (revision 1761)
@@ -4086,7 +4086,7 @@
       /* if the connection was closed by the server while exchanging
          authentication informations, retry with the new set
          authentication information */
- if(conn->bits.proxy_connect_closed) {
+ if(conn->bits.proxy_connect_closed &&
CURLE_OPERATION_TIMEOUTED!=result) {
         /* reset the error buffer */
         if (data->set.errorbuffer)
           data->set.errorbuffer[0] = '\0';
Received on 2007-07-11