Updated SSL socket test to use timeouts
This commit is contained in:
parent
cfb91beb68
commit
a48b4529cd
|
@ -31,7 +31,7 @@ async def test(host: str, port: int, bufsize: int = 4096):
|
||||||
print(f"Attempting a connection to {host}:{port}")
|
print(f"Attempting a connection to {host}:{port}")
|
||||||
await socket.connect((host, port))
|
await socket.connect((host, port))
|
||||||
print("Connected")
|
print("Connected")
|
||||||
async with aiosched.with_context():
|
async with aiosched.with_context(timeout=5, silent=True) as ctx:
|
||||||
async with socket:
|
async with socket:
|
||||||
# Closes the socket automatically
|
# Closes the socket automatically
|
||||||
print("Entered socket context manager, sending request data")
|
print("Entered socket context manager, sending request data")
|
||||||
|
@ -51,7 +51,7 @@ async def test(host: str, port: int, bufsize: int = 4096):
|
||||||
break
|
break
|
||||||
if buffer:
|
if buffer:
|
||||||
data = buffer.decode().split("\r\n")
|
data = buffer.decode().split("\r\n")
|
||||||
print(f"HTTP Response below:")
|
print(f"HTTP Response below {'(might be incomplete)' if ctx.timed_out else ''}:")
|
||||||
_print(f"Response: {data[0]}")
|
_print(f"Response: {data[0]}")
|
||||||
_print("Headers:")
|
_print("Headers:")
|
||||||
content = False
|
content = False
|
||||||
|
|
Reference in New Issue