From 2e7e9f9759bab5253a008cdabe0df42551bae922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Nordstr=C3=B6m?= Date: Sun, 5 Sep 2010 21:04:22 +0800 Subject: [PATCH] Wrap read request, concatenating partial reads until whole request have been read --- libmproxy/proxy.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 6196dc0e9..e7a10d601 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -192,6 +192,15 @@ class FileLike: def flush(self): pass + def read(self, length): + result = '' + while len(result) < length: + data = self.o.read(length) + if not data: + break + result += data + return result + def readline(self): result = '' while True: