From: Stefan Eissing
Date: Mon, 7 Dec 2015 15:34:24 +0000 (+0000)
Subject: merged H2PushPriority befiore 'weight' loss from trunk
X-Git-Tag: 2.4.18~11
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e21273b5726176fa3eba33301a56108694060e0;p=apache
merged H2PushPriority befiore 'weight' loss from trunk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1718406 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/docs/manual/mod/mod_http2.xml b/docs/manual/mod/mod_http2.xml
index f4a17dc03e..1648eb73ef 100644
--- a/docs/manual/mod/mod_http2.xml
+++ b/docs/manual/mod/mod_http2.xml
@@ -267,15 +267,15 @@
Before Priority Rule
- H2PushPriority application/json Before 256
+ H2PushPriority application/json Before
This says that any pushed stream of content type 'application/json'
should be send out before X. This makes P1 dependent
on Y and X dependent on P1. So, X will be stalled as long as
- P1 has data to send. The effective weight is calculated as
- in the interleaved case.
+ P1 has data to send. The effective weight is inherited from the
+ client stream. Specifying a weight is not allowed.
Be aware that the effect of priority specifications is limited
@@ -291,13 +291,13 @@
'*' is the only special content-type that matches all others.
'image/*' will not work.
The default dependency is 'After'.
- There are also default weights: for 'After' it is 16, otherwise 256.
+ There are also default weights: for 'After' it is 16, 'interleaved' is 256.
Shorter Priority Rules
H2PushPriority application/json 32 # an After rule
-H2PushPriority image/jpeg before # weight 256 default
+H2PushPriority image/jpeg before # weight inherited
H2PushPriority text/css interleaved # weight 256 default
diff --git a/modules/http2/h2_config.c b/modules/http2/h2_config.c
index 11f9b0a609..0471424705 100644
--- a/modules/http2/h2_config.c
+++ b/modules/http2/h2_config.c
@@ -429,7 +429,9 @@ static const char *h2_conf_add_push_priority(cmd_parms *cmd, void *_cfg,
}
else if (!strcasecmp("BEFORE", sdependency)) {
dependency = H2_DEPENDANT_BEFORE;
- sdefweight = "256"; /* default BEFORE weight */
+ if (sweight) {
+ return "dependecy 'Before' does not allow a weight";
+ }
}
else if (!strcasecmp("INTERLEAVED", sdependency)) {
dependency = H2_DEPENDANT_INTERLEAVED;
diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c
index f91fb7aabe..4e3bb8f38b 100644
--- a/modules/http2/h2_session.c
+++ b/modules/http2/h2_session.c
@@ -1396,11 +1396,12 @@ apr_status_t h2_session_set_prio(h2_session *session, h2_stream *stream,
/* PUSHed stream os to be sent BEFORE the initiating stream.
* It gets the same weight as the initiating stream, replaces
* that stream in the dependency tree and has the initiating
- * stream as child with MAX_WEIGHT.
+ * stream as child.
*/
ptype = "BEFORE";
- w_parent = nghttp2_stream_get_weight(s_parent);
+ w = w_parent = nghttp2_stream_get_weight(s_parent);
nghttp2_priority_spec_init(&ps, stream->id, w_parent, 0);
+ id_grandpa = nghttp2_stream_get_stream_id(s_grandpa);
rv = nghttp2_session_change_stream_priority(session->ngh2, id_parent, &ps);
if (rv < 0) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c,
@@ -1409,8 +1410,6 @@ apr_status_t h2_session_set_prio(h2_session *session, h2_stream *stream,
session->id, id_parent, ps.weight, ps.stream_id, rv);
return APR_EGENERAL;
}
- id_grandpa = nghttp2_stream_get_stream_id(s_grandpa);
- w = valid_weight(w_parent * ((float)prio->weight / NGHTTP2_MAX_WEIGHT));
nghttp2_priority_spec_init(&ps, id_grandpa, w, 0);
break;