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 a fact that "new" SETTINGS are in effect after receiving
SETTINGS ACK.

Change-Id: If74c677658b1cf41d63d91ffb51b030a118fe793
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/2924
Reviewed-by: Feng Li <fengli@google.com>
Reviewed-by: Lizan Zhou <zlizan@google.com>
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index f8ccb2d..e1b864e 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -2002,7 +2002,7 @@
         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);
 
     return ngx_http_v2_state_settings_params(h2c, pos, end);
 }
diff --git a/src/http/v2/ngx_http_v2.h b/src/http/v2/ngx_http_v2.h
index 7d2a2ea..c13ce53 100644
--- a/src/http/v2/ngx_http_v2.h
+++ b/src/http/v2/ngx_http_v2.h
@@ -261,6 +261,15 @@
 }
 
 
+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);