mirror of
https://github.com/NohamR/trio_http_proxy.git
synced 2025-05-24 00:59:27 +00:00
parent
d0e7bcf55c
commit
f3f36cf8bf
@ -20,7 +20,6 @@ import trio
|
|||||||
|
|
||||||
DEFAULT_PORT = 8080
|
DEFAULT_PORT = 8080
|
||||||
PORT = int(getenv('PORT', DEFAULT_PORT))
|
PORT = int(getenv('PORT', DEFAULT_PORT))
|
||||||
OK_CONNECT_PORTS = {443, 8443}
|
|
||||||
|
|
||||||
prn = partial(print, end='')
|
prn = partial(print, end='')
|
||||||
indented = partial(indent, prefix=' ')
|
indented = partial(indent, prefix=' ')
|
||||||
@ -88,7 +87,6 @@ async def process_as_connect_request(stream, bufmaxsz=DEFAULT_BUFFER_SIZE, maxre
|
|||||||
assert h11_nextevt.method == b'CONNECT', f'{h11_nextevt.method=} != CONNECT'
|
assert h11_nextevt.method == b'CONNECT', f'{h11_nextevt.method=} != CONNECT'
|
||||||
desthost, _, destport = h11_nextevt.target.partition(b':')
|
desthost, _, destport = h11_nextevt.target.partition(b':')
|
||||||
destport = int(destport.decode())
|
destport = int(destport.decode())
|
||||||
assert destport in OK_CONNECT_PORTS, f'{destport=} not in {OK_CONNECT_PORTS}'
|
|
||||||
return desthost.decode(), destport
|
return desthost.decode(), destport
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user