On Tue, 10 Feb 2015, laser peter via curl-library wrote:
Please review Line 649-->653 in the file attached, thanks.
Ah, but that was a complete file, not a patch. I did mail a link with
instructions on how to make one properly...
Still, based on your suggested change I think I understand the problem. It
seems to be that the code uses some happy eyeballs logic even _after_ CONNECT
has been sent to a proxy, while the happy eyeball phase is already (should be)
over by then.
So, to make the fix nicer I split waitconnect_getsock in two, and there's now
a waitproxyconnect_getsock as well.
I would be very happy if you could try out this fix and see if it makes life
any better in your end!
--
/ daniel.haxx.se
From d974c8b0c1b6d68cd93e98606dcbf17bedfef4a2 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <[email protected]>
Date: Wed, 11 Feb 2015 23:18:32 +0100
Subject: [PATCH] multi: fix *getsock() handling after CONNECT
The code used some happy eyeballs logic even _after_ CONNECT has been
sent to a proxy, while the happy eyeball phase is already (should be)
over by then.
Bug: http://curl.haxx.se/mail/lib-2015-01/0170.html
Reported-by: Peter Laser
---
lib/multi.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/multi.c b/lib/multi.c
index 97c9e65..b3ae472 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -647,18 +647,28 @@ static int waitconnect_getsock(struct connectdata *conn,
sock[s] = conn->tempsock[i];
rc |= GETSOCK_WRITESOCK(s++);
}
}
+ return rc;
+}
+
+static int waitproxyconnect_getsock(struct connectdata *conn,
+ curl_socket_t *sock,
+ int numsocks)
+{
+ if(!numsocks)
+ return GETSOCK_BLANK;
+
+ sock[0] = conn->sock[FIRSTSOCKET];
+
/* when we've sent a CONNECT to a proxy, we should rather wait for the
socket to become readable to be able to get the response headers */
- if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) {
- sock[0] = conn->sock[FIRSTSOCKET];
- rc = GETSOCK_READSOCK(0);
- }
+ if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)
+ return GETSOCK_READSOCK(0);
- return rc;
+ return GETSOCK_WRITESOCK(0);
}
static int domore_getsock(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
@@ -714,10 +724,12 @@ static int multi_getsock(struct SessionHandle *data,
case CURLM_STATE_DO:
case CURLM_STATE_DOING:
return Curl_doing_getsock(data->easy_conn, socks, numsocks);
case CURLM_STATE_WAITPROXYCONNECT:
+ return waitproxyconnect_getsock(data->easy_conn, socks, numsocks);
+
case CURLM_STATE_WAITCONNECT:
return waitconnect_getsock(data->easy_conn, socks, numsocks);
case CURLM_STATE_DO_MORE:
return domore_getsock(data->easy_conn, socks, numsocks);
--
2.1.4
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html