diff --git a/proxy/common/version.py b/proxy/common/version.py index 1a23f7912d..170fcbc76b 100644 --- a/proxy/common/version.py +++ b/proxy/common/version.py @@ -8,5 +8,5 @@ :copyright: (c) 2013-present by Abhinav Singh and contributors. :license: BSD, see LICENSE for more details. """ -VERSION = (2, 1, 0) +VERSION = (2, 1, 1) __version__ = '.'.join(map(str, VERSION[0:3])) diff --git a/proxy/http/parser.py b/proxy/http/parser.py index ece1ce0861..1f07bfe15a 100644 --- a/proxy/http/parser.py +++ b/proxy/http/parser.py @@ -111,8 +111,9 @@ def set_url(self, url: bytes) -> None: def set_line_attributes(self) -> None: if self.type == httpParserTypes.REQUEST_PARSER: if self.method == httpMethods.CONNECT and self.url: - u = urlparse.urlsplit(b'//' + self.url.path) - self.host, self.port = u.hostname, u.port + self.host = self.url.scheme + self.port = 443 if self.url.path == b'' else \ + int(self.url.path) elif self.url: self.host, self.port = self.url.hostname, self.url.port \ if self.url.port else DEFAULT_HTTP_PORT diff --git a/proxy/testing/__init__.py b/proxy/testing/__init__.py index ba034136b9..232621f0b5 100644 --- a/proxy/testing/__init__.py +++ b/proxy/testing/__init__.py @@ -2,7 +2,8 @@ """ proxy.py ~~~~~~~~ - ⚡⚡⚡ Fast, Lightweight, Programmable Proxy Server in a single Python file. + ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on + Network monitoring, controls & Application development, testing, debugging. :copyright: (c) 2013-present by Abhinav Singh and contributors. :license: BSD, see LICENSE for more details. diff --git a/proxy/testing/test_case.py b/proxy/testing/test_case.py index cc261f07a5..b1cd9ce8d3 100644 --- a/proxy/testing/test_case.py +++ b/proxy/testing/test_case.py @@ -2,7 +2,8 @@ """ proxy.py ~~~~~~~~ - ⚡⚡⚡ Fast, Lightweight, Programmable Proxy Server in a single Python file. + ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on + Network monitoring, controls & Application development, testing, debugging. :copyright: (c) 2013-present by Abhinav Singh and contributors. :license: BSD, see LICENSE for more details. diff --git a/setup.py b/setup.py index 8ff5ec1f2f..5d376b4d5e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ """ from setuptools import setup, find_packages -VERSION = (2, 1, 0) +VERSION = (2, 1, 1) __version__ = '.'.join(map(str, VERSION[0:3])) __description__ = '''⚡⚡⚡Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.''' diff --git a/tests/http/test_http_parser.py b/tests/http/test_http_parser.py index 6867749c3b..896b778a9b 100644 --- a/tests/http/test_http_parser.py +++ b/tests/http/test_http_parser.py @@ -22,6 +22,11 @@ class TestHttpParser(unittest.TestCase): def setUp(self) -> None: self.parser = HttpParser(httpParserTypes.REQUEST_PARSER) + def test_urlparse(self) -> None: + self.parser.parse(b'CONNECT httpbin.org:443 HTTP/1.1\r\n') + self.assertEqual(self.parser.host, b'httpbin.org') + self.assertEqual(self.parser.port, 443) + def test_build_request(self) -> None: self.assertEqual( build_http_request(