Repository navigation
Commit ea3a43e
committed
fix(serve): catch BrokenPipeError/ConnectionResetError in _json_response
Fixes #64: serve.py crashed with BrokenPipeError when an HTTP client
disconnected before the server finished writing the response. The
_json_response() method wrote to self.wfile with no exception handling.
Changes:
- Wrap entire response-writing block in try/except
- Catch (BrokenPipeError, ConnectionResetError) silently
- Client disconnects no longer produce noisy tracebacks1 parent 813821e commit ea3a43e
1 file changed
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
0 commit comments