* Fixes #267

* Prepare for v2.1.1
This commit is contained in:
Abhinav Singh 2020-01-30 21:54:03 -08:00 committed by GitHub
parent f75e21c4b1
commit 87a54a0781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 6 deletions

View File

@ -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]))

View File

@ -111,8 +111,9 @@ class HttpParser:
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

View File

@ -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.

View File

@ -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.

View File

@ -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.'''

View File

@ -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(