Skip to content

Commit 495bd03

Browse files
authored
bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation (pythonGH-18772)
[bpo-31122](): ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation Reproducer: http://tiny.cc/f4ztnz (tiny url because some bot keeps renaming b.p.o.-nnn as bpo links)
1 parent 40e700a commit 495bd03

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation

Modules/_ssl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,11 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
805805
errno = err.c;
806806
return PyErr_SetFromErrno(PyExc_OSError);
807807
}
808-
Py_INCREF(s);
809-
s->errorhandler();
810-
Py_DECREF(s);
811-
return NULL;
808+
else {
809+
p = PY_SSL_ERROR_EOF;
810+
type = PySSLEOFErrorObject;
811+
errstr = "EOF occurred in violation of protocol";
812+
}
812813
} else { /* possible? */
813814
p = PY_SSL_ERROR_SYSCALL;
814815
type = PySSLSyscallErrorObject;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy