summaryrefslogtreecommitdiffstats
path: root/modules/ssl
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2020-04-01 21:30:49 +0200
committerRuediger Pluem <rpluem@apache.org>2020-04-01 21:30:49 +0200
commitfd5afc092ccd71a4e48a0f6c891ed6e1b14e187f (patch)
treefa451316fc6365eeb261eb4baac2f0cca4bf409b /modules/ssl
parentap_core_output_filter: follow up to r1875947: don't swallow bucket read EOF. (diff)
downloadapache2-fd5afc092ccd71a4e48a0f6c891ed6e1b14e187f.tar.xz
apache2-fd5afc092ccd71a4e48a0f6c891ed6e1b14e187f.zip
* modules/ssl/ssl_engine_io.c (ssl_io_filter_coalesce): Handle the case
where apr_bucket_read fails with an error and hence our current bucket remains the morphing bucket and is not replaced with a 'data' bucket. If the error is not EAGAINi, error out with an AP_FILTER_ERROR, otherwise just do not consider the morphing bucket that has no data for coalesce. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/ssl')
-rw-r--r--modules/ssl/ssl_engine_io.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c
index 35ccc14ec5..4880c5b6a2 100644
--- a/modules/ssl/ssl_engine_io.c
+++ b/modules/ssl/ssl_engine_io.c
@@ -1739,7 +1739,7 @@ static apr_status_t ssl_io_filter_coalesce(ap_filter_t *f,
&& bytes + buffered < COALESCE_BYTES
&& e != APR_BRIGADE_SENTINEL(bb)
&& !APR_BUCKET_IS_METADATA(e)) {
- apr_status_t rv;
+ apr_status_t rv = APR_SUCCESS;
/* For an indeterminate length bucket (PIPE/CGI/...), try a
* non-blocking read to have it morph into a HEAP. If the
@@ -1753,38 +1753,38 @@ static apr_status_t ssl_io_filter_coalesce(ap_filter_t *f,
if (rv != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(rv)) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, f->c, APLOGNO(10232)
"coalesce failed to read from data bucket");
+ return AP_FILTER_ERROR;
}
}
- /* If the read above made the bucket morph, it may now fit
- * entirely within the buffer. Otherwise, split it so it does
- * fit. */
- if (e->length < COALESCE_BYTES
- && e->length + buffered + bytes < COALESCE_BYTES) {
- rv = APR_SUCCESS;
- }
- else {
- rv = apr_bucket_split(e, COALESCE_BYTES - (buffered + bytes));
- }
-
- if (rv == APR_SUCCESS && e->length == 0) {
- /* As above, don't count in the prefix if the bucket is
- * now zero-length. */
- }
- else if (rv == APR_SUCCESS) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE4, 0, f->c,
- "coalesce: adding %" APR_SIZE_T_FMT " bytes "
- "from split bucket, adding %" APR_SIZE_T_FMT,
- e->length, bytes + buffered);
+ if (rv == APR_SUCCESS) {
+ /* If the read above made the bucket morph, it may now fit
+ * entirely within the buffer. Otherwise, split it so it does
+ * fit. */
+ if (e->length >= COALESCE_BYTES
+ || e->length + buffered + bytes >= COALESCE_BYTES) {
+ rv = apr_bucket_split(e, COALESCE_BYTES - (buffered + bytes));
+ }
- count++;
- bytes += e->length;
- e = APR_BUCKET_NEXT(e);
- }
- else if (rv != APR_ENOTIMPL) {
- ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, f->c, APLOGNO(10233)
- "coalesce: failed to split data bucket");
- return AP_FILTER_ERROR;
+ if (rv == APR_SUCCESS && e->length == 0) {
+ /* As above, don't count in the prefix if the bucket is
+ * now zero-length. */
+ }
+ else if (rv == APR_SUCCESS) {
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE4, 0, f->c,
+ "coalesce: adding %" APR_SIZE_T_FMT " bytes "
+ "from split bucket, adding %" APR_SIZE_T_FMT,
+ e->length, bytes + buffered);
+
+ count++;
+ bytes += e->length;
+ e = APR_BUCKET_NEXT(e);
+ }
+ else if (rv != APR_ENOTIMPL) {
+ ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, f->c, APLOGNO(10233)
+ "coalesce: failed to split data bucket");
+ return AP_FILTER_ERROR;
+ }
}
}