diff --git a/proxy.py b/proxy.py index bba62e0c..f29dfbbc 100755 --- a/proxy.py +++ b/proxy.py @@ -222,9 +222,9 @@ class HttpParser(object): self.process_header(line) # See `TestHttpParser.test_connect_request_without_host_header_request_parse` for details - if self.state == HttpParser.states.RCVING_HEADERS and \ + if self.state == HttpParser.states.LINE_RCVD and \ self.method == b'CONNECT' and \ - self.raw.endswith(CRLF * 2): + data == CRLF: self.state = HttpParser.states.COMPLETE if self.state == HttpParser.states.HEADERS_COMPLETE and \ diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..f28d14fd --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,3 @@ +coverage==4.5.2 +pyflakes==2.0.0 +twine==1.12.1 \ No newline at end of file diff --git a/tests.py b/tests.py index 5ca73df5..19ea44bf 100644 --- a/tests.py +++ b/tests.py @@ -99,7 +99,7 @@ class TestHttpParser(unittest.TestCase): def test_split(self): self.assertEqual(HttpParser.split(b'CONNECT python.org:443 HTTP/1.0\r\n\r\n'), - (b'CONNECT python.org:443 HTTP/1.0', '\r\n')) + (b'CONNECT python.org:443 HTTP/1.0', b'\r\n')) def test_split_false_line(self): self.assertEqual(HttpParser.split(b'CONNECT python.org:443 HTTP/1.0'),