From: Justin Erenkrantz Date: Tue, 22 Jan 2002 06:33:35 +0000 (+0000) Subject: - Add AP_MODE_SPECULATIVE support to mod_ssl X-Git-Tag: 2.0.31~127 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72e3b2161425fe7ff4f9fa2f258ddc902bc962bc;p=apache - Add AP_MODE_SPECULATIVE support to mod_ssl - Protect mod_ssl from dealing with modes it doesn't recognize. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92968 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 20467937b9..699ca30fc5 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -646,6 +646,12 @@ static apr_status_t ssl_io_input_read(ssl_io_input_ctx_t *ctx, if ((bytes = char_buffer_read(&ctx->cbuf, buf, wanted))) { *len = bytes; + if (ctx->inbio.mode == AP_MODE_SPECULATIVE) { + /* We want to rollback this read. */ + ctx->cbuf.value -= bytes; + ctx->cbuf.length += bytes; + return APR_SUCCESS; + } if ((*len >= wanted) || ctx->inbio.mode == AP_MODE_GETLINE) { return APR_SUCCESS; } @@ -655,6 +661,9 @@ static apr_status_t ssl_io_input_read(ssl_io_input_ctx_t *ctx, if (rc > 0) { *len += rc; + if (ctx->inbio.mode == AP_MODE_SPECULATIVE) { + char_buffer_write(&ctx->cbuf, buf, rc); + } } return ctx->inbio.rc; @@ -736,8 +745,9 @@ static apr_status_t ssl_io_filter_Input(ap_filter_t *f, apr_off_t bytes = *readbytes; int is_init = (mode == AP_MODE_INIT); - /* XXX: we don't currently support peek or readbytes == -1 */ - if (mode == AP_MODE_EATCRLF || *readbytes == -1) { + /* XXX: we don't currently support anything other than these modes. */ + if (mode != AP_MODE_READBYTES && mode != AP_MODE_GETLINE && + mode != AP_MODE_SPECULATIVE && mode != AP_MODE_INIT) { return APR_ENOTIMPL; } @@ -762,7 +772,8 @@ static apr_status_t ssl_io_filter_Input(ap_filter_t *f, return APR_SUCCESS; } - if (ctx->inbio.mode == AP_MODE_READBYTES) { + if (ctx->inbio.mode == AP_MODE_READBYTES || + ctx->inbio.mode == AP_MODE_SPECULATIVE) { /* Protected from truncation, bytes < MAX_SIZE_T */ if (bytes < len) { len = (apr_size_t)bytes;