Skip to content

Commit 1d180b2

Browse files
committed
Fix handling of non-blocking reads in mod_ssl (triggered by recent
change to mod_proxy_http): * modules/ssl/ssl_engine_io.c (bio_filter_in_read): Return an error if the read would block so that the SSL_read() caller checks for SSL_ERROR_WANT_READ, rather than 0, which is treated like EOF. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/ssl@105768 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2f40902 commit 1d180b2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

ssl_engine_io.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,14 @@ static int bio_filter_in_read(BIO *bio, char *in, int inlen)
488488
AP_MODE_READBYTES, block,
489489
inl);
490490

491-
/* Not a problem, there was simply no data ready yet.
492-
*/
491+
/* If the read returns EAGAIN or success with an empty
492+
* brigade, return an error after setting the retry flag;
493+
* SSL_read() will then return -1, and SSL_get_error() will
494+
* indicate SSL_ERROR_WANT_READ. */
493495
if (APR_STATUS_IS_EAGAIN(inctx->rc) || APR_STATUS_IS_EINTR(inctx->rc)
494496
|| (inctx->rc == APR_SUCCESS && APR_BRIGADE_EMPTY(inctx->bb))) {
495497
BIO_set_retry_read(bio);
496-
return 0;
498+
return -1;
497499
}
498500

499501
if (inctx->rc != APR_SUCCESS) {

0 commit comments

Comments
 (0)