http: deal with partial CONNECT sends

Also added 'CURL_SMALLSENDS' to make Curl_write() send short packets,
which helped verifying this even more.

Add test 363 to verify.

Reported-by: ustcqidi on github
Fixes #6950
Closes #7024
This commit is contained in:
Daniel Stenberg 2021-05-06 13:04:03 +02:00
parent 63813a0325
commit 51c0ebcff2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
8 changed files with 213 additions and 54 deletions

View file

@ -936,10 +936,8 @@ static int waitproxyconnect_getsock(struct connectdata *conn,
{
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->connect_state)
return GETSOCK_READSOCK(0);
return Curl_connect_getsock(conn);
return GETSOCK_WRITESOCK(0);
}
@ -1111,11 +1109,11 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) {
curl_socket_t s = CURL_SOCKET_BAD;
if(bitmap & GETSOCK_READSOCK(i)) {
if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK((sockbunch[i]))) {
++nfds;
s = sockbunch[i];
}
if(bitmap & GETSOCK_WRITESOCK(i)) {
if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK((sockbunch[i]))) {
++nfds;
s = sockbunch[i];
}