diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-04-23 08:23:51 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-04-23 08:23:51 +1200 |
commit | 42a87a1d8b3eeccfdd8e5e504f1cd4d90ae1dbfb (patch) | |
tree | deadd99d45bdd4e4806090485aa246bc955d1813 /netlib/http.py | |
parent | 4fb49c8e55cc3c64ac0d5cf8fb913518f1973162 (diff) | |
download | mitmproxy-42a87a1d8b3eeccfdd8e5e504f1cd4d90ae1dbfb.tar.gz mitmproxy-42a87a1d8b3eeccfdd8e5e504f1cd4d90ae1dbfb.tar.bz2 mitmproxy-42a87a1d8b3eeccfdd8e5e504f1cd4d90ae1dbfb.zip |
websockets: handshake checks only take headers
Diffstat (limited to 'netlib/http.py')
-rw-r--r-- | netlib/http.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/netlib/http.py b/netlib/http.py index fe27240a..43155486 100644 --- a/netlib/http.py +++ b/netlib/http.py @@ -33,7 +33,7 @@ def _is_valid_host(host): return True -def get_line(fp): +def get_request_line(fp): """ Get a line, possibly preceded by a blank. """ @@ -41,8 +41,6 @@ def get_line(fp): if line == "\r\n" or line == "\n": # Possible leftover from previous message line = fp.readline() - if line == "": - raise tcp.NetLibDisconnect() return line @@ -457,7 +455,9 @@ def read_request(rfile, include_body=True, body_size_limit=None, wfile=None): httpversion, host, port, scheme, method, path, headers, content = ( None, None, None, None, None, None, None, None) - request_line = get_line(rfile) + request_line = get_request_line(rfile) + if not request_line: + raise tcp.NetLibDisconnect() request_line_parts = parse_init(request_line) if not request_line_parts: |