~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-13 19:58:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713195822-965e2c4422506a75
cleanup pass, allow pycurl connections to be shared between transports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
        r = self._ranges[i]
101
101
 
102
 
        mutter('found range %s %s for pos %s', i, self._ranges[i], self._pos)
 
102
        # mutter('found range %s %s for pos %s', i, self._ranges[i], self._pos)
103
103
 
104
104
        if (self._pos + size - 1) > r._ent_end:
105
105
            raise errors.InvalidRange(self._path, self._pos)
106
106
 
107
107
        start = r._data_start + (self._pos - r._ent_start)
108
108
        end   = start + size
109
 
        mutter("range read %d bytes at %d == %d-%d", size, self._pos,
110
 
                start, end)
 
109
        # mutter("range read %d bytes at %d == %d-%d", size, self._pos,
 
110
        #         start, end)
111
111
        self._pos += (end-start)
112
112
        return self._data[start:end]
113
113
 
136
136
        '\s*([^\s]+)\s+([0-9]+)-([0-9]+)/([0-9]+)\s*$')
137
137
 
138
138
    def __init__(self, path, content_range, input_file):
139
 
        mutter("parsing 206 non-multipart response for %s", path)
 
139
        # mutter("parsing 206 non-multipart response for %s", path)
140
140
        RangeFile.__init__(self, path, input_file)
141
141
        start, end = self._parse_range(content_range, path)
142
142
        self._add_range(start, end, 0)
188
188
        "^--%s(?:\r\n(?:(?:content-range:([^\r]+))|[^\r]+))+\r\n\r\n")
189
189
 
190
190
    def __init__(self, path, content_type, input_file):
191
 
        mutter("parsing 206 multipart response for %s", path)
 
191
        # mutter("parsing 206 multipart response for %s", path)
192
192
        # TODO: jam 20060706 Is it valid to initialize a
193
193
        #       grandparent without initializing parent?
194
194
        RangeFile.__init__(self, path, input_file)
215
215
                    "Expected multipart/byteranges with boundary")
216
216
 
217
217
        boundary = match.group(1)
218
 
        mutter('multipart boundary is %s', boundary)
 
218
        # mutter('multipart boundary is %s', boundary)
219
219
        pattern = HttpMultipartRangeResponse._BOUNDARY_PATT
220
220
        return re.compile(pattern % re.escape(boundary),
221
221
                          re.IGNORECASE | re.MULTILINE)