]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: do not push until a MAX_PUSH_ID frame is received.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 16 Mar 2021 10:48:29 +0000 (13:48 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 16 Mar 2021 10:48:29 +0000 (13:48 +0300)
Fixes interop with quic-go that doesn't send MAX_PUSH_ID.

src/http/v3/ngx_http_v3_filter_module.c
src/http/v3/ngx_http_v3_streams.c

index 8d601c9782062c2c306e185ba8623e006827be66..30e38fcfbfb68ae2fa978b1aca98303b4c7e7b2e 100644 (file)
@@ -787,7 +787,7 @@ ngx_http_v3_push_resource(ngx_http_request_t *r, ngx_str_t *path,
     h3scf = ngx_http_get_module_srv_conf(r, ngx_http_v3_module);
 
     ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                   "http3 push \"%V\" pushing:%ui/%ui id:%uL/%uL",
+                   "http3 push \"%V\" pushing:%ui/%ui id:%uL/%L",
                    path, h3c->npushing, h3scf->max_concurrent_pushes,
                    h3c->next_push_id, h3c->max_push_id);
 
@@ -797,7 +797,9 @@ ngx_http_v3_push_resource(ngx_http_request_t *r, ngx_str_t *path,
         return NGX_DECLINED;
     }
 
-    if (h3c->next_push_id > h3c->max_push_id) {
+    if (h3c->max_push_id == (uint64_t) -1
+        || h3c->next_push_id > h3c->max_push_id)
+    {
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
                        "http3 abort pushes due to max_push_id");
         return NGX_ABORT;
index 87191406502f8119e6ffa57e741f91fca63fe6c3..c27fa16dc8d6c938b84b5a10e6b88b08a90ae089 100644 (file)
@@ -62,6 +62,7 @@ ngx_http_v3_init_session(ngx_connection_t *c)
 
     h3c->hc = *phc;
     h3c->hc.http3 = 1;
+    h3c->max_push_id = (uint64_t) -1;
 
     ngx_queue_init(&h3c->blocked);
     ngx_queue_init(&h3c->pushing);
@@ -762,7 +763,7 @@ ngx_http_v3_set_max_push_id(ngx_connection_t *c, uint64_t max_push_id)
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "http3 MAX_PUSH_ID:%uL", max_push_id);
 
-    if (max_push_id < h3c->max_push_id) {
+    if (h3c->max_push_id != (uint64_t) -1 && max_push_id < h3c->max_push_id) {
         return NGX_HTTP_V3_ERR_ID_ERROR;
     }