diff options
author | Graham Leggett <minfrin@apache.org> | 2022-01-22 20:05:21 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2022-01-22 20:05:21 +0000 |
commit | 82cba5c0ebbea53f7ae74a9c6cb5402c38e7f8bf (patch) | |
tree | 02c5be78ae69726b21b98858fff907076f8c4a6b | |
parent | 413c52c8e3df8476eeb6c8c42a565a5479ec7181 (diff) | |
download | httpd-82cba5c0ebbea53f7ae74a9c6cb5402c38e7f8bf.tar.gz |
mod_ssl: Add the missing SSL_ERROR_WANT_WRITE case in the SSL_read. Make
sure the sense is correctly specified in response to SSL_ERROR_WANT_READ
and SSL_ERROR_WANT_WRITE so we don't poll for the wrong case.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897353 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/ssl/ssl_engine_io.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 8658ed44e7..c693ad2a3a 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -323,6 +323,7 @@ typedef struct { } char_buffer_t; typedef struct { + conn_rec *c; SSL *ssl; BIO *bio_out; ap_filter_t *f; @@ -795,6 +796,28 @@ static apr_status_t ssl_io_input_read(bio_filter_in_ctx_t *inctx, * (This is usually the case when the client forces an SSL * renegotiation which is handled implicitly by OpenSSL.) */ + inctx->c->cs->sense = CONN_SENSE_WANT_READ; + inctx->rc = APR_EAGAIN; + + if (*len > 0) { + inctx->rc = APR_SUCCESS; + break; + } + if (inctx->block == APR_NONBLOCK_READ) { + break; + } + continue; /* Blocking and nothing yet? Try again. */ + } + if (ssl_err == SSL_ERROR_WANT_WRITE) { + /* + * If OpenSSL wants to write during read, and we were + * nonblocking, report as an EAGAIN. Otherwise loop, + * pulling more data from network filter. + * + * (This is usually the case when the client forces an SSL + * renegotiation which is handled implicitly by OpenSSL.) + */ + inctx->c->cs->sense = CONN_SENSE_WANT_WRITE; inctx->rc = APR_EAGAIN; if (*len > 0) { @@ -2303,6 +2326,7 @@ static void ssl_io_input_add_filter(ssl_filter_ctx_t *filter_ctx, conn_rec *c, #endif BIO_set_data(filter_ctx->pbioRead, (void *)inctx); + inctx->c = c; inctx->ssl = ssl; inctx->bio_out = filter_ctx->pbioWrite; inctx->f = filter_ctx->pInputFilter; |