From 8c9f654c4d1e3fcc6519b8761641a1ada717c217 Mon Sep 17 00:00:00 2001 From: Stefan Eissing <icing@apache.org> Date: Thu, 28 Jan 2016 16:13:54 +0000 Subject: [PATCH] backport of r1723122,1723143 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1727393 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 2 ++ STATUS | 10 ---------- modules/ssl/ssl_engine_io.c | 11 ++++++----- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGES b/CHANGES index 7e5a885019..eb47e07961 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ Changes with Apache 2.4.19 + *) mod_ssl: Save some TLS record (application data) fragmentations by + including the last and subsequent suitable buckets when coalescing. *) mod_proxy_fcgi: Suppress HTTP error 503 and message 01075, "Error dispatching request", when the cause appears to be diff --git a/STATUS b/STATUS index 986fff01bc..016b7b2a85 100644 --- a/STATUS +++ b/STATUS @@ -112,16 +112,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_ssl: Save some TLS record (application data) fragmentations by - including the last and subsequent suitable buckets when coalescing. - trunk patch: http://svn.apache.org/r1723122 - http://svn.apache.org/r1723143 - http://svn.apache.org/r1723284 - 2.4.x patch: trunk works, modulo CHANGES (from both r1723122,1723284) - For convenience (possibly): - http://people.apache.org/~ylavic/httpd-2.4.x-ssl_io_filter_coalesce.patch - +1: ylavic, jim, icing - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 23ba739df7..7476b14813 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -1463,7 +1463,7 @@ struct coalesce_ctx { static apr_status_t ssl_io_filter_coalesce(ap_filter_t *f, apr_bucket_brigade *bb) { - apr_bucket *e, *last = NULL; + apr_bucket *e, *endb; apr_size_t bytes = 0; struct coalesce_ctx *ctx = f->ctx; unsigned count = 0; @@ -1490,19 +1490,20 @@ static apr_status_t ssl_io_filter_coalesce(ap_filter_t *f, && (ctx == NULL || bytes + ctx->bytes + e->length < COALESCE_BYTES); e = APR_BUCKET_NEXT(e)) { - last = e; if (e->length) count++; /* don't count zero-length buckets */ bytes += e->length; } + endb = e; /* Coalesce the prefix, if: * a) more than one bucket is found to coalesce, or * b) the brigade contains only a single data bucket, or - * c) + * c) the data bucket is not last but we have buffered data already. */ if (bytes > 0 && (count > 1 - || (count == 1 && APR_BUCKET_NEXT(last) == APR_BRIGADE_SENTINEL(bb)))) { + || (endb == APR_BRIGADE_SENTINEL(bb)) + || (ctx && ctx->bytes > 0))) { /* If coalescing some bytes, ensure a context has been * created. */ if (!ctx) { @@ -1519,7 +1520,7 @@ static apr_status_t ssl_io_filter_coalesce(ap_filter_t *f, * normal path of sending the buffer + remaining buckets in * brigade. */ e = APR_BRIGADE_FIRST(bb); - while (e != last) { + while (e != endb) { apr_size_t len; const char *data; apr_bucket *next; -- 2.40.0