~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-07-06 19:55:30 UTC
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060706195530-6d119290fa466736
Add tests for HttpMultiRangeResponse

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        #       grandparent without initializing parent?
210
210
        RangeFile.__init__(self, path, input_file)
211
211
 
212
 
        self._parse_boundary(content_type)
 
212
        self.boundary_regex = _parse_boundary(content_type, path)
213
213
 
214
 
        for match in self.BOUNDARY_RE.finditer(self._data):
215
 
            ent_start, ent_end = _parse_range(match.group(1))
 
214
        for match in self.boundary_regex.finditer(self._data):
 
215
            ent_start, ent_end = _parse_range(match.group(1), path)
216
216
            self._add_range(ent_start, ent_end, match.end())
217
217
 
218
218
        self._finish_ranges()
219
219
 
220
 
    def _parse_boundary(self, ctype):
221
 
        match = self.CONTENT_TYPE_RE.match(ctype)
222
 
        if not match:
223
 
            raise TransportError("Invalid Content-type (%s) in HTTP multipart"
224
 
                                 "response for %s!" % (ctype, self._path))
225
 
 
226
 
        boundary = match.group(1)
227
 
        mutter('multipart boundary is %s', boundary)
228
 
        self.BOUNDARY_RE = re.compile(self.BOUNDARY_PATT % re.escape(boundary),
229
 
                                      re.IGNORECASE | re.MULTILINE)