]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_proxy: restore the protocol pointer on error
authorDaniel Stenberg <daniel@haxx.se>
Thu, 6 Oct 2022 12:13:36 +0000 (14:13 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 24 Oct 2022 13:30:25 +0000 (15:30 +0200)
Reported-by: Trail of Bits
Closes #9790

lib/http_proxy.c
lib/url.c

index 1f87f6c62aa4016595f0656192e6a66040c314d1..cc20b3a801941a03e9f43921d4e1240b3b80f794 100644 (file)
@@ -212,10 +212,8 @@ void Curl_connect_done(struct Curl_easy *data)
     Curl_dyn_free(&s->rcvbuf);
     Curl_dyn_free(&s->req);
 
-    /* restore the protocol pointer, if not already done */
-    if(s->prot_save)
-      data->req.p.http = s->prot_save;
-    s->prot_save = NULL;
+    /* restore the protocol pointer */
+    data->req.p.http = s->prot_save;
     data->info.httpcode = 0; /* clear it as it might've been used for the
                                 proxy */
     data->req.ignorebody = FALSE;
index 690c53c81a3c1fbc5abe7500d70a5a14217ae67b..be5ffca2d8b20c00e7d2eb878f131ec5b084fbb8 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -751,15 +751,6 @@ static void conn_shutdown(struct Curl_easy *data, struct connectdata *conn)
   DEBUGASSERT(data);
   infof(data, "Closing connection %ld", conn->connection_id);
 
-#ifndef USE_HYPER
-  if(conn->connect_state && conn->connect_state->prot_save) {
-    /* If this was closed with a CONNECT in progress, cleanup this temporary
-       struct arrangement */
-    data->req.p.http = NULL;
-    Curl_safefree(conn->connect_state->prot_save);
-  }
-#endif
-
   /* possible left-overs from the async name resolvers */
   Curl_resolver_cancel(data);