| OLD | NEW |
| 1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 import re | 4 import re |
| 5 import sys | 5 import sys |
| 6 import threading | 6 import threading |
| 7 import traceback | 7 import traceback |
| 8 | 8 |
| 9 from http.server import BaseHTTPRequestHandler, HTTPServer | 9 from http.server import BaseHTTPRequestHandler, HTTPServer |
| 10 from string import Template | 10 from string import Template |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 help='The file where the logs will be written') | 77 help='The file where the logs will be written') |
| 78 args = parser.parse_args() | 78 args = parser.parse_args() |
| 79 if args.output and args.output != '-': | 79 if args.output and args.output != '-': |
| 80 fh = open(args.output, 'a') | 80 fh = open(args.output, 'a') |
| 81 else: | 81 else: |
| 82 fh = open(sys.stdout.fileno(), 'w', closefd=False) | 82 fh = open(sys.stdout.fileno(), 'w', closefd=False) |
| 83 try: | 83 try: |
| 84 Handler.output = fh | 84 Handler.output = fh |
| 85 Handler.format = args.format | 85 Handler.format = args.format |
| 86 Handler.response = args.response | 86 Handler.response = args.response |
| 87 server_address = ('', args.port) | 87 server_address = ('127.0.0.1', args.port) |
| 88 httpd = HTTPServer(server_address, Handler) | 88 httpd = HTTPServer(server_address, Handler) |
| 89 httpd.serve_forever() | 89 httpd.serve_forever() |
| 90 finally: | 90 finally: |
| 91 fh.close() | 91 fh.close() |
| OLD | NEW |