fix mitmproxy tests
This commit is contained in:
parent
1c12e7c2b8
commit
6a678d86e1
|
@ -1,5 +1,6 @@
|
|||
class HttpError(Exception):
|
||||
from netlib import odict
|
||||
|
||||
class HttpError(Exception):
|
||||
def __init__(self, code, message):
|
||||
super(HttpError, self).__init__(message)
|
||||
self.code = code
|
||||
|
@ -9,12 +10,13 @@ class HttpErrorConnClosed(HttpError):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
class HttpAuthenticationError(Exception):
|
||||
def __init__(self, auth_headers=None):
|
||||
super(HttpAuthenticationError, self).__init__(
|
||||
"Proxy Authentication Required"
|
||||
)
|
||||
if isinstance(auth_headers, dict):
|
||||
auth_headers = odict.ODictCaseless(auth_headers.items())
|
||||
self.headers = auth_headers
|
||||
self.code = 407
|
||||
|
||||
|
|
|
@ -302,7 +302,8 @@ class HTTP1Protocol(semantics.ProtocolMixin):
|
|||
bytes_left = expected_size
|
||||
while bytes_left:
|
||||
chunk_size = min(bytes_left, max_chunk_size)
|
||||
yield "", self.tcp_handler.rfile.read(chunk_size), ""
|
||||
content = self.tcp_handler.rfile.read(chunk_size)
|
||||
yield "", content, ""
|
||||
bytes_left -= chunk_size
|
||||
else:
|
||||
bytes_left = limit or -1
|
||||
|
|
Loading…
Reference in New Issue