Rev 5651: Patch from http://padlv/198646 in file:///home/vila/src/bzr/bugs/198646-missing-boundary/

Vincent Ladeuil v.ladeuil+lp at free.fr
Sun May 29 00:30:50 UTC 2011


At file:///home/vila/src/bzr/bugs/198646-missing-boundary/

------------------------------------------------------------
revno: 5651
revision-id: v.ladeuil+lp at free.fr-20110529003050-av0up3d4yfk9omq2
parent: pqm at pqm.ubuntu.com-20110524112316-6nv9mvjm7nai7znr
author: miriup
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 198646-missing-boundary
timestamp: Sun 2011-05-29 02:30:50 +0200
message:
  Patch from http://padlv/198646
  librarian: https://bugs.launchpad.net/bzr/+bug/198646/+attachment/2146101/+files/bzr-boundary-missing.patch
-------------- next part --------------
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2011-01-20 21:15:10 +0000
+++ b/bzrlib/errors.py	2011-05-29 00:30:50 +0000
@@ -1721,6 +1721,16 @@
         self.range = range
         InvalidHttpResponse.__init__(self, path, msg)
 
+class HttpBoundaryMissing(InvalidHttpResponse):
+    """
+    This error basically announces condition described in launchpad bug 198646.
+    """
+
+    _fmt = "HTTP MIME Boundary missing for %(path)s: %(msg)s"
+
+    def __init__(self, path, msg):
+        self.range = range
+        InvalidHttpResponse.__init__(self, path, msg)
 
 class InvalidHttpContentType(InvalidHttpResponse):
 

=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2011-01-26 19:34:58 +0000
+++ b/bzrlib/transport/http/__init__.py	2011-05-29 00:30:50 +0000
@@ -271,7 +271,7 @@
                         cur_offset_and_size = iter_offsets.next()
 
             except (errors.ShortReadvError, errors.InvalidRange,
-                    errors.InvalidHttpRange), e:
+                    errors.InvalidHttpRange, errors.HttpBoundaryMissing), e:
                 mutter('Exception %r: %s during http._readv',e, e)
                 if (not isinstance(e, errors.ShortReadvError)
                     or retried_offset == cur_offset_and_size):

=== modified file 'bzrlib/transport/http/response.py'
--- a/bzrlib/transport/http/response.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/transport/http/response.py	2011-05-29 00:30:50 +0000
@@ -109,6 +109,12 @@
             # To be on the safe side we allow it before any boundary line
             boundary_line = self._file.readline()
 
+        if boundary_line == '':
+            # Special treatment. See launchpad bug 198646.
+            raise errors.HttpBoundaryMissing(
+                    self._path,
+                    self._boundary)
+
         if boundary_line != '--' + self._boundary + '\r\n':
             # rfc822.unquote() incorrectly unquotes strings enclosed in <>
             # IIS 6 and 7 incorrectly wrap boundary strings in <>



More information about the bazaar-commits mailing list