parent
f75e21c4b1
commit
87a54a0781
|
@ -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]))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
2
setup.py
2
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.'''
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue