]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: don't send SETTINGS ACK before already queued DATA frames.
authorPiotr Sikora <piotrsikora@google.com>
Fri, 2 Jun 2017 12:05:32 +0000 (15:05 +0300)
committerPiotr Sikora <piotrsikora@google.com>
Fri, 2 Jun 2017 12:05:32 +0000 (15:05 +0300)
Previously, SETTINGS ACK was sent immediately upon receipt of SETTINGS
frame, before already queued DATA frames created using old SETTINGS.

This incorrect behavior was source of interoperability issues, because
peers rely on the fact that new SETTINGS are in effect after receiving
SETTINGS ACK.

Reported by Feng Li.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
src/http/v2/ngx_http_v2.c
src/http/v2/ngx_http_v2.h

index d4ee8cc24faeb1ae325c1f2a2633a4bc08959665..8e1b7aed4b75deb6ddf8d1d108e48c5c962eda52 100644 (file)
@@ -2032,7 +2032,7 @@ ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos,
         return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR);
     }
 
-    ngx_http_v2_queue_blocked_frame(h2c, frame);
+    ngx_http_v2_queue_ordered_frame(h2c, frame);
 
     if (window_delta) {
         if (ngx_http_v2_adjust_windows(h2c, window_delta) != NGX_OK) {
index be34a09335cd75fecf6006bcc5b3efc4185f4c04..4804658eb41a25f219c4864b1a0616a4605d6ba9 100644 (file)
@@ -261,6 +261,15 @@ ngx_http_v2_queue_blocked_frame(ngx_http_v2_connection_t *h2c,
 }
 
 
+static ngx_inline void
+ngx_http_v2_queue_ordered_frame(ngx_http_v2_connection_t *h2c,
+    ngx_http_v2_out_frame_t *frame)
+{
+    frame->next = h2c->last_out;
+    h2c->last_out = frame;
+}
+
+
 void ngx_http_v2_init(ngx_event_t *rev);
 void ngx_http_v2_request_headers_init(void);