diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-06-09 08:38:07 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-06-11 12:43:53 +0200 |
commit | 14a2ca85ecb8478772a30d8c2521e5e1d1d98b3d (patch) | |
tree | 20c21ac6bc0b5465a43b581929ed6d81a339feb3 /lib/http_proxy.c | |
parent | 02dfe7193704817184b522888ffa926e6b73f648 (diff) | |
download | curl-14a2ca85ecb8478772a30d8c2521e5e1d1d98b3d.tar.gz |
conn_shutdown: if closed during CONNECT cleanup properly
Reported-by: Alex Xu
Reported-by: Phil E. Taylor
Fixes #7236
Closes #7237
Diffstat (limited to 'lib/http_proxy.c')
-rw-r--r-- | lib/http_proxy.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c index a67d9d3b4..e0a498706 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -129,13 +129,13 @@ CURLcode Curl_proxy_connect(struct Curl_easy *data, int sockindex) bool Curl_connect_complete(struct connectdata *conn) { return !conn->connect_state || - (conn->connect_state->tunnel_state == TUNNEL_COMPLETE); + (conn->connect_state->tunnel_state >= TUNNEL_COMPLETE); } bool Curl_connect_ongoing(struct connectdata *conn) { return conn->connect_state && - (conn->connect_state->tunnel_state != TUNNEL_COMPLETE); + (conn->connect_state->tunnel_state <= TUNNEL_COMPLETE); } /* when we've sent a CONNECT to a proxy, we should rather either wait for the @@ -202,13 +202,16 @@ static void connect_done(struct Curl_easy *data) { struct connectdata *conn = data->conn; struct http_connect_state *s = conn->connect_state; - s->tunnel_state = TUNNEL_COMPLETE; - Curl_dyn_free(&s->rcvbuf); - Curl_dyn_free(&s->req); + if(s->tunnel_state != TUNNEL_EXIT) { + s->tunnel_state = TUNNEL_EXIT; + Curl_dyn_free(&s->rcvbuf); + Curl_dyn_free(&s->req); - /* retore the protocol pointer */ - data->req.p.http = s->prot_save; - infof(data, "CONNECT phase completed!\n"); + /* retore the protocol pointer */ + data->req.p.http = s->prot_save; + s->prot_save = NULL; + infof(data, "CONNECT phase completed!\n"); + } } static CURLcode CONNECT_host(struct Curl_easy *data, |