Skip to content

Commit 7937d14

Browse files
committed
pythongh-110467: Fix EOF occurred in violation of protocol starting Python3.10 on large requests
1 parent 1a6e213 commit 7937d14

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Modules/_ssl.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,11 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
645645
{
646646
if (e == 0) {
647647
PySocketSockObject *s = GET_SOCKET(sslsock);
648-
if (ret == 0 || (((PyObject *)s) == Py_None)) {
648+
if (((PyObject *)s) == Py_None) {
649649
p = PY_SSL_ERROR_EOF;
650650
type = state->PySSLEOFErrorObject;
651651
errstr = "EOF occurred in violation of protocol";
652-
} else if (s && ret == -1) {
652+
} else {
653653
/* underlying BIO reported an I/O error */
654654
ERR_clear_error();
655655
#ifdef MS_WINDOWS
@@ -666,10 +666,6 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
666666
type = state->PySSLEOFErrorObject;
667667
errstr = "EOF occurred in violation of protocol";
668668
}
669-
} else { /* possible? */
670-
p = PY_SSL_ERROR_SYSCALL;
671-
type = state->PySSLSyscallErrorObject;
672-
errstr = "Some I/O error occurred";
673669
}
674670
} else {
675671
if (ERR_GET_LIB(e) == ERR_LIB_SSL &&

0 commit comments

Comments
 (0)