{"thread":{"id":"30412","subject":"[PATCH 5/6] http: Avoid limit of retrying request only twice","startedAt":"2012-05-03T16:40:28Z","lastAt":"2012-05-04T10:20:34Z","messageCount":4,"participants":["Nelson Benitez Leon","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"190650","messageId":"4FA2B4FC.3030309@seap.minhap.es","threadId":"30412","inReplyTo":null,"subject":"[PATCH 5/6] http: Avoid limit of retrying request only twice","fromName":"Nelson Benitez Leon","fromEmail":"nelsonjesus.benitez@seap.minhap.es","sentAt":"2012-05-03T16:40:28Z","receivedAt":"2012-05-03T16:40:28Z","isPatch":true,"sender":{"key":"nelsonjesus.benitez@seap.minhap.es","avatar":null},"body":"Current 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 c87c66c..1468ec7 100644\n--- a/http.c\n+++ b/http.c\n@@ -912,10 +912,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"},{"id":"190731","messageId":"20120504072427.GE21895@sigill.intra.peff.net","threadId":"30412","inReplyTo":"4FA2B4FC.3030309@seap.minhap.es","subject":"Re: [PATCH 5/6] http: Avoid limit of retrying request only twice","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-04T07:24:27Z","receivedAt":"2012-05-04T07:24:27Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 03, 2012 at 06:40:28PM +0200, Nelson Benitez Leon wrote:\n\n> Current code, after receiving HTTP_REAUTH, only retried\n> once, 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> \n> Now we retry as long as we keep receiving HTTP_REAUTH, so the previous\n> sequence correctly completes.\n> \n> Patch by Jeff King <peff@peff.net>\n\nWe usually spell that as:\n\n  From: Jeff King <peff@peff.net>\n\nat the beginning of the email body (which lets am set the author\nappropriately).\n\nOther than that, the patch looks good to me (unsurprisingly :) ).\n\n-Peff\n"},{"id":"190740","messageId":"20120504092814.GA24398@sigill.intra.peff.net","threadId":"30412","inReplyTo":"4FA3AD72.1010407@seap.minhap.es","subject":"Re: [PATCH 5/6] http: Avoid limit of retrying request only twice","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-04T09:28:15Z","receivedAt":"2012-05-04T09:28:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 04, 2012 at 12:20:34PM +0200, Nelson Benitez Leon wrote:\n\n> On 05/04/2012 09:24 AM, Jeff King wrote:\n> > On Thu, May 03, 2012 at 06:40:28PM +0200, Nelson Benitez Leon wrote:\n> > \n> >> [snip]\n> >>\n> >> Now we retry as long as we keep receiving HTTP_REAUTH, so the previous\n> >> sequence correctly completes.\n> >>\n> >> Patch by Jeff King <peff@peff.net>\n> > \n> > We usually spell that as:\n> > \n> >   From: Jeff King <peff@peff.net>\n> > \n> > at the beginning of the email body (which lets am set the author\n> > appropriately).\n> \n> Are you saying the first line of the email body? isn't that for the\n> commit message first-line? I suppose you're not refering to the 'from\n> field' of the email as I would need alter identities in my email client\n> and found that cumbersome. Sorry for me not getting it and asking for\n> clarification.\n\nYes, that's what I am saying. When Junio applies the patch using \"git\nam\", git will recognize these extra \"pseudo-headers\" at the top of the\nbody, remove them from the commit message, and override the email\nheaders with them.\n\nIt does this for exactly this case; you can leave your email headers\nintact, but still provide attribution to someone else.\n\n-Peff\n"},{"id":"190739","messageId":"4FA3AD72.1010407@seap.minhap.es","threadId":"30412","inReplyTo":"20120504072427.GE21895@sigill.intra.peff.net","subject":"Re: [PATCH 5/6] http: Avoid limit of retrying request only twice","fromName":"Nelson Benitez Leon","fromEmail":"nelsonjesus.benitez@seap.minhap.es","sentAt":"2012-05-04T10:20:34Z","receivedAt":"2012-05-04T10:20:34Z","isPatch":true,"sender":{"key":"nelsonjesus.benitez@seap.minhap.es","avatar":null},"body":"On 05/04/2012 09:24 AM, Jeff King wrote:\n> On Thu, May 03, 2012 at 06:40:28PM +0200, Nelson Benitez Leon wrote:\n> \n>> [snip]\n>>\n>> Now we retry as long as we keep receiving HTTP_REAUTH, so the previous\n>> sequence correctly completes.\n>>\n>> Patch by Jeff King <peff@peff.net>\n> \n> We usually spell that as:\n> \n>   From: Jeff King <peff@peff.net>\n> \n> at the beginning of the email body (which lets am set the author\n> appropriately).\n\nAre you saying the first line of the email body? isn't that for the\ncommit message first-line? I suppose you're not refering to the 'from\nfield' of the email as I would need alter identities in my email client\nand found that cumbersome. Sorry for me not getting it and asking for\nclarification.\n"}]}