[New-bugs-announce] [issue43717] Confusing OSError on HTTP CONNECT failure

Michael Osipov report at bugs.python.org
Sat Apr 3 15:38:31 EDT 2021

New submission from Michael Osipov <1983-01-06 at gmx.net>:

When working with proxies and HTTP CONNECT I came across these lines: https://github.com/python/cpython/blob/63c69440c7adb0de1d191a8d3d100b335d5c2f81/Lib/http/client.py#L901-L903

I truly fail to see why this is an OSError. OSErrors (https://docs.python.org/3/library/exceptions.html#os-exceptions) describe a low-level issues, but HTTP is a high level protocol. I would expect something like NotConnected or at least something which derives from HTTPException.

OSError is expected on socket issues only.

components: Library (Lib)
messages: 390138
nosy: michael-o
priority: normal
severity: normal
status: open
title: Confusing OSError on HTTP CONNECT failure
type: behavior
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list