summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-11-12 13:34:49 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-11-12 14:46:01 +0100
commitb89a4b5191e8471acca14d7de904213b0aa20125 (patch)
tree4012bd59ffcd583d32fcbddaf45b19096787e4a4
parentb589696f0312d50157dbaefa32c816ea288e0b76 (diff)
downloadcurl-b89a4b5191e8471acca14d7de904213b0aa20125.tar.gz
Curl_connect_done: handle being called twice
Follow-up to f0b7099a10d1a7c When torture testing 1021, it turns out the Curl_connect_done function might be called twice and that previously then wrongly cleared the HTTP pointer in the second invoke. Closes #7999
-rw-r--r--lib/http_proxy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index cfe616fa6..2555b401a 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -207,8 +207,9 @@ void Curl_connect_done(struct Curl_easy *data)
Curl_dyn_free(&s->rcvbuf);
Curl_dyn_free(&s->req);
- /* restore the protocol pointer */
- data->req.p.http = s->prot_save;
+ /* restore the protocol pointer, if not already done */
+ if(s->prot_save)
+ data->req.p.http = s->prot_save;
s->prot_save = NULL;
data->info.httpcode = 0; /* clear it as it might've been used for the
proxy */