()
| 1481 | |
| 1482 | result = None |
| 1483 | def run_server(): |
| 1484 | [conn, address] = serv.accept() |
| 1485 | with conn, conn.makefile("rb") as reader: |
| 1486 | # Read the request header until a blank line |
| 1487 | while True: |
| 1488 | line = reader.readline() |
| 1489 | if not line.rstrip(b"\r\n"): |
| 1490 | break |
| 1491 | conn.sendall(b"HTTP/1.1 200 Connection established\r\n\r\n") |
| 1492 | nonlocal result |
| 1493 | result = reader.read() |
| 1494 | |
| 1495 | thread = threading.Thread(target=run_server) |
| 1496 | thread.start() |