diff options
| author | 2004-12-02 19:42:46 +0000 | |
|---|---|---|
| committer | 2004-12-02 19:42:46 +0000 | |
| commit | beb894e9112853f8ec6191dfabc17833945d5384 (patch) | |
| tree | b54efe18b2c59c6e8b8e7c957cc8c0be1793f8cd /usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c | |
| parent | We do not support 2MB machines, so don't bother taking them into account (diff) | |
| download | wireguard-openbsd-beb894e9112853f8ec6191dfabc17833945d5384.tar.xz wireguard-openbsd-beb894e9112853f8ec6191dfabc17833945d5384.zip | |
big time httpd cleanup
this diff removes a lot of #ifdef'd stuff that is irrelevant for us.
done by Daniel Ouellet after my advice.
tested by many, ok miod@
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.c | 170 |
1 files changed, 0 insertions, 170 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 63347a159d4..6ac2baca0d3 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_engine_io.c @@ -305,10 +305,6 @@ static int ssl_io_hook_write(BUFF *fb, char *buf, int len); #ifndef NO_WRITEV static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt); #endif -#ifdef WIN32 -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len); -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len); -#endif /* WIN32 */ void ssl_io_register(void) { @@ -317,12 +313,6 @@ void ssl_io_register(void) #ifndef NO_WRITEV ap_hook_register("ap::buff::writev", ssl_io_hook_writev, AP_HOOK_NOCTX); #endif -#ifdef WIN32 - ap_hook_register("ap::buff::recvwithtimeout", - ssl_io_hook_recvwithtimeout, AP_HOOK_NOCTX); - ap_hook_register("ap::buff::sendwithtimeout", - ssl_io_hook_sendwithtimeout, AP_HOOK_NOCTX); -#endif return; } @@ -333,10 +323,6 @@ void ssl_io_unregister(void) #ifndef NO_WRITEV ap_hook_unregister("ap::buff::writev", ssl_io_hook_writev); #endif -#ifdef WIN32 - ap_hook_unregister("ap::buff::recvwithtimeout", ssl_io_hook_recvwithtimeout); - ap_hook_unregister("ap::buff::sendwithtimeout", ssl_io_hook_sendwithtimeout); -#endif return; } @@ -443,37 +429,6 @@ static int ssl_io_hook_writev(BUFF *fb, const struct iovec *iov, int iovcnt) } #endif -#ifdef WIN32 - -/* and the prototypes for our SSL_xxx variants */ -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len); -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len); - -static int ssl_io_hook_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_recvwithtimeout(fb, buf, len); - else - rc = ap_recvwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - SSL *ssl; - int rc; - - if ((ssl = ap_ctx_get(fb->ctx, "ssl")) != NULL) - rc = SSL_sendwithtimeout(fb, buf, len); - else - rc = ap_sendwithtimeout(fb->fd, buf, len, 0); - return rc; -} - -#endif /* WIN32 */ /* _________________________________________________________________ ** @@ -481,131 +436,6 @@ static int ssl_io_hook_sendwithtimeout(BUFF *fb, const char *buf, int len) ** _________________________________________________________________ */ -#ifdef WIN32 - -static int SSL_sendwithtimeout(BUFF *fb, const char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int sock = fb->fd; - int retry; - SSL *ssl; - - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_write(ssl, (char*)buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - if (rv) { - err = WSAGetLastError(); - ap_assert(0); - } - rv = SSL_write(ssl, (char*)buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, NULL, &fdset, NULL, &tv); - if (rv == SOCKET_ERROR) - err = WSAGetLastError(); - else if (rv == 0) { - ioctlsocket(sock, FIONBIO, &iostate); - if(ap_check_alarm() < 0) { - WSASetLastError(EINTR); /* Simulate an alarm() */ - return (SOCKET_ERROR); - } - } - else { - rv = SSL_write(ssl, (char*)buf, len); - if (BIO_sock_should_retry(rv)) { - ap_log_error(APLOG_MARK,APLOG_DEBUG, NULL, - "select claimed we could write, " - "but in fact we couldn't. " - "This is a bug in Windows."); - retry = 1; - Sleep(100); - } - } - } while(retry); - } - } - ioctlsocket(sock, FIONBIO, &iostate); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -static int SSL_recvwithtimeout(BUFF *fb, char *buf, int len) -{ - int iostate = 1; - fd_set fdset; - struct timeval tv; - int err = WSAEWOULDBLOCK; - int rv; - int sock = fb->fd_in; - SSL *ssl; - int retry; - - ssl = ap_ctx_get(fb->ctx, "ssl"); - - if (!(tv.tv_sec = ap_check_alarm())) - return (SSL_read(ssl, buf, len)); - - rv = ioctlsocket(sock, FIONBIO, &iostate); - iostate = 0; - ap_assert(!rv); - rv = SSL_read(ssl, buf, len); - if (rv <= 0) { - if (BIO_sock_should_retry(rv)) { - do { - retry = 0; - FD_ZERO(&fdset); - FD_SET((unsigned int)sock, &fdset); - tv.tv_usec = 0; - rv = select(sock + 1, &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); - if (rv == SOCKET_ERROR) - WSASetLastError(err); - return (rv); -} - -#endif /*WIN32*/ /* * There is no SSL_writev() provided by OpenSSL. The reason is mainly because |
