aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/http1/protocol.py
diff options
context:
space:
mode:
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: