Parse command line arguments.
()
| 25 | |
| 26 | |
| 27 | def parse_args() -> argparse.Namespace: |
| 28 | """Parse command line arguments.""" |
| 29 | parser = argparse.ArgumentParser(description=__doc__) |
| 30 | parser.add_argument("address", help="Address to listen on") |
| 31 | parser.add_argument("port", type=int, default=8080, help="The port to listen on") |
| 32 | parser.add_argument('--drain-request', action='store_true', help="Drain the entire request before closing the connection") |
| 33 | parser.add_argument( |
| 34 | '--abort-response-headers', action='store_true', help="Abort the response in the midst of sending the response headers") |
| 35 | return parser.parse_args() |
| 36 | |
| 37 | |
| 38 | def get_listening_socket(address: str, port: int) -> socket.socket: |