[MERGE] HTTP redirection

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Feb 13 20:49:46 GMT 2007


>>>>> "aaron" == Aaron Bentley <aaron.bentley at utoronto.ca> writes:

    aaron> Aaron Bentley wrote:
    >> Vincent Ladeuil wrote:
    >>> After discussions with Robert at NlSprint, John on IRC and Robert
    >>> again on IRC, here is a new attempt at http redirections.
    >> 
    >> I think this is very close to mergeable.
    >> 
    >>> - By default http do not redirect silently but instead raise the
    >>> RedirectedRequest exception,
    >> 
    >> I'm a little sad to see that removed, because I use
    >> transports elsewhere (e.g. 'bzr patch' from bzrtools) and
    >> I'll have to manually handle redirects now.

Are you sure you have to ?

    aaron> Also, we should make sure that reading a bundle from a
    aaron> URL still follows redirects properly.  And anywhere
    aaron> else we use transports.

I'm not sure I agree, see below.

The consensus was that we shouldn't follow http redirections
anymore *at all* at the transport level.

Robert gave this test case:

 host A that redirects /foo/bar -> host B
                        /foo/gam -> host C
  t = get_transport(http://A/foo/bar)
  t.read('.') # to ensure connection occurs
  t.clone('../gam').base == http://A/foo/gam

For which I have no simple solution that will:
- make that test pass,
- *and* avoid redirecting every request.

So far, the only case where we follow redirections is when we
first access a branch, because it covers the case of site
redirections.

We choose to not follow arbitrary redirections because the other
cases we could imagine was pathological (like a redirection of a
sub-directory of .bzr).

The behavior now, is that the user will get a exception
(RedirectRequested) and can act accordingly (for the other cases
than branch redirection).

I think historically the silent redirection was good because it
has covered the bazaar-ng.org => bazaar-vcs.org.

But it came with a high loss in performance as we were paying a
double roundtrip for every request.

Now, if you have use cases were the redirections are valid*, I'll
happily handle them.




        Vincent

P.S.: I'll answer your review in another mail.

*: As in: it will make the user life easier.



More information about the bazaar mailing list