summaryrefslogtreecommitdiff
path: root/server/util_filter.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-09-06 22:48:28 +0000
committerYann Ylavic <ylavic@apache.org>2018-09-06 22:48:28 +0000
commit5ab81a73c1c320eb81fd4ab81f8cd41b19222b52 (patch)
tree4f0a6728fb33300aaf6e64a82898180af3f63b7a /server/util_filter.c
parent4d3ea26e33216b68fc09d520349cdc2d07fb2972 (diff)
downloadhttpd-5ab81a73c1c320eb81fd4ab81f8cd41b19222b52.tar.gz
Follow up to r1840149: core input filter pending data.
Since r1840149 ap_core_input_filter() can't use use f->[priv->]bb directly, so ap_filter_input_pending() stopped accounting for its pending data. But ap_core_input_filter() can't (and doesn't need to) setaside its socket bucket, so ap_filter_setaside_brigade() is not an option. This commit adds ap_filter_adopt_brigade() which simply moves the given buckets (brigade) into f->priv->bb, and since this is not something to be done blindly (the buckets need to have c->pool/bucket_alloc lifetime, which is the case in the core filter) the function is not AP_DECLAREd/exported thus can be used in core only. With ap_filter_adopt_brigade() and ap_filter_reinstate_brigade(), the core input is now ap_filter_input_pending() friendly. Also, ap_filter_recycle() is no more part of the API (AP_DECLARE removed too), there really is no point to call it outside core code. MAJOR bumped once again because of this. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1840265 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_filter.c')
-rw-r--r--server/util_filter.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/server/util_filter.c b/server/util_filter.c
index 0beb6642de..b8dbfc9c39 100644
--- a/server/util_filter.c
+++ b/server/util_filter.c
@@ -321,7 +321,8 @@ static struct ap_filter_conn_ctx *get_conn_ctx(conn_rec *c)
return x;
}
-static void make_spare_ring(struct spare_ring **ring, apr_pool_t *p)
+static APR_INLINE
+void make_spare_ring(struct spare_ring **ring, apr_pool_t *p)
{
if (!*ring) {
*ring = apr_palloc(p, sizeof(**ring));
@@ -403,7 +404,7 @@ static apr_status_t request_filter_cleanup(void *arg)
return APR_SUCCESS;
}
-AP_DECLARE(void) ap_filter_recycle(conn_rec *c)
+void ap_filter_recycle(conn_rec *c)
{
struct ap_filter_conn_ctx *x = c->filter_conn_ctx;
@@ -983,6 +984,22 @@ AP_DECLARE(apr_status_t) ap_filter_setaside_brigade(ap_filter_t *f,
return APR_SUCCESS;
}
+void ap_filter_adopt_brigade(ap_filter_t *f, apr_bucket_brigade *bb)
+{
+ struct ap_filter_private *fp = f->priv;
+
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, f->c,
+ "adopt %s brigade to %s brigade in '%s' output filter",
+ APR_BRIGADE_EMPTY(bb) ? "empty" : "full",
+ (!fp->bb || APR_BRIGADE_EMPTY(fp->bb)) ? "empty" : "full",
+ f->frec->name);
+
+ if (!APR_BRIGADE_EMPTY(bb)) {
+ ap_filter_prepare_brigade(f);
+ APR_BRIGADE_CONCAT(fp->bb, bb);
+ }
+}
+
AP_DECLARE(apr_status_t) ap_filter_reinstate_brigade(ap_filter_t *f,
apr_bucket_brigade *bb,
apr_bucket **flush_upto)
@@ -1308,6 +1325,7 @@ AP_DECLARE_NONSTD(apr_status_t) ap_fprintf(ap_filter_t *f,
va_end(args);
return rv;
}
+
AP_DECLARE(void) ap_filter_protocol(ap_filter_t *f, unsigned int flags)
{
f->frec->proto_flags = flags ;