]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_proxy: multiple CONNECT with hyper done better
authorDaniel Stenberg <daniel@haxx.se>
Thu, 21 Oct 2021 14:42:42 +0000 (16:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Oct 2021 15:28:27 +0000 (17:28 +0200)
Enabled test 206

Closes #7888

lib/http_proxy.c
tests/data/DISABLED

index d144990c596c7d86801a359c4fc9fef230cd1e4b..8fc9c6222bc2faebaa56377ee61a74a5291c73f5 100644 (file)
@@ -284,8 +284,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
         /* This only happens if we've looped here due to authentication
            reasons, and we don't really use the newly cloned URL here
            then. Just free() it. */
-      free(data->req.newurl);
-      data->req.newurl = NULL;
+      Curl_safefree(data->req.newurl);
 
       /* initialize send-buffer */
       Curl_dyn_init(req, DYN_HTTP_REQUEST);
@@ -805,6 +804,14 @@ static CURLcode CONNECT(struct Curl_easy *data,
         goto error;
       }
 
+      infof(data, "Establish HTTP proxy tunnel to %s:%d",
+            hostname, remote_port);
+
+        /* This only happens if we've looped here due to authentication
+           reasons, and we don't really use the newly cloned URL here
+           then. Just free() it. */
+      Curl_safefree(data->req.newurl);
+
       result = CONNECT_host(data, conn, hostname, remote_port,
                             &hostheader, &host);
       if(result)
@@ -945,6 +952,14 @@ static CURLcode CONNECT(struct Curl_easy *data,
     default:
       break;
     }
+
+    /* 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 == s->tunnel_state)) {
+      infof(data, "CONNECT request done, loop to make another");
+      connect_init(data, TRUE); /* reinit */
+    }
   } while(data->req.newurl);
 
   result = CURLE_OK;
index 7d1005f66817dce874d96f51cbfe096cf6f2df0c..4b43e198e0f7d7f7e7d627da56495a359deb2831 100644 (file)
@@ -40,7 +40,6 @@
 # hyper support remains EXPERIMENTAL as long as there's a test number
 # listed below
 %if hyper
-206
 207
 209
 213