/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 breezy/transport/http/response.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from __future__ import absolute_import
25
25
 
26
26
import cgi
 
27
from io import BytesIO
27
28
import os
28
 
try:
29
 
    import http.client as http_client
30
 
except ImportError:  # python < 3
31
 
    import httplib as http_client
32
 
try:
33
 
    import email.utils as email_utils
34
 
except ImportError:  # python < 3
35
 
    import rfc822 as email_utils
 
29
import http.client as http_client
 
30
import email.utils as email_utils
36
31
 
37
32
from ... import (
38
33
    errors,
39
34
    osutils,
40
35
    )
41
 
from ...sixish import (
42
 
    BytesIO,
43
 
    PY3,
44
 
    )
45
36
 
46
37
 
47
38
class ResponseFile(object):
80
71
        :param size:  The number of bytes to read.  Leave unspecified or pass
81
72
            -1 to read to EOF.
82
73
        """
83
 
        if size is None and not PY3:
84
 
            size = -1
85
74
        data = self._file.read(size)
86
75
        self._pos += len(data)
87
76
        return data
220
209
        Parse the headers including the empty line following them so that we
221
210
        are ready to read the data itself.
222
211
        """
223
 
        if PY3:
224
 
            self._headers = http_client.parse_headers(self._file)
225
 
        else:
226
 
            self._headers = http_client.HTTPMessage(self._file, seekable=0)
 
212
        self._headers = http_client.parse_headers(self._file)
227
213
        # Extract the range definition
228
214
        content_range = self._headers.get('content-range', None)
229
215
        if content_range is None: