Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-10-18 Thread Junio C Hamano
Jeff King writes: > On Fri, Oct 18, 2013 at 11:25:13AM -0700, Junio C Hamano wrote: > >> Jeff King writes: >> >> > + * Our basic strategy is to compare "base" and "asked" to find the bits >> > + * specific to our request. We then strip those bits off of "got" to >> > yield the >> > + * new bas

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-10-18 Thread Jeff King
On Fri, Oct 18, 2013 at 11:25:13AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > + * Our basic strategy is to compare "base" and "asked" to find the bits > > + * specific to our request. We then strip those bits off of "got" to yield > > the > > + * new base. So for example, if our bas

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-10-18 Thread Junio C Hamano
Jeff King writes: > + * Our basic strategy is to compare "base" and "asked" to find the bits > + * specific to our request. We then strip those bits off of "got" to yield > the > + * new base. So for example, if our base is "http://example.com/foo.git";, > + * and we ask for "http://example.com/

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-09-29 Thread Eric Sunshine
On Sun, Sep 29, 2013 at 3:32 PM, Jeff King wrote: > On Sun, Sep 29, 2013 at 03:26:45PM -0400, Eric Sunshine wrote: > >> On Sat, Sep 28, 2013 at 4:34 AM, Jeff King wrote: >> > diff --git a/http.c b/http.c >> > index 65a0048..8775b5c 100644 >> > --- a/http.c >> > +++ b/http.c >> > @@ -921,11 +921,7

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-09-29 Thread Jeff King
On Sun, Sep 29, 2013 at 03:26:45PM -0400, Eric Sunshine wrote: > On Sat, Sep 28, 2013 at 4:34 AM, Jeff King wrote: > > diff --git a/http.c b/http.c > > index 65a0048..8775b5c 100644 > > --- a/http.c > > +++ b/http.c > > @@ -921,11 +921,71 @@ static int http_request_reauth(const char *url, > > +st

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-09-29 Thread Eric Sunshine
On Sat, Sep 28, 2013 at 4:34 AM, Jeff King wrote: > diff --git a/http.c b/http.c > index 65a0048..8775b5c 100644 > --- a/http.c > +++ b/http.c > @@ -921,11 +921,71 @@ static int http_request_reauth(const char *url, > +static int update_url_from_redirect(struct strbuf *base, > +

Re: [PATCH 6/9] http: update base URLs when we see redirects

2013-09-29 Thread brian m. carlson
On Sat, Sep 28, 2013 at 04:34:05AM -0400, Jeff King wrote: > Subsequent requests will not be for "info/refs", but for > other paths relative to the base. We must ask the caller to > pass in the original base, and we must pass the redirected > base back to the caller (so that it can generte more URL

[PATCH 6/9] http: update base URLs when we see redirects

2013-09-28 Thread Jeff King
If a caller asks the http_get_* functions to go to a particular URL and we end up elsewhere due to a redirect, the effective_url field can tell us where we went. It would be nice to remember this redirect and short-cut further requests for two reasons: 1. It's more efficient. Otherwise we spend