summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2001-04-13 18:11:59 +0000
committerbrad <brad@openbsd.org>2001-04-13 18:11:59 +0000
commit9662a55334ae6dce8db18b13ed6a0825d3dc9389 (patch)
treefebc6778bc563e1d606d27257ceb2f7176a56b1d /usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c
parent- rx buffer ring management (working) (diff)
downloadwireguard-openbsd-9662a55334ae6dce8db18b13ed6a0825d3dc9389.tar.xz
wireguard-openbsd-9662a55334ae6dce8db18b13ed6a0825d3dc9389.zip
merge mod_ssl 2.8.2
-- Ok'd by: beck@
Diffstat (limited to 'usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c')
-rw-r--r--usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c
index ec5eb151990..4ba1574ca88 100644
--- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c
+++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c
@@ -511,7 +511,7 @@ static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len)
if (rv <= 0) {
if (BIO_sock_should_retry(rv)) {
do {
- retry=0;
+ retry = 0;
FD_ZERO(&fdset);
FD_SET((unsigned int)sock, &fdset);
tv.tv_usec = 0;
@@ -532,7 +532,7 @@ static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len)
"select claimed we could write, "
"but in fact we couldn't. "
"This is a bug in Windows.");
- retry=1;
+ retry = 1;
Sleep(100);
}
}
@@ -554,6 +554,7 @@ static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len)
int rv;
int sock = fb->fd_in;
SSL *ssl;
+ int retry;
ssl = ap_ctx_get(fb->ctx, "ssl");
@@ -566,23 +567,37 @@ static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len)
rv = SSL_read(ssl, buf, len);
if (rv <= 0) {
if (BIO_sock_should_retry(rv)) {
- FD_ZERO(&fdset);
- FD_SET((unsigned int)sock, &fdset);
- tv.tv_usec = 0;
- rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
- if (rv == SOCKET_ERROR)
- err = WSAGetLastError();
- else if (rv == 0) {
- ioctlsocket(sock, FIONBIO, &iostate);
- ap_check_alarm();
- WSASetLastError(WSAEWOULDBLOCK);
- return (SOCKET_ERROR);
- }
- else {
- rv = SSL_read(ssl, buf, len);
+ do {
+ retry = 0;
+ FD_ZERO(&fdset);
+ FD_SET((unsigned int)sock, &fdset);
+ tv.tv_usec = 0;
+ rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
if (rv == SOCKET_ERROR)
err = WSAGetLastError();
- }
+ else if (rv == 0) {
+ ioctlsocket(sock, FIONBIO, &iostate);
+ ap_check_alarm();
+ WSASetLastError(WSAEWOULDBLOCK);
+ return (SOCKET_ERROR);
+ }
+ else {
+ rv = SSL_read(ssl, buf, len);
+ if (rv == SOCKET_ERROR) {
+ if (BIO_sock_should_retry(rv)) {
+ ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL,
+ "select claimed we could read, "
+ "but in fact we couldn't. "
+ "This is a bug in Windows.");
+ retry = 1;
+ Sleep(100);
+ }
+ else {
+ err = WSAGetLastError();
+ }
+ }
+ }
+ } while(retry);
}
}
ioctlsocket(sock, FIONBIO, &iostate);