{"thread":{"id":"30505","subject":"[PATCH 2/3] http: Avoid limit of retrying request only twice","startedAt":"2012-05-11T13:13:54Z","lastAt":"2012-05-11T13:13:54Z","messageCount":1,"participants":["Nelson Benitez Leon"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"191388","messageId":"4FAD1092.2040805@seap.minhap.es","threadId":"30505","inReplyTo":null,"subject":"[PATCH 2/3] http: Avoid limit of retrying request only twice","fromName":"Nelson Benitez Leon","fromEmail":"nelsonjesus.benitez@seap.minhap.es","sentAt":"2012-05-11T13:13:54Z","receivedAt":"2012-05-11T13:13:54Z","isPatch":true,"sender":{"key":"nelsonjesus.benitez@seap.minhap.es","avatar":null},"body":"From: Jeff King <peff@peff.net>\n\nCurrent code, after receiving HTTP_REAUTH, only retried\nonce, so couldn't do step 3 of the following sequence:\n\n  1. We make a request; proxy returns 407, because we didn't give it a\n     password. We ask for the password and return HTTP_REAUTH.\n\n  2. We make another request; the proxy passes it to the actual server,\n     who returns 401, because we didn't give an http password. We ask\n     for the password and return HTTP_REAUTH.\n\n  3. We make a third request, but this time everybody is happy.\n\nNow we retry as long as we keep receiving HTTP_REAUTH, so the previous\nsequence correctly completes.\n\nPatch by Jeff King <peff@peff.net>\n\nSigned-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n http.c |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 624d1a0..d34d741 100644\n--- a/http.c\n+++ b/http.c\n@@ -852,10 +852,13 @@ static int http_request(const char *url, void *result, int target, int options)\n static int http_request_reauth(const char *url, void *result, int target,\n \t\t\t       int options)\n {\n-\tint ret = http_request(url, result, target, options);\n-\tif (ret != HTTP_REAUTH)\n-\t\treturn ret;\n-\treturn http_request(url, result, target, options);\n+\tint ret;\n+\n+\tdo {\n+\t\tret = http_request(url, result, target, options);\n+\t} while (ret == HTTP_REAUTH);\n+\n+\treturn ret;\n }\n \n int http_get_strbuf(const char *url, struct strbuf *result, int options)\n-- \n1.7.7.6\n"}]}