/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-08-31 21:34:20 UTC
  • mto: This revision was merged to the branch mainline in revision 1981.
  • Revision ID: john@arbash-meinel.com-20060831213420-2297bb5599b11cb9
Fix bug #57723, parse boundary="" correctly, since Squid uses it

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
                                 self._ent_start, self._ent_end,
61
61
                                 self._data_start)
62
62
 
 
63
    __repr__ = __str__
 
64
 
63
65
 
64
66
class RangeFile(object):
65
67
    """File-like object that allow access to partial available data.
96
98
        i = bisect(self._ranges, self._pos) - 1
97
99
 
98
100
        if i < 0 or self._pos > self._ranges[i]._ent_end:
 
101
            mutter('Bisect for pos: %s failed. Found offset: %d, ranges:%s',
 
102
                   self._pos, i, self._ranges)
99
103
            raise errors.InvalidRange(self._path, self._pos)
100
104
 
101
105
        r = self._ranges[i]
195
199
        RangeFile.__init__(self, path, input_file)
196
200
 
197
201
        self.boundary_regex = self._parse_boundary(content_type, path)
 
202
        # mutter('response:\n%r', self._data)
198
203
 
199
204
        for match in self.boundary_regex.finditer(self._data):
200
205
            ent_start, ent_end = HttpRangeResponse._parse_range(match.group(1),
217
222
                    "Expected multipart/byteranges with boundary")
218
223
 
219
224
        boundary = match.group(1)
 
225
        # Remove double quotes around the boundary tag
 
226
        if (boundary.startswith('"') and boundary.endswith('"')):
 
227
            boundary = boundary[1:-1]
220
228
        # mutter('multipart boundary is %s', boundary)
221
229
        pattern = HttpMultipartRangeResponse._BOUNDARY_PATT
222
230
        return re.compile(pattern % re.escape(boundary),