mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05:00
http-proxy: keep CONNECT connections alive (for NTLM)
When doing CONNECT requests, libcurl must make sure the connection is
alive as much as possible. NTLM requires it and it is generally good for
other cases as well.
NTLM over CONNECT requests has been broken since this regression I
introduced in my CONNECT cleanup commits that started with 41b0237834
,
included since 7.25.0.
Bug: http://curl.haxx.se/bug/view.cgi?id=3538625
Reported by: Marcel Raad
This commit is contained in:
parent
176f7ea3bb
commit
ed7bfeee7a
@ -65,10 +65,14 @@ CURLcode Curl_proxy_connect(struct connectdata *conn)
|
|||||||
* to change the member temporarily for connecting to the HTTP
|
* to change the member temporarily for connecting to the HTTP
|
||||||
* proxy. After Curl_proxyCONNECT we have to set back the member to the
|
* proxy. After Curl_proxyCONNECT we have to set back the member to the
|
||||||
* original pointer
|
* original pointer
|
||||||
|
*
|
||||||
|
* This function might be called several times in the multi interface case
|
||||||
|
* if the proxy's CONNTECT response is not instant.
|
||||||
*/
|
*/
|
||||||
prot_save = conn->data->state.proto.generic;
|
prot_save = conn->data->state.proto.generic;
|
||||||
memset(&http_proxy, 0, sizeof(http_proxy));
|
memset(&http_proxy, 0, sizeof(http_proxy));
|
||||||
conn->data->state.proto.http = &http_proxy;
|
conn->data->state.proto.http = &http_proxy;
|
||||||
|
conn->bits.close = FALSE;
|
||||||
result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
|
result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
|
||||||
conn->host.name, conn->remote_port);
|
conn->host.name, conn->remote_port);
|
||||||
conn->data->state.proto.generic = prot_save;
|
conn->data->state.proto.generic = prot_save;
|
||||||
@ -357,6 +361,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
/* we're done reading chunks! */
|
/* we're done reading chunks! */
|
||||||
infof(data, "chunk reading DONE\n");
|
infof(data, "chunk reading DONE\n");
|
||||||
keepon = FALSE;
|
keepon = FALSE;
|
||||||
|
/* we did the full CONNECT treatment, go COMPLETE */
|
||||||
|
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
infof(data, "Read %zd bytes of chunk, continue\n",
|
infof(data, "Read %zd bytes of chunk, continue\n",
|
||||||
@ -445,6 +451,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
/* we're done reading chunks! */
|
/* we're done reading chunks! */
|
||||||
infof(data, "chunk reading DONE\n");
|
infof(data, "chunk reading DONE\n");
|
||||||
keepon = FALSE;
|
keepon = FALSE;
|
||||||
|
/* we did the full CONNECT treatment, go to
|
||||||
|
COMPLETE */
|
||||||
|
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
infof(data, "Read %zd bytes of chunk, continue\n",
|
infof(data, "Read %zd bytes of chunk, continue\n",
|
||||||
@ -466,6 +475,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
gotbytes - (i+1));
|
gotbytes - (i+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* we did the full CONNECT treatment, go to COMPLETE */
|
||||||
|
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;
|
||||||
break; /* breaks out of for-loop, not switch() */
|
break; /* breaks out of for-loop, not switch() */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,6 +555,17 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} /* END NEGOTIATION PHASE */
|
} /* END NEGOTIATION PHASE */
|
||||||
|
|
||||||
|
/* If we are supposed to continue and request a new URL, which basically
|
||||||
|
* means the HTTP authentication is still going on so if the tunnel
|
||||||
|
* is complete we start over in INIT state */
|
||||||
|
if(data->req.newurl &&
|
||||||
|
(TUNNEL_COMPLETE == conn->tunnel_state[sockindex])) {
|
||||||
|
conn->tunnel_state[sockindex] = TUNNEL_INIT;
|
||||||
|
infof(data, "TUNNEL_STATE switched to: %d\n",
|
||||||
|
conn->tunnel_state[sockindex]);
|
||||||
|
}
|
||||||
|
|
||||||
} while(data->req.newurl);
|
} while(data->req.newurl);
|
||||||
|
|
||||||
if(200 != data->req.httpcode) {
|
if(200 != data->req.httpcode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user