diff src/http/v2/ngx_http_v2.h @ 7201:641306096f5b

HTTP/2: server push. Resources to be pushed are configured with the "http2_push" directive. Also, preload links from the Link response headers, as described in https://www.w3.org/TR/preload/#server-push-http-2, can be pushed, if enabled with the "http2_push_preload" directive. Only relative URIs with absolute paths can be pushed. The number of concurrent pushes is normally limited by a client, but cannot exceed a hard limit set by the "http2_max_concurrent_pushes" directive.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 08 Feb 2018 09:55:03 +0300
parents ca8f8a443c11
children 3d2b0b02bd3d
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.h
+++ b/src/http/v2/ngx_http_v2.h
@@ -24,6 +24,8 @@
 #define NGX_HTTP_V2_MAX_FIELD                                                 \
     (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1)
 
+#define NGX_HTTP_V2_STREAM_ID_SIZE       4
+
 #define NGX_HTTP_V2_FRAME_HEADER_SIZE    9
 
 /* frame types */
@@ -118,6 +120,9 @@ struct ngx_http_v2_connection_s {
 
     ngx_uint_t                       processing;
 
+    ngx_uint_t                       pushing;
+    ngx_uint_t                       concurrent_pushes;
+
     size_t                           send_window;
     size_t                           recv_window;
     size_t                           init_window;
@@ -143,12 +148,14 @@ struct ngx_http_v2_connection_s {
     ngx_queue_t                      closed;
 
     ngx_uint_t                       last_sid;
+    ngx_uint_t                       last_push;
 
     unsigned                         closed_nodes:8;
     unsigned                         settings_ack:1;
     unsigned                         table_update:1;
     unsigned                         blocked:1;
     unsigned                         goaway:1;
+    unsigned                         push_disabled:1;
 };
 
 
@@ -276,6 +283,10 @@ void ngx_http_v2_init(ngx_event_t *rev);
 ngx_int_t ngx_http_v2_read_request_body(ngx_http_request_t *r);
 ngx_int_t ngx_http_v2_read_unbuffered_request_body(ngx_http_request_t *r);
 
+ngx_int_t ngx_http_v2_push_stream(ngx_http_v2_connection_t *h2c,
+    ngx_uint_t depend, size_t request_length, ngx_str_t *path,
+    ngx_str_t *authority);
+
 void ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc);
 
 ngx_int_t ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c);