Rev 2992: Detect invalid transport reuse attempts by catching invalid URLs. in file:///v/home/vila/src/bzr/bugs/161819/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Nov 14 08:05:34 GMT 2007
At file:///v/home/vila/src/bzr/bugs/161819/
------------------------------------------------------------
revno: 2992
revision-id:v.ladeuil+lp at free.fr-20071114080532-1zcuhjjlyz5ml2pu
parent: v.ladeuil+lp at free.fr-20071114075654-fnlbodh0xzc68h24
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 161819
timestamp: Wed 2007-11-14 09:05:32 +0100
message:
Detect invalid transport reuse attempts by catching invalid URLs.
* bzrlib/transport/__init__.py:
(ConnectedTransport._reuse_for): Catch invalid URLs and returns
None.
* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test__reuse_for): _reuse_for now returns None for
invalid URLs.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-11-14 06:06:41 +0000
+++ b/NEWS 2007-11-14 08:05:32 +0000
@@ -45,6 +45,9 @@
* A progress bar has been added for knitpack -> knitpack fetching.
(Robert Collins, #157789)
+ * Detect invalid transport reuse attempts by catching invalid URLs.
+ (Vincent Ladeuil, #161819)
+
* Do no use timeout in HttpServer anymore.
(Vincent Ladeuil, #158972).
@@ -52,9 +55,6 @@
retrying an http request or some programming errors may be masked.
(Vincent Ladeuil, #160012)
- * Don't use timeout in HttpServer anymore.
- (Vincent Ladeuil, #158972).
-
* FTP server errors don't error in the error handling code.
(Robert Collins, #161240)
=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py 2007-11-14 07:56:54 +0000
+++ b/bzrlib/tests/test_transport_implementations.py 2007-11-14 08:05:32 +0000
@@ -1152,8 +1152,7 @@
port = 1234
self.assertIsNot(t, t._reuse_for(new_url(port=port)))
# No point in trying to reuse a transport for a local URL
- self.assertRaises(errors.InvalidURL,
- t._reuse_for('/valid_but_not_existing'))
+ self.assertIs(None, t._reuse_for('/valid_but_not_existing'))
def test_connection_sharing(self):
t = self.get_transport()
=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py 2007-11-04 15:29:17 +0000
+++ b/bzrlib/transport/__init__.py 2007-11-14 08:05:32 +0000
@@ -1514,7 +1514,14 @@
:return: A new transport or None if the connection cannot be shared.
"""
- (scheme, user, password, host, port, path) = self._split_url(other_base)
+ try:
+ (scheme, user, password,
+ host, port, path) = self._split_url(other_base)
+ except errors.InvalidURL:
+ # No hope in trying to reuse an existing transport for an invalid
+ # URL
+ return None
+
transport = None
# Don't compare passwords, they may be absent from other_base or from
# self and they don't carry more information than user anyway.
More information about the bazaar-commits
mailing list