/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-09-01 17:05:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1981.
  • Revision ID: john@arbash-meinel.com-20060901170501-6d5341072dce87e4
Use the regex, rather than stripping off the boundary later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
 
139
139
    # TODO: jam 20060706 Consider compiling these regexes on demand
140
140
    _CONTENT_RANGE_RE = re.compile(
141
 
        '\s*([^\s]+)\s+([0-9]+)-([0-9]+)/([0-9]+)\s*$')
 
141
        r'\s*([^\s]+)\s+([0-9]+)-([0-9]+)/([0-9]+)\s*$')
142
142
 
143
143
    def __init__(self, path, content_range, input_file):
144
144
        # mutter("parsing 206 non-multipart response for %s", path)
179
179
    """A multi-range HTTP response."""
180
180
    
181
181
    _CONTENT_TYPE_RE = re.compile(
182
 
        '^\s*multipart/byteranges\s*;\s*boundary\s*=\s*(.*?)\s*$')
 
182
        r'^\s*multipart/byteranges\s*;\s*boundary\s*=\s*("?)([^"]*?)\1\s*$')
183
183
    
184
184
    # Start with --<boundary>\r\n
185
185
    # and ignore all headers ending in \r\n
221
221
            raise errors.InvalidHttpContentType(path, ctype,
222
222
                    "Expected multipart/byteranges with boundary")
223
223
 
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]
 
224
        boundary = match.group(2)
228
225
        # mutter('multipart boundary is %s', boundary)
229
226
        pattern = HttpMultipartRangeResponse._BOUNDARY_PATT
230
227
        return re.compile(pattern % re.escape(boundary),