[Python-checkins] r81241 - python/trunk/Modules/_ssl.c
antoine.pitrou
python-checkins at python.org
Mon May 17 01:11:46 CEST 2010
Author: antoine.pitrou
Date: Mon May 17 01:11:46 2010
New Revision: 81241
Log:
Clear the OpenSSL error queue each time an error is signalled.
When the error queue is not emptied, strange things can happen on the next SSL call, depending on the OpenSSL version.
Modified:
python/trunk/Modules/_ssl.c
Modified: python/trunk/Modules/_ssl.c
==============================================================================
--- python/trunk/Modules/_ssl.c (original)
+++ python/trunk/Modules/_ssl.c Mon May 17 01:11:46 2010
@@ -196,6 +196,7 @@
errstr = "EOF occurred in violation of protocol";
} else if (ret == -1) {
/* underlying BIO reported an I/O error */
+ ERR_clear_error();
return obj->Socket->errorhandler();
} else { /* possible? */
p = PY_SSL_ERROR_SYSCALL;
@@ -228,6 +229,7 @@
errstr = ERR_error_string(ERR_peek_last_error(), NULL);
}
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
+ ERR_clear_error();
v = Py_BuildValue("(is)", p, buf);
if (v != NULL) {
PyErr_SetObject(PySSLErrorObject, v);
@@ -247,6 +249,7 @@
errstr = ERR_error_string(errcode, NULL);
}
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
+ ERR_clear_error();
v = Py_BuildValue("(is)", errcode, buf);
if (v != NULL) {
PyErr_SetObject(PySSLErrorObject, v);
More information about the Python-checkins
mailing list