Show More
@@ -100,16 +100,18 b' class _httprequesthandler(httpservermod.' | |||||
100 | def do_POST(self): |
|
100 | def do_POST(self): | |
101 | try: |
|
101 | try: | |
102 | self.do_write() |
|
102 | self.do_write() | |
103 | except Exception: |
|
103 | except Exception as e: | |
104 | # I/O below could raise another exception. So log the original |
|
104 | # I/O below could raise another exception. So log the original | |
105 | # exception first to ensure it is recorded. |
|
105 | # exception first to ensure it is recorded. | |
106 | tb = r"".join(traceback.format_exception(*sys.exc_info())) |
|
106 | if not (isinstance(e, (OSError, socket.error)) | |
107 | # We need a native-string newline to poke in the log |
|
107 | and e.errno == errno.ECONNRESET): | |
108 | # message, because we won't get a newline when using an |
|
108 | tb = r"".join(traceback.format_exception(*sys.exc_info())) | |
109 | # r-string. This is the easy way out. |
|
109 | # We need a native-string newline to poke in the log | |
110 | newline = chr(10) |
|
110 | # message, because we won't get a newline when using an | |
111 | self.log_error(r"Exception happened during processing " |
|
111 | # r-string. This is the easy way out. | |
112 | r"request '%s':%s%s", self.path, newline, tb) |
|
112 | newline = chr(10) | |
|
113 | self.log_error(r"Exception happened during processing " | |||
|
114 | r"request '%s':%s%s", self.path, newline, tb) | |||
113 |
|
115 | |||
114 | self._start_response(r"500 Internal Server Error", []) |
|
116 | self._start_response(r"500 Internal Server Error", []) | |
115 | self._write(b"Internal Server Error") |
|
117 | self._write(b"Internal Server Error") |
@@ -911,18 +911,6 b' Test signal-safe-lock in web and non-web' | |||||
911 | errors |
|
911 | errors | |
912 |
|
912 | |||
913 | $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py |
|
913 | $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py | |
914 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=spam': (glob) |
|
|||
915 | Traceback (most recent call last): |
|
|||
916 | error: [Errno 104] $ECONNRESET$ |
|
|||
917 |
|
||||
918 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/spam': (glob) |
|
|||
919 | Traceback (most recent call last): |
|
|||
920 | error: [Errno 104] $ECONNRESET$ |
|
|||
921 |
|
||||
922 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/spam/tip/foo': (glob) |
|
|||
923 | Traceback (most recent call last): |
|
|||
924 | error: [Errno 104] $ECONNRESET$ |
|
|||
925 |
|
||||
926 | $ rm -f errors.log |
|
914 | $ rm -f errors.log | |
927 |
|
915 | |||
928 | Uncaught exceptions result in a logged error and canned HTTP response |
|
916 | Uncaught exceptions result in a logged error and canned HTTP response |
General Comments 0
You need to be logged in to leave comments.
Login now