]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Revert r1844928 and follow up r1844942.
authorYann Ylavic <ylavic@apache.org>
Sun, 28 Oct 2018 20:55:43 +0000 (20:55 +0000)
committerYann Ylavic <ylavic@apache.org>
Sun, 28 Oct 2018 20:55:43 +0000 (20:55 +0000)
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

modules/ssl/ssl_engine_io.c

index d2fd04ca156f9bcb4bd81a3909b00d745ae84c99..37e8314b7ca38f5c09f7ffd1ceb8d1b0be482c71 100644 (file)
@@ -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;
                     }