diff options
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 31308e6f..33e50890 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -107,7 +107,7 @@ def read_chunked(fp, limit): def read_http_body(rfile, connection, headers, all, limit): if 'transfer-encoding' in headers: - if not ",".join(headers["transfer-encoding"]) == "chunked": + if not ",".join(headers["transfer-encoding"]).lower() == "chunked": raise IOError('Invalid transfer-encoding') content = read_chunked(rfile, limit) elif "content-length" in headers: @@ -185,10 +185,14 @@ class FileLike: result += data return result - def readline(self): + def readline(self, size = None): result = '' + bytes_read = 0 while True: + if size is not None and bytes_read >= size: + break ch = self.read(1) + bytes_read += 1 if not ch: break else: |