From: Yann Ylavic Date: Sun, 28 Oct 2018 20:55:43 +0000 (+0000) Subject: Revert r1844928 and follow up r1844942. X-Git-Tag: 2.5.0-alpha2-ci-test-only~2253 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6f1af5f59cd0a657cdef14fea1276278531f865;p=thirdparty%2Fapache%2Fhttpd.git Revert r1844928 and follow up r1844942. Actually *len can be > 0 here, at least without a change I'm working on but now think should be discussed first probably. Anyway r1844928 alone is broken, just rollback for now. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1845064 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index d2fd04ca156..37e8314b7ca 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -754,17 +754,28 @@ static apr_status_t ssl_io_input_read(bio_filter_in_ctx_t *inctx, if (rc == 0) { /* If EAGAIN, we will loop given a blocking read, * otherwise consider ourselves at EOF. - * On win32 in particular, but perhaps on other kernels, - * a blocking call isn't 'always' blocking. */ if (APR_STATUS_IS_EAGAIN(inctx->rc) || APR_STATUS_IS_EINTR(inctx->rc)) { + /* Already read something, return APR_SUCCESS instead. + * On win32 in particular, but perhaps on other kernels, + * a blocking call isn't 'always' blocking. + */ + if (*len > 0) { + inctx->rc = APR_SUCCESS; + break; + } if (inctx->block == APR_NONBLOCK_READ) { break; } } + else { + if (*len > 0) { + inctx->rc = APR_SUCCESS; + break; + } + } } - ssl_err = SSL_get_error(inctx->filter_ctx->pssl, rc); c = (conn_rec*)SSL_get_app_data(inctx->filter_ctx->pssl); @@ -779,6 +790,10 @@ static apr_status_t ssl_io_input_read(bio_filter_in_ctx_t *inctx, */ inctx->rc = APR_EAGAIN; + if (*len > 0) { + inctx->rc = APR_SUCCESS; + break; + } if (inctx->block == APR_NONBLOCK_READ) { break; } @@ -787,6 +802,11 @@ static apr_status_t ssl_io_input_read(bio_filter_in_ctx_t *inctx, else if (ssl_err == SSL_ERROR_SYSCALL) { if (APR_STATUS_IS_EAGAIN(inctx->rc) || APR_STATUS_IS_EINTR(inctx->rc)) { + /* Already read something, return APR_SUCCESS instead. */ + if (*len > 0) { + inctx->rc = APR_SUCCESS; + break; + } if (inctx->block == APR_NONBLOCK_READ) { break; }