Commit 41f620d9a1fd701efb6b9910c364d1eac4d47355

Edward Thomson 2018-11-18T19:10:50

http: only load proxy configuration during connection Only load the proxy configuration during connection; we need this data when we're going to connect to the server, however we may mutate it after connection (connecting through a CONNECT proxy means that we should send requests like normal). If we reload the proxy configuration but do not actually reconnect (because we're in a keep-alive session) then we will reload the proxy configuration that we should have mutated. Thus, only load the proxy configuration when we know that we're going to reconnect.

diff --git a/src/transports/http.c b/src/transports/http.c
index ce2e309..4b552ac 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -927,6 +927,9 @@ static int http_connect(http_subtransport *t)
 		t->parse_finished)
 		return 0;
 
+	if ((error = load_proxy_config(t)) < 0)
+		return error;
+
 	if (t->server.stream) {
 		git_stream_close(t->server.stream);
 		git_stream_free(t->server.stream);
@@ -1368,8 +1371,7 @@ static int http_action(
 
 	assert(t->server.url.host && t->server.url.port && t->server.url.path);
 
-	if ((ret = load_proxy_config(t)) < 0 ||
-		(ret = http_connect(t)) < 0)
+	if ((ret = http_connect(t)) < 0)
 		return ret;
 
 	switch (action) {