From 145a7929e66d88465ef4e3d80c871995cf259d00 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 4 Oct 2016 09:02:33 +0000 Subject: [PATCH] Merge of r1763246 from trunk: mod_http2: fixing Windows build issues by replacing hook with own implemenation git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1763250 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http2/h2_bucket_beam.c | 37 ++++++++++++++++++++++++++-------- modules/http2/h2_bucket_beam.h | 8 +++++--- modules/http2/h2_conn.c | 4 ++-- modules/http2/h2_filter.c | 2 +- modules/http2/h2_h2.c | 4 ++-- modules/http2/h2_version.h | 4 ++-- 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/modules/http2/h2_bucket_beam.c b/modules/http2/h2_bucket_beam.c index 7860d26170..4397e19c76 100644 --- a/modules/http2/h2_bucket_beam.c +++ b/modules/http2/h2_bucket_beam.c @@ -170,14 +170,35 @@ const apr_bucket_type_t h2_bucket_type_beam = { /******************************************************************************* * h2_blist, a brigade without allocations ******************************************************************************/ + +static apr_array_header_t *beamers; -APR_HOOK_STRUCT( - APR_HOOK_LINK(beam_bucket) -) -AP_IMPLEMENT_HOOK_RUN_FIRST(apr_bucket *, beam_bucket, - (h2_bucket_beam *beam, apr_bucket_brigade *dest, - const apr_bucket *src), - (beam, dest, src), NULL) +void h2_register_bucket_beamer(h2_bucket_beamer *beamer) +{ + if (!beamers) { + 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; +} + apr_size_t h2_util_bl_print(char *buffer, apr_size_t bmax, const char *tag, const char *sep, @@ -860,7 +881,7 @@ transfer: ++transferred; } else { - bgreen = ap_run_beam_bucket(beam, bb, bred); + bgreen = h2_beam_bucket(beam, bb, bred); while (bgreen && bgreen != APR_BRIGADE_SENTINEL(bb)) { ++transferred; remain -= bgreen->length; diff --git a/modules/http2/h2_bucket_beam.h b/modules/http2/h2_bucket_beam.h index db46baacd6..80fa9e127d 100644 --- a/modules/http2/h2_bucket_beam.h +++ b/modules/http2/h2_bucket_beam.h @@ -373,8 +373,10 @@ int h2_beam_was_received(h2_bucket_beam *beam); apr_size_t h2_beam_get_files_beamed(h2_bucket_beam *beam); -AP_DECLARE_HOOK(apr_bucket *, beam_bucket, - (h2_bucket_beam *beam, apr_bucket_brigade *dest, - const apr_bucket *src)) +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_conn.c b/modules/http2/h2_conn.c index c2e8e0ef34..675ddeb266 100644 --- a/modules/http2/h2_conn.c +++ b/modules/http2/h2_conn.c @@ -290,8 +290,8 @@ conn_rec *h2_slave_create(conn_rec *master, apr_uint32_t slave_id, * many streams. */ l = master->id; - if (sizeof(long) >= 8 && l < APR_UINT32_MAX) { - c->id = l|(((unsigned long)slave_id) << 32); + if (sizeof(unsigned long) >= 8 && l < APR_UINT32_MAX) { + c->id = l|((unsigned long)slave_id << 32); } else { c->id = l^(~slave_id); diff --git a/modules/http2/h2_filter.c b/modules/http2/h2_filter.c index 6d9cee16f5..a4ef20d7e9 100644 --- a/modules/http2/h2_filter.c +++ b/modules/http2/h2_filter.c @@ -238,7 +238,7 @@ apr_status_t h2_bucket_observer_fire(apr_bucket *b, h2_bucket_event event) } const apr_bucket_type_t h2_bucket_type_observer = { - "H2LAZY", 5, APR_BUCKET_METADATA, + "H2OBS", 5, APR_BUCKET_METADATA, bucket_destroy, bucket_read, apr_bucket_setaside_noop, diff --git a/modules/http2/h2_h2.c b/modules/http2/h2_h2.c index 80e1afadfb..39707de4b5 100644 --- a/modules/http2/h2_h2.c +++ b/modules/http2/h2_h2.c @@ -574,8 +574,8 @@ void h2_h2_register_hooks(void) ap_hook_fixups(h2_h2_late_fixups, NULL, NULL, APR_HOOK_LAST); /* special bucket type transfer through a h2_bucket_beam */ - ap_hook_beam_bucket(h2_bucket_observer_beam, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_beam_bucket(h2_bucket_headers_beam, NULL, NULL, APR_HOOK_MIDDLE); + h2_register_bucket_beamer(h2_bucket_headers_beam); + h2_register_bucket_beamer(h2_bucket_observer_beam); } int h2_h2_process_conn(conn_rec* c) diff --git a/modules/http2/h2_version.h b/modules/http2/h2_version.h index 37d8e27a79..3a10748427 100644 --- a/modules/http2/h2_version.h +++ b/modules/http2/h2_version.h @@ -26,7 +26,7 @@ * @macro * Version number of the http2 module as c string */ -#define MOD_HTTP2_VERSION "1.7.0-DEV" +#define MOD_HTTP2_VERSION "1.7.1" /** * @macro @@ -34,7 +34,7 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define MOD_HTTP2_VERSION_NUM 0x010700 +#define MOD_HTTP2_VERSION_NUM 0x010701 #endif /* mod_h2_h2_version_h */ -- 2.49.0