/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
import os
27
27
import httplib
28
 
from cStringIO import StringIO
29
28
import rfc822
30
29
 
31
 
from bzrlib import (
 
30
from ... import (
32
31
    errors,
33
32
    osutils,
34
33
    )
 
34
from ...sixish import (
 
35
    BytesIO,
 
36
    )
35
37
 
36
38
 
37
39
class ResponseFile(object):
121
123
 
122
124
    # in _checked_read() below, we may have to discard several MB in the worst
123
125
    # case. To avoid buffering that much, we read and discard by chunks
124
 
    # instead. The underlying file is either a socket or a StringIO, so reading
 
126
    # instead. The underlying file is either a socket or a BytesIO, so reading
125
127
    # 8k chunks should be fine.
126
128
    _discarded_buf_size = 8192
127
129
 
289
291
                    % (size, self._start, self._size))
290
292
 
291
293
        # read data from file
292
 
        buf = StringIO()
 
294
        buf = BytesIO()
293
295
        limited = size
294
296
        if self._size > 0:
295
297
            # Don't read past the range definition