Skip to content

Commit cf18d03

Browse files
committed
treat SSLEOFError as dropped connection
1 parent a1db120 commit cf18d03

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Unreleased
1212
quoted string values. :issue:`2907`
1313
- Debugger pin auth is synchronized across threads/processes when tracking
1414
failed entries. :issue:`2916`
15+
- Dev server handles unexpected `SSLEOFError` due to issue in Python < 3.13.
16+
:issue:`2926`
1517

1618

1719
Version 3.0.3

src/werkzeug/serving.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737

3838
try:
3939
import ssl
40+
41+
connection_dropped_errors: tuple[type[Exception], ...] = (
42+
ConnectionError,
43+
socket.timeout,
44+
ssl.SSLEOFError,
45+
)
4046
except ImportError:
4147

4248
class _SslDummy:
@@ -47,6 +53,7 @@ def __getattr__(self, name: str) -> t.Any:
4753
)
4854

4955
ssl = _SslDummy() # type: ignore
56+
connection_dropped_errors = (ConnectionError, socket.timeout)
5057

5158
_log_add_style = True
5259

@@ -361,7 +368,7 @@ def execute(app: WSGIApplication) -> None:
361368

362369
try:
363370
execute(self.server.app)
364-
except (ConnectionError, socket.timeout) as e:
371+
except connection_dropped_errors as e:
365372
self.connection_dropped(e, environ)
366373
except Exception as e:
367374
if self.server.passthrough_errors:

0 commit comments

Comments
 (0)