Rev 3881: Fix bug #303959 by returning a transport based on the same url in lp:~vila/bzr/303959-redirection

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Dec 4 11:50:47 GMT 2008


At lp:~vila/bzr/303959-redirection

------------------------------------------------------------
revno: 3881
revision-id: v.ladeuil+lp at free.fr-20081204115030-4dytul8qv82viscm
parent: v.ladeuil+lp at free.fr-20081204112556-g3i9tf396wygm1b7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 303959-redirection
timestamp: Thu 2008-12-04 12:50:30 +0100
message:
  Fix bug #303959 by returning a transport based on the same url
  when redirected to an url with a slash appened.
  
  * bzrlib/tests/test_http.py:
  (Test_redirected_to.test_redirected_to_self_with_slash): Reproduce
  bug #303959.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-12-03 16:40:38 +0000
+++ b/NEWS	2008-12-04 11:50:30 +0000
@@ -26,6 +26,9 @@
     * Preserve transport decorators while following redirections.
       (Vincent Ladeuil, #245964)
 
+    * Provides a finer and more robust filter for accepted redirections.
+      (Vincent Ladeuil, #303959, #265070)
+
     * ``Transport.readv()`` defaults to not reading more than 100MB in a
       single array. Further ``RemoteTransport.readv`` sets this to 5MB to
       work better with how it splits its requests.

=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2008-12-04 11:25:56 +0000
+++ b/bzrlib/tests/test_http.py	2008-12-04 11:50:30 +0000
@@ -1756,6 +1756,18 @@
         # Both transports share the some connection
         self.assertEquals(t._get_connection(), r._get_connection())
 
+    def test_redirected_to_self_with_slash(self):
+        t = self._transport('http://www.example.com/foo')
+        e = errors.RedirectRequested('http://www.example.com/foo',
+                                     'http://www.example.com/foo/',
+                                     self._qualified_prefix)
+        r = t._redirected_to(e)
+        self.assertIsInstance(r, type(t))
+        # Both transports share the some connection (one can argue that we
+        # should return the exact same transport here, but that seems
+        # overkill).
+        self.assertEquals(t._get_connection(), r._get_connection())
+
     def test_redirected_to_host(self):
         t = self._transport('http://www.example.com/foo')
         e = errors.RedirectRequested('http://www.example.com/foo',



More information about the bazaar-commits mailing list