summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-05-16 12:53:58 +0100
committerGitHub <noreply@github.com>2021-05-16 12:53:58 +0100
commitb5dcdad34de01283e72e66ffca4b7be6fdbddf9f (patch)
tree2d99fc11938d9628e61ba1932cf8d9f2c60ae24c
parent3532c5f49a7158096666764b099f872e779625c2 (diff)
parent3473a088c645b8361f7b72747610a4a21088a7ed (diff)
downloadlibgit2-b5dcdad34de01283e72e66ffca4b7be6fdbddf9f.tar.gz
Merge pull request #5852 from implausible/httpclient/skip-entire-body
Fix issues with Proxy Authentication after httpclient refactor
-rw-r--r--src/transports/httpclient.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/transports/httpclient.c b/src/transports/httpclient.c
index d3975746b..ba86184df 100644
--- a/src/transports/httpclient.c
+++ b/src/transports/httpclient.c
@@ -681,6 +681,11 @@ static int generate_connect_request(
return git_buf_oom(buf) ? -1 : 0;
}
+static bool use_connect_proxy(git_http_client *client)
+{
+ return client->proxy.url.host && !strcmp(client->server.url.scheme, "https");
+}
+
static int generate_request(
git_http_client *client,
git_http_request *request)
@@ -734,7 +739,8 @@ static int generate_request(
git_buf_printf(buf, "Expect: 100-continue\r\n");
if ((error = apply_server_credentials(buf, client, request)) < 0 ||
- (error = apply_proxy_credentials(buf, client, request)) < 0)
+ (!use_connect_proxy(client) &&
+ (error = apply_proxy_credentials(buf, client, request)) < 0))
return error;
if (request->custom_headers) {
@@ -1027,8 +1033,7 @@ static int http_client_connect(
reset_parser(client);
/* Reconnect to the proxy if necessary. */
- use_proxy = client->proxy.url.host &&
- !strcmp(client->server.url.scheme, "https");
+ use_proxy = use_connect_proxy(client);
if (use_proxy) {
if (!client->proxy_connected || !client->keepalive ||
@@ -1503,7 +1508,7 @@ int git_http_client_skip_body(git_http_client *client)
"unexpected data handled in callback");
error = -1;
}
- } while (!error);
+ } while (error >= 0 && client->state != DONE);
if (error < 0)
client->connected = 0;