You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2016/10/04 08:55:08 UTC
svn commit: r1763246 - in /httpd/httpd/trunk/modules/http2: h2_bucket_beam.c
h2_bucket_beam.h h2_conn.c h2_filter.c h2_h2.c
Author: icing
Date: Tue Oct 4 08:55:08 2016
New Revision: 1763246
URL: http://svn.apache.org/viewvc?rev=1763246&view=rev
Log:
mod_http2: replacing module internal hook with own impl as the former does not compile on Windows
Modified:
httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
httpd/httpd/trunk/modules/http2/h2_bucket_beam.h
httpd/httpd/trunk/modules/http2/h2_conn.c
httpd/httpd/trunk/modules/http2/h2_filter.c
httpd/httpd/trunk/modules/http2/h2_h2.c
Modified: httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_bucket_beam.c?rev=1763246&r1=1763245&r2=1763246&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_bucket_beam.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_bucket_beam.c Tue Oct 4 08:55:08 2016
@@ -170,14 +170,35 @@ const apr_bucket_type_t h2_bucket_type_b
/*******************************************************************************
* 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;
Modified: httpd/httpd/trunk/modules/http2/h2_bucket_beam.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_bucket_beam.h?rev=1763246&r1=1763245&r2=1763246&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_bucket_beam.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_bucket_beam.h Tue Oct 4 08:55:08 2016
@@ -373,8 +373,10 @@ int h2_beam_was_received(h2_bucket_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 */
Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1763246&r1=1763245&r2=1763246&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Tue Oct 4 08:55:08 2016
@@ -290,8 +290,8 @@ conn_rec *h2_slave_create(conn_rec *mast
* 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);
Modified: httpd/httpd/trunk/modules/http2/h2_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_filter.c?rev=1763246&r1=1763245&r2=1763246&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_filter.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_filter.c Tue Oct 4 08:55:08 2016
@@ -238,7 +238,7 @@ apr_status_t h2_bucket_observer_fire(apr
}
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,
Modified: httpd/httpd/trunk/modules/http2/h2_h2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_h2.c?rev=1763246&r1=1763245&r2=1763246&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_h2.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_h2.c Tue Oct 4 08:55:08 2016
@@ -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)