mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merged revisions 81115 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81115 | antoine.pitrou | 2010-05-12 16:02:34 +0200 (mer., 12 mai 2010) | 3 lines Improve _ssl.c formatting ........
This commit is contained in:
parent
ade19175c8
commit
525807bf72
1 changed files with 26 additions and 33 deletions
|
@ -182,8 +182,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
|
||||||
break;
|
break;
|
||||||
case SSL_ERROR_WANT_X509_LOOKUP:
|
case SSL_ERROR_WANT_X509_LOOKUP:
|
||||||
p = PY_SSL_ERROR_WANT_X509_LOOKUP;
|
p = PY_SSL_ERROR_WANT_X509_LOOKUP;
|
||||||
errstr =
|
errstr = "The operation did not complete (X509 lookup)";
|
||||||
"The operation did not complete (X509 lookup)";
|
|
||||||
break;
|
break;
|
||||||
case SSL_ERROR_WANT_CONNECT:
|
case SSL_ERROR_WANT_CONNECT:
|
||||||
p = PY_SSL_ERROR_WANT_CONNECT;
|
p = PY_SSL_ERROR_WANT_CONNECT;
|
||||||
|
@ -197,8 +196,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
|
||||||
= (PySocketSockObject *) PyWeakref_GetObject(obj->Socket);
|
= (PySocketSockObject *) PyWeakref_GetObject(obj->Socket);
|
||||||
if (ret == 0 || (((PyObject *)s) == Py_None)) {
|
if (ret == 0 || (((PyObject *)s) == Py_None)) {
|
||||||
p = PY_SSL_ERROR_EOF;
|
p = PY_SSL_ERROR_EOF;
|
||||||
errstr =
|
errstr = "EOF occurred in violation of protocol";
|
||||||
"EOF occurred in violation of protocol";
|
|
||||||
} else if (ret == -1) {
|
} else if (ret == -1) {
|
||||||
/* underlying BIO reported an I/O error */
|
/* underlying BIO reported an I/O error */
|
||||||
return s->errorhandler();
|
return s->errorhandler();
|
||||||
|
@ -221,8 +219,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
|
||||||
/* XXX Protected by global interpreter lock */
|
/* XXX Protected by global interpreter lock */
|
||||||
errstr = ERR_error_string(e, NULL);
|
errstr = ERR_error_string(e, NULL);
|
||||||
else { /* possible? */
|
else { /* possible? */
|
||||||
errstr =
|
errstr = "A failure in the SSL library occurred";
|
||||||
"A failure in the SSL library occurred";
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1217,11 +1214,9 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (err == SSL_ERROR_WANT_READ) {
|
if (err == SSL_ERROR_WANT_READ) {
|
||||||
sockstate =
|
sockstate = check_socket_and_wait_for_timeout(sock, 0);
|
||||||
check_socket_and_wait_for_timeout(sock, 0);
|
|
||||||
} else if (err == SSL_ERROR_WANT_WRITE) {
|
} else if (err == SSL_ERROR_WANT_WRITE) {
|
||||||
sockstate =
|
sockstate = check_socket_and_wait_for_timeout(sock, 1);
|
||||||
check_socket_and_wait_for_timeout(sock, 1);
|
|
||||||
} else {
|
} else {
|
||||||
sockstate = SOCKET_OPERATION_OK;
|
sockstate = SOCKET_OPERATION_OK;
|
||||||
}
|
}
|
||||||
|
@ -1350,11 +1345,9 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
|
||||||
if (PyErr_CheckSignals())
|
if (PyErr_CheckSignals())
|
||||||
goto error;
|
goto error;
|
||||||
if (err == SSL_ERROR_WANT_READ) {
|
if (err == SSL_ERROR_WANT_READ) {
|
||||||
sockstate =
|
sockstate = check_socket_and_wait_for_timeout(sock, 0);
|
||||||
check_socket_and_wait_for_timeout(sock, 0);
|
|
||||||
} else if (err == SSL_ERROR_WANT_WRITE) {
|
} else if (err == SSL_ERROR_WANT_WRITE) {
|
||||||
sockstate =
|
sockstate = check_socket_and_wait_for_timeout(sock, 1);
|
||||||
check_socket_and_wait_for_timeout(sock, 1);
|
|
||||||
} else if ((err == SSL_ERROR_ZERO_RETURN) &&
|
} else if ((err == SSL_ERROR_ZERO_RETURN) &&
|
||||||
(SSL_get_shutdown(self->ssl) ==
|
(SSL_get_shutdown(self->ssl) ==
|
||||||
SSL_RECEIVED_SHUTDOWN))
|
SSL_RECEIVED_SHUTDOWN))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue