Handle HTTP redirects sanely

Bug #36004 reported by James Henstridge
4
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
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

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 36004] Handle HTTP redirects sanely

-----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-----

Revision history for this message
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

Revision history for this message
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

Revision history for this message
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.

Revision history for this message
Martin Pool (mbp) wrote :

jamesh has a good point

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
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.

Revision history for this message
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)
description: updated
Revision history for this message
John A Meinel (jameinel) wrote :

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

Changed in bzr:
assignee: nobody → jameinel
Revision history for this message
John A Meinel (jameinel) wrote :

bumping to 0.11

Revision history for this message
John A Meinel (jameinel) wrote :

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

Vincent Ladeuil (vila)
Changed in bzr:
assignee: jameinel → v-ladeuil
Revision history for this message
John A Meinel (jameinel) wrote :

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

Vincent Ladeuil (vila)
Changed in bzr:
status: Confirmed → In Progress
Vincent Ladeuil (vila)
Changed in bzr:
status: In Progress → Fix Committed
Revision history for this message
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)
Changed in bzr:
status: Fix Committed → Fix Released
Revision history for this message
Scott Finman (scott-aocdesigns) wrote :

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

Changed in bzr:
assignee: v-ladeuil → scott-aocdesigns
Revision history for this message
Scott Finman (scott-aocdesigns) wrote :

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

Changed in bzr:
assignee: scott-aocdesigns → nobody
Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 36004] Re: Handle HTTP redirects sanely

-----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-----

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.