equal
deleted
inserted
replaced
60 def write(self, str): |
60 def write(self, str): |
61 self.writelines(str.split(b'\n')) |
61 self.writelines(str.split(b'\n')) |
62 |
62 |
63 def writelines(self, seq): |
63 def writelines(self, seq): |
64 for msg in seq: |
64 for msg in seq: |
65 self.handler.log_error(r"HG error: %s", encoding.strfromlocal(msg)) |
65 self.handler.log_error("HG error: %s", encoding.strfromlocal(msg)) |
66 |
66 |
67 |
67 |
68 class _httprequesthandler(httpservermod.basehttprequesthandler): |
68 class _httprequesthandler(httpservermod.basehttprequesthandler): |
69 |
69 |
70 url_scheme = b'http' |
70 url_scheme = b'http' |
126 # exception first to ensure it is recorded. |
126 # exception first to ensure it is recorded. |
127 if not ( |
127 if not ( |
128 isinstance(e, (OSError, socket.error)) |
128 isinstance(e, (OSError, socket.error)) |
129 and e.errno == errno.ECONNRESET |
129 and e.errno == errno.ECONNRESET |
130 ): |
130 ): |
131 tb = r"".join(traceback.format_exception(*sys.exc_info())) |
131 tb = "".join(traceback.format_exception(*sys.exc_info())) |
132 # We need a native-string newline to poke in the log |
132 # We need a native-string newline to poke in the log |
133 # message, because we won't get a newline when using an |
133 # message, because we won't get a newline when using an |
134 # r-string. This is the easy way out. |
134 # r-string. This is the easy way out. |
135 newline = chr(10) |
135 newline = chr(10) |
136 self.log_error( |
136 self.log_error( |
137 r"Exception happened during processing " |
137 r"Exception happened during processing " |
138 r"request '%s':%s%s", |
138 "request '%s':%s%s", |
139 self.path, |
139 self.path, |
140 newline, |
140 newline, |
141 tb, |
141 tb, |
142 ) |
142 ) |
143 |
143 |
144 self._start_response(r"500 Internal Server Error", []) |
144 self._start_response("500 Internal Server Error", []) |
145 self._write(b"Internal Server Error") |
145 self._write(b"Internal Server Error") |
146 self._done() |
146 self._done() |
147 |
147 |
148 def do_PUT(self): |
148 def do_PUT(self): |
149 self.do_POST() |
149 self.do_POST() |
333 requireclientcert=reqcert, |
333 requireclientcert=reqcert, |
334 ) |
334 ) |
335 |
335 |
336 def setup(self): |
336 def setup(self): |
337 self.connection = self.request |
337 self.connection = self.request |
338 self.rfile = self.request.makefile(r"rb", self.rbufsize) |
338 self.rfile = self.request.makefile("rb", self.rbufsize) |
339 self.wfile = self.request.makefile(r"wb", self.wbufsize) |
339 self.wfile = self.request.makefile("wb", self.wbufsize) |
340 |
340 |
341 |
341 |
342 try: |
342 try: |
343 import threading |
343 import threading |
344 |
344 |