comparison src/http/v3/ngx_http_v3.h @ 8015:0596fe1aee16 quic

HTTP/3: server pushes. New directives are added: - http3_max_concurrent_pushes - http3_push - http3_push_preload
author Roman Arutyunyan <arut@nginx.com>
date Thu, 23 Jul 2020 13:41:24 +0300
parents 79125ef2e39f
children e0947c952d43
comparison
equal deleted inserted replaced
8014:c5324bb3a704 8015:0596fe1aee16
48 #define NGX_HTTP_V3_MAX_KNOWN_STREAM 6 48 #define NGX_HTTP_V3_MAX_KNOWN_STREAM 6
49 49
50 #define NGX_HTTP_V3_DEFAULT_MAX_FIELD_SIZE 4096 50 #define NGX_HTTP_V3_DEFAULT_MAX_FIELD_SIZE 4096
51 #define NGX_HTTP_V3_DEFAULT_MAX_TABLE_CAPACITY 16384 51 #define NGX_HTTP_V3_DEFAULT_MAX_TABLE_CAPACITY 16384
52 #define NGX_HTTP_V3_DEFAULT_MAX_BLOCKED_STREAMS 16 52 #define NGX_HTTP_V3_DEFAULT_MAX_BLOCKED_STREAMS 16
53 #define NGX_HTTP_V3_DEFAULT_MAX_CONCURRENT_PUSHES 10
53 54
54 /* HTTP/3 errors */ 55 /* HTTP/3 errors */
55 #define NGX_HTTP_V3_ERR_NO_ERROR 0x100 56 #define NGX_HTTP_V3_ERR_NO_ERROR 0x100
56 #define NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR 0x101 57 #define NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR 0x101
57 #define NGX_HTTP_V3_ERR_INTERNAL_ERROR 0x102 58 #define NGX_HTTP_V3_ERR_INTERNAL_ERROR 0x102
87 typedef struct { 88 typedef struct {
88 ngx_quic_tp_t quic; 89 ngx_quic_tp_t quic;
89 size_t max_field_size; 90 size_t max_field_size;
90 size_t max_table_capacity; 91 size_t max_table_capacity;
91 ngx_uint_t max_blocked_streams; 92 ngx_uint_t max_blocked_streams;
93 ngx_uint_t max_concurrent_pushes;
92 } ngx_http_v3_srv_conf_t; 94 } ngx_http_v3_srv_conf_t;
95
96
97 typedef struct {
98 ngx_flag_t push_preload;
99 ngx_flag_t push;
100 ngx_array_t *pushes;
101 } ngx_http_v3_loc_conf_t;
93 102
94 103
95 typedef struct { 104 typedef struct {
96 ngx_str_t name; 105 ngx_str_t name;
97 ngx_str_t value; 106 ngx_str_t value;
108 117
109 118
110 typedef struct { 119 typedef struct {
111 ngx_http_connection_t hc; 120 ngx_http_connection_t hc;
112 ngx_http_v3_dynamic_table_t table; 121 ngx_http_v3_dynamic_table_t table;
122
113 ngx_queue_t blocked; 123 ngx_queue_t blocked;
114 ngx_uint_t nblocked; 124 ngx_uint_t nblocked;
125
126 ngx_queue_t pushing;
127 ngx_uint_t npushing;
128 uint64_t next_push_id;
129 uint64_t max_push_id;
130
115 ngx_uint_t settings_sent; 131 ngx_uint_t settings_sent;
116 /* unsigned settings_sent:1; */ 132 /* unsigned settings_sent:1; */
117 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM]; 133 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM];
118 } ngx_http_v3_connection_t; 134 } ngx_http_v3_connection_t;
119 135
142 ngx_str_t *value); 158 ngx_str_t *value);
143 uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index); 159 uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index);
144 uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index, 160 uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index,
145 u_char *data, size_t len); 161 u_char *data, size_t len);
146 162
163 ngx_connection_t *ngx_http_v3_create_push_stream(ngx_connection_t *c,
164 uint64_t push_id);
147 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, 165 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
148 ngx_uint_t index, ngx_str_t *value); 166 ngx_uint_t index, ngx_str_t *value);
149 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, 167 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name,
150 ngx_str_t *value); 168 ngx_str_t *value);
151 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity); 169 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity);
161 ngx_uint_t *insert_count); 179 ngx_uint_t *insert_count);
162 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c, 180 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c,
163 ngx_uint_t insert_count); 181 ngx_uint_t insert_count);
164 ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id, 182 ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id,
165 uint64_t value); 183 uint64_t value);
184 ngx_int_t ngx_http_v3_set_max_push_id(ngx_connection_t *c,
185 uint64_t max_push_id);
186 ngx_int_t ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id);
166 187
167 ngx_int_t ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, 188 ngx_int_t ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
168 ngx_uint_t index, ngx_str_t *value); 189 ngx_uint_t index, ngx_str_t *value);
169 ngx_int_t ngx_http_v3_client_insert(ngx_connection_t *c, ngx_str_t *name, 190 ngx_int_t ngx_http_v3_client_insert(ngx_connection_t *c, ngx_str_t *name,
170 ngx_str_t *value); 191 ngx_str_t *value);