Handle HTTP redirects sanely

Bug #36004 reported by James Henstridge on 2006-03-22
4
Affects Status Importance Assigned to Milestone
Bazaar
Medium
Vincent Ladeuil

Bug Description

It would be nice if bzr handled HTTP redirects sanely.

If getting http://hostname/location/.bzr results in a redirection to some other URL, it should send further requests to the target URL.

In the case of a temporary HTTP redirect, it should use the new URL for the duration of the bzr invocation.

In the case of a permanent HTTP redirect, bzr should record the new URL if it would normally have recorded the old URL. For example, "bzr pull" might update .bzr/parent, and "bzr branch http://..." would record the target URL rather than the specified one.

This is a prerequisite for the fix to bug 39015 to perform well.

Related branches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

James Henstridge wrote:
> If getting http://hostname/location/.bzr results in a redirection to
> some other URL, it should send further requests to the target URL.

You know, I was thinking the same thing, but perversely enough, when I
see your email, I come up with a counter-argument.

A single redirect in a tree structure doesn't indicate that all the
children would also redirect. It would be possible to redirect some or
all of my branch files, while still maintaining the branch at a given
location.

On the other hand, bzr has a native form of redirction: Branch
references. They're the kind of branch that a Checkout uses, but any
attempt to open a Branch reference will instead open the referred-to branch.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEIVs00F+nu1YWqI0RAhAYAJ9VggcZ44YR0jYNwNCh/LOnHBl/FACfR2gW
KaK35LkNZY4kIjBAEhRsM/s=
=h08R
-----END PGP SIGNATURE-----

James Blackwell (jblack) wrote :

Some sites mod_rewrite requests to the top page for the site when in
dirindex mode.

On Wed, Mar 22, 2006 at 01:01:50PM -0000, James Henstridge wrote:
> Public bug reported:
> https://launchpad.net/malone/bugs/36004
>
> Affects: bzr (upstream)
> Severity: Normal
> Priority: (none set)
> Status: Unconfirmed
>
> Description:
> It would be nice if bzr handled HTTP redirects sanely.
>
> If getting http://hostname/location/.bzr results in a redirection to
> some other URL, it should send further requests to the target URL.
>
> In the case of a temporary HTTP redirect, it should use the new URL for
> the duration of the bzr invocation.
>
> In the case of a permanent HTTP redirect, bzr should record the new URL
> if it would normally have recorded the old URL. For example, "bzr pull"
> might update .bzr/parent, and "bzr branch http://..." would record the
> target URL rather than the specified one.

--
My home page: <a href="http://jblack.linuxguru.net">James Blackwell</a>
Gnupg 06357400 F-print AAE4 8C76 58DA 5902 761D 247A 8A55 DA73 0635 7400

Martin Pool (mbp) wrote :

On 22 Mar 2006, Aaron Bentley <email address hidden> wrote:
> Public bug report changed:
> https://launchpad.net/malone/bugs/36004
>
> Comment:
> James Henstridge wrote:
> > If getting http://hostname/location/.bzr results in a redirection to
> > some other URL, it should send further requests to the target URL.

In fact we had a case recently where this would have been good, when we
changed from bazaar-ng.org to bazaar-vcs.org, and at the moment you get
redirects for all the urls.

> You know, I was thinking the same thing, but perversely enough, when I
> see your email, I come up with a counter-argument.
>
> A single redirect in a tree structure doesn't indicate that all the
> children would also redirect. It would be possible to redirect some or
> all of my branch files, while still maintaining the branch at a given
> location.

It might be reasonable to add an http redirect for one branch within a
repository. It seems a bit unlikely that within e.g. one store people
will want to redirect individual files, and it may be reasonable to
disallow it.

> On the other hand, bzr has a native form of redirction: Branch
> references. They're the kind of branch that a Checkout uses, but any
> attempt to open a Branch reference will instead open the referred-to branch.

--
Martin

James Henstridge (jamesh) wrote :

Here is another question related to this problem. Consider the following branches and repositories:

    http://server1/repo1 (bzr repository)
    http://server1/repo1/branch1 (bzr branch inside repo1)
    http://server2/repo2 (bzr repository)
    http://server2/repo2/branch2 (bzr branch inside repo2)

Now consider the following HTTP redirect:
    http://server1/repo1/branch2 => http://server2/repo2/branch2

If I branch or checkout http://server1/repo1/branch2, which repository should be used? The canonical location of the branch is certainly underneath repo2, but the URL used to retrieve the branch is underneath repo1.

One answer would be that files are looked up relative to the canonical location of some file (say .bzr/branch-format). I suppose this might also apply to the above situation on the local file system with symlinks.

Martin Pool (mbp) wrote :

jamesh has a good point

Changed in bzr:
status: Unconfirmed → Confirmed
James Henstridge (jamesh) wrote :

I guess the above example can be simplified even further as a redirect of the form:
    http://oldserver/oldlocation => http://newserver/repo/newlocation

This kind of change might be made if a user is switching to repositories, but the previous published locations make it difficult to use a shared repository. If the redirection is not taken into account when downloading the branch, no repository data will be seen at all.

John A Meinel (jameinel) wrote :

I gave an outline here of what we could do, and it seems to be well received.

http://article.gmane.org/gmane.comp.version-control.bazaar-ng.general/14881

launchpad would like this to be integrated, so that they could use redirects when people request a branch from a main url.
I don't think it should block 0.9, though.

David Allouche (ddaa) on 2006-08-05
description: updated
John A Meinel (jameinel) wrote :

I have a basic implementation plan, just need to implement it.

Changed in bzr:
assignee: nobody → jameinel
John A Meinel (jameinel) wrote :

bumping to 0.11

John A Meinel (jameinel) wrote :

This may be 0.12. 'vila' may also participate in solving this.

Vincent Ladeuil (vila) on 2006-10-20
Changed in bzr:
assignee: jameinel → v-ladeuil
John A Meinel (jameinel) wrote :

Taking out of an explicit milestone until we get a clearer plan.

Vincent Ladeuil (vila) on 2006-12-12
Changed in bzr:
status: Confirmed → In Progress
Vincent Ladeuil (vila) on 2007-02-13
Changed in bzr:
status: In Progress → Fix Committed
Vincent Ladeuil (vila) wrote :

After several discussions, the implementation is to never silently follow redirections but raise an exception.
The only case, so far, where this exception is caught is when accessing a branch for the first time.
In that case the redirections are followed so that the following requests occur against the final target of th redirection chain.

Vincent Ladeuil (vila) on 2007-04-04
Changed in bzr:
status: Fix Committed → Fix Released

Testing launchpad - nothing drastic, and will remove this. Apologies.

Changed in bzr:
assignee: v-ladeuil → scott-aocdesigns

This is a little bit too easy to alter other people's bugs! Reverting.

Changed in bzr:
assignee: scott-aocdesigns → nobody

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Scott Finman wrote:
> This is a little bit too easy to alter other people's bugs! Reverting.

Please put things back the way you found them.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG2tVR0F+nu1YWqI0RAkcDAJ0fjYhRGB1IH9deKH9nPBMs8ApXUACeO30f
mkRcWG9URUsCOjXtZyJPzCk=
=zdu2
-----END PGP SIGNATURE-----

Vincent Ladeuil (vila) wrote :

Revert assignee for historical purposes.

Changed in bzr:
assignee: nobody → v-ladeuil
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints