| 110 | def log_message(self, format, *args): |
| 111 | logger.debug(" ".join(args)) |
| 112 | def _write(self, status_code, content_type, content): |
| 113 | self.send_response(status_code) |
| 114 | if content: |
| 115 | self.send_header("Content-Type", content_type) |
| 116 | self.send_header("Content-Length", len(content)) |
| 117 | self.end_headers() |
| 118 | if self.command != "HEAD": |
| 119 | if status_code == 404 and content is None: |
| 120 | self.wfile.write(str(status_code).encode("utf-8")) |
| 121 | elif (status_code in (200, 404)) and content is not None: |
| 122 | self.wfile.write(content) |
| 123 | |
| 124 | class _ThreadedHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer): |
| 125 | pass |