diff options
author | Stefan Eissing <icing@apache.org> | 2022-03-21 10:02:51 +0100 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2022-03-21 10:02:51 +0100 |
commit | 2039323af35fe544f3f36bbc4b45a42a5f28da4c (patch) | |
tree | 9633d5ee9b22ef8c435b5d42a61bacfa5b1eb0af | |
parent | *) mod_http2: use pollset only for main connection and wakeups (diff) | |
download | apache2-2039323af35fe544f3f36bbc4b45a42a5f28da4c.tar.xz apache2-2039323af35fe544f3f36bbc4b45a42a5f28da4c.zip |
*) mod_http2: remove internal bucket beamer registry and just
copy well-known meta buckets in a beam. Was too generic.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899105 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/http2/h2_bucket_beam.c | 53 | ||||
-rw-r--r-- | modules/http2/h2_bucket_beam.h | 6 | ||||
-rw-r--r-- | modules/http2/h2_c1.c | 3 | ||||
-rw-r--r-- | modules/http2/h2_headers.c | 17 | ||||
-rw-r--r-- | modules/http2/h2_headers.h | 6 |
5 files changed, 13 insertions, 72 deletions
diff --git a/modules/http2/h2_bucket_beam.c b/modules/http2/h2_bucket_beam.c index 9deb971e76..60e48c0f3b 100644 --- a/modules/http2/h2_bucket_beam.c +++ b/modules/http2/h2_bucket_beam.c @@ -28,6 +28,7 @@ #include "h2_private.h" #include "h2_conn_ctx.h" +#include "h2_headers.h" #include "h2_util.h" #include "h2_bucket_beam.h" @@ -53,44 +54,6 @@ } while (0) -/* registry for bucket converting `h2_bucket_beamer` functions */ -static apr_array_header_t *beamers; - -static apr_status_t cleanup_beamers(void *dummy) -{ - (void)dummy; - beamers = NULL; - return APR_SUCCESS; -} - -void h2_register_bucket_beamer(h2_bucket_beamer *beamer) -{ - if (!beamers) { - apr_pool_cleanup_register(apr_hook_global_pool, NULL, - cleanup_beamers, apr_pool_cleanup_null); - beamers = apr_array_make(apr_hook_global_pool, 10, - sizeof(h2_bucket_beamer*)); - } - APR_ARRAY_PUSH(beamers, h2_bucket_beamer*) = beamer; -} - -static apr_bucket *h2_beam_bucket(h2_bucket_beam *beam, - apr_bucket_brigade *dest, - const apr_bucket *src) -{ - apr_bucket *b = NULL; - int i; - if (beamers) { - for (i = 0; i < beamers->nelts && b == NULL; ++i) { - h2_bucket_beamer *beamer; - - beamer = APR_ARRAY_IDX(beamers, i, h2_bucket_beamer*); - b = beamer(beam, dest, src); - } - } - return b; -} - static int is_empty(h2_bucket_beam *beam); static apr_off_t get_buffered_data_len(h2_bucket_beam *beam); @@ -665,22 +628,14 @@ transfer: else if (APR_BUCKET_IS_FLUSH(bsender)) { brecv = apr_bucket_flush_create(bb->bucket_alloc); } + else if (H2_BUCKET_IS_HEADERS(bsender)) { + brecv = h2_bucket_headers_clone(bsender, bb->p, bb->bucket_alloc); + } else if (AP_BUCKET_IS_ERROR(bsender)) { ap_bucket_error *eb = (ap_bucket_error *)bsender; brecv = ap_bucket_error_create(eb->status, eb->data, bb->p, bb->bucket_alloc); } - else { - /* Does someone else know how to make a proxy for - * the bucket? Ask the callbacks registered for this. */ - brecv = h2_beam_bucket(beam, bb, bsender); - while (brecv && brecv != APR_BRIGADE_SENTINEL(bb)) { - ++transferred; - remain -= brecv->length; - brecv = APR_BUCKET_NEXT(brecv); - } - brecv = NULL; - } } else if (bsender->length == 0) { /* nop */ diff --git a/modules/http2/h2_bucket_beam.h b/modules/http2/h2_bucket_beam.h index ea9f58100d..0e5111aab8 100644 --- a/modules/http2/h2_bucket_beam.h +++ b/modules/http2/h2_bucket_beam.h @@ -234,10 +234,4 @@ apr_off_t h2_beam_get_buffered(h2_bucket_beam *beam); */ apr_off_t h2_beam_get_mem_used(h2_bucket_beam *beam); -typedef apr_bucket *h2_bucket_beamer(h2_bucket_beam *beam, - apr_bucket_brigade *dest, - const apr_bucket *src); - -void h2_register_bucket_beamer(h2_bucket_beamer *beamer); - #endif /* h2_bucket_beam_h */ diff --git a/modules/http2/h2_c1.c b/modules/http2/h2_c1.c index 5be7e907e4..6388985aa1 100644 --- a/modules/http2/h2_c1.c +++ b/modules/http2/h2_c1.c @@ -327,8 +327,5 @@ void h2_c1_register_hooks(void) /* One last chance to properly say goodbye if we have not done so * already. */ ap_hook_pre_close_connection(h2_c1_hook_pre_close, NULL, mod_ssl, APR_HOOK_LAST); - - /* special bucket type transfer through a h2_bucket_beam */ - h2_register_bucket_beamer(h2_bucket_headers_beam); } diff --git a/modules/http2/h2_headers.c b/modules/http2/h2_headers.c index 3aab859c7b..fbeeba3901 100644 --- a/modules/http2/h2_headers.c +++ b/modules/http2/h2_headers.c @@ -98,18 +98,13 @@ const apr_bucket_type_t h2_bucket_type_headers = { apr_bucket_shared_copy }; -apr_bucket *h2_bucket_headers_beam(struct h2_bucket_beam *beam, - apr_bucket_brigade *dest, - const apr_bucket *src) +apr_bucket *h2_bucket_headers_clone(apr_bucket *src, apr_pool_t *p, apr_bucket_alloc_t *list) { - if (H2_BUCKET_IS_HEADERS(src)) { - h2_headers *src_headers = ((h2_bucket_headers *)src->data)->headers; - apr_bucket *b = h2_bucket_headers_create(dest->bucket_alloc, - h2_headers_clone(dest->p, src_headers)); - APR_BRIGADE_INSERT_TAIL(dest, b); - return b; - } - return NULL; + h2_headers *src_headers; + + AP_DEBUG_ASSERT(H2_BUCKET_IS_HEADERS(src)); + src_headers = ((h2_bucket_headers *)src->data)->headers; + return h2_bucket_headers_create(list, h2_headers_clone(p, src_headers)); } diff --git a/modules/http2/h2_headers.h b/modules/http2/h2_headers.h index dfe1429e18..61ba17848d 100644 --- a/modules/http2/h2_headers.h +++ b/modules/http2/h2_headers.h @@ -32,9 +32,9 @@ apr_bucket * h2_bucket_headers_create(apr_bucket_alloc_t *list, h2_headers *h2_bucket_headers_get(apr_bucket *b); -apr_bucket *h2_bucket_headers_beam(struct h2_bucket_beam *beam, - apr_bucket_brigade *dest, - const apr_bucket *src); +apr_bucket *h2_bucket_headers_clone(apr_bucket *src, + apr_pool_t *p, + apr_bucket_alloc_t *list); /** * Create the headers from the given status and headers |