Skip to content

Commit bd34631

Browse files
lollipopmanssgelm
andcommitted
httpclient: only free challenges for current_server type
Prior to this commit we freed both the server and proxy auth challenges in git_http_client_read_response. This works when the proxy needs auth or when the server needs auth, but it does not work when both the proxy and the server need auth as we erroneously remove the server auth challenge before we have added them as server credentials. Instead only remove the challenges for the current_server type. Co-authored-by: Stephen Gelman <ssgelm@gmail.com>
1 parent 8720ae8 commit bd34631

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/transports/httpclient.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,11 @@ int git_http_client_read_response(
13741374

13751375
git_http_response_dispose(response);
13761376

1377-
git_vector_free_deep(&client->server.auth_challenges);
1378-
git_vector_free_deep(&client->proxy.auth_challenges);
1377+
if (client->current_server == PROXY) {
1378+
git_vector_free_deep(&client->proxy.auth_challenges);
1379+
} else if(client->current_server == SERVER) {
1380+
git_vector_free_deep(&client->server.auth_challenges);
1381+
}
13791382

13801383
client->state = READING_RESPONSE;
13811384
client->keepalive = 0;

0 commit comments

Comments
 (0)