~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib.py

  • Committer: v.ladeuil+lp at free
  • Date: 2007-02-04 17:41:12 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20070204174112-iv6gxzinnjddlaxj
Add tests for redirection. Preserve transport decorations.

* bzrlib/tests/test_http.py:
(TestRedirections): new tests.

* bzrlib/tests/HttpServer.py:
(HttpServer): Make server host and port public once the socket
have been established.

* bzrlib/tests/HTTPTestUtil.py:
(RedirectRequestHandler, HTTPServerRedirecting): New http test
server for redirections. Only a whole host can be redirected, so
far.

* bzrlib/errors.py:
(RedirectRequested.__init__): Add a 'qual_proto' oso that
transport decorations can be transmitted to redirected transport.
(RedirectRequested._requalify_url,
RedirectRequested.get_source_url,
RedirectRequested.get_target_url): New methods providing fully
decorated urls.

* bzrlib/bzrdir.py:
(BzrDir.open_from_transport): The redirection should preserve
transport decorations.
(BzrDirMetaFormat1): To be able to specialize bzr branches from
foreign branches, we need to register BzrDirMetaFormat1 as the
default control format (instead of BzrDirMetaFormat which is
abstract and can still be used by foreign branches).

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
                and code in (301, 302, 303, 307):
115
115
            raise errors.RedirectRequested(request.get_full_url(),
116
116
                                           request.redirected_to,
117
 
                                           is_permament=(code == 301))
 
117
                                           is_permament=(code == 301),
 
118
                                           qual_proto=self._qualified_proto)
118
119
 
119
120
        if request.redirected_to is not None:
120
121
            mutter('redirected from: %s to: %s' % (request.get_full_url(),