[nginx] HTTP/2: don't send SETTINGS ACK before already queued DATA frames.

Valentin Bartenev vbart at nginx.com
Fri Jun 2 12:08:34 UTC 2017


details:   http://hg.nginx.org/nginx/rev/7206c3630310
branches:  
changeset: 7025:7206c3630310
user:      Piotr Sikora <piotrsikora at google.com>
date:      Fri Jun 02 15:05:32 2017 +0300
description:
HTTP/2: don't send SETTINGS ACK before already queued DATA frames.

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 at google.com>

diffstat:

 src/http/v2/ngx_http_v2.c |  2 +-
 src/http/v2/ngx_http_v2.h |  9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r 79de0d2aa432 -r 7206c3630310 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c	Fri Jun 02 15:05:28 2017 +0300
+++ b/src/http/v2/ngx_http_v2.c	Fri Jun 02 15:05:32 2017 +0300
@@ -2032,7 +2032,7 @@ ngx_http_v2_state_settings_params(ngx_ht
         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) {
diff -r 79de0d2aa432 -r 7206c3630310 src/http/v2/ngx_http_v2.h
--- a/src/http/v2/ngx_http_v2.h	Fri Jun 02 15:05:28 2017 +0300
+++ b/src/http/v2/ngx_http_v2.h	Fri Jun 02 15:05:32 2017 +0300
@@ -261,6 +261,15 @@ ngx_http_v2_queue_blocked_frame(ngx_http
 }
 
 
+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);
 


More information about the nginx-devel mailing list