aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/http1/protocol.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-07-19 20:46:26 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-07-22 15:30:51 +0200
commit83f013fca13c7395ca4e3da3fac60c8d907172b6 (patch)
treed1dad0ad2ff495808c8ecbe83ce335008d847b22 /netlib/http/http1/protocol.py
parentd62dbee0f6cd47b4cad1ee7cc731b413600c0add (diff)
downloadmitmproxy-83f013fca13c7395ca4e3da3fac60c8d907172b6.tar.gz
mitmproxy-83f013fca13c7395ca4e3da3fac60c8d907172b6.tar.bz2
mitmproxy-83f013fca13c7395ca4e3da3fac60c8d907172b6.zip
introduce EmptyRequest class
Diffstat (limited to 'netlib/http/http1/protocol.py')
-rw-r--r--netlib/http/http1/protocol.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/netlib/http/http1/protocol.py b/netlib/http/http1/protocol.py
index 257efb19..d2a77399 100644
--- a/netlib/http/http1/protocol.py
+++ b/netlib/http/http1/protocol.py
@@ -333,7 +333,7 @@ class HTTP1Protocol(object):
return -1
- def read_request(self, include_body=True, body_size_limit=None):
+ def read_request(self, include_body=True, body_size_limit=None, allow_empty=False):
"""
Parse an HTTP request from a file stream
@@ -354,7 +354,10 @@ class HTTP1Protocol(object):
request_line = self.get_request_line()
if not request_line:
- raise tcp.NetLibDisconnect()
+ if allow_empty:
+ return http.EmptyRequest()
+ else:
+ raise tcp.NetLibDisconnect()
request_line_parts = self.parse_init(request_line)
if not request_line_parts: