Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2_filter_module.c @ 7100:12cadc4669a7
HTTP/2: signal 0-byte HPACK's dynamic table size.
This change lets NGINX talk to clients with SETTINGS_HEADER_TABLE_SIZE
smaller than the default 4KB. Previously, NGINX would ACK the SETTINGS
frame with a small dynamic table size, but it would never send dynamic
table size update, leading to a connection-level COMPRESSION_ERROR.
Also, it allows clients to release 4KB of memory per connection, since
NGINX doesn't use HPACK's dynamic table when encoding headers, however
clients had to maintain it, since NGINX never signaled that it doesn't
use it.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
author | Piotr Sikora <piotrsikora@google.com> |
---|---|
date | Wed, 30 Aug 2017 14:52:11 -0700 |
parents | 4e784e095a97 |
children | 2bf605c6edf7 |
comparison
equal
deleted
inserted
replaced
7099:019b91bd21cc | 7100:12cadc4669a7 |
---|---|
137 ngx_list_part_t *part; | 137 ngx_list_part_t *part; |
138 ngx_table_elt_t *header; | 138 ngx_table_elt_t *header; |
139 ngx_connection_t *fc; | 139 ngx_connection_t *fc; |
140 ngx_http_cleanup_t *cln; | 140 ngx_http_cleanup_t *cln; |
141 ngx_http_v2_out_frame_t *frame; | 141 ngx_http_v2_out_frame_t *frame; |
142 ngx_http_v2_connection_t *h2c; | |
142 ngx_http_core_loc_conf_t *clcf; | 143 ngx_http_core_loc_conf_t *clcf; |
143 ngx_http_core_srv_conf_t *cscf; | 144 ngx_http_core_srv_conf_t *cscf; |
144 u_char addr[NGX_SOCKADDR_STRLEN]; | 145 u_char addr[NGX_SOCKADDR_STRLEN]; |
145 | 146 |
146 static const u_char nginx[5] = "\x84\xaa\x63\x55\xe7"; | 147 static const u_char nginx[5] = "\x84\xaa\x63\x55\xe7"; |
233 default: | 234 default: |
234 status = 0; | 235 status = 0; |
235 } | 236 } |
236 } | 237 } |
237 | 238 |
238 len = status ? 1 : 1 + ngx_http_v2_literal_size("418"); | 239 h2c = r->stream->connection; |
240 | |
241 len = h2c->table_update ? 1 : 0; | |
242 | |
243 len += status ? 1 : 1 + ngx_http_v2_literal_size("418"); | |
239 | 244 |
240 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 245 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
241 | 246 |
242 if (r->headers_out.server == NULL) { | 247 if (r->headers_out.server == NULL) { |
243 | 248 |
420 if (pos == NULL || tmp == NULL) { | 425 if (pos == NULL || tmp == NULL) { |
421 return NGX_ERROR; | 426 return NGX_ERROR; |
422 } | 427 } |
423 | 428 |
424 start = pos; | 429 start = pos; |
430 | |
431 if (h2c->table_update) { | |
432 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0, | |
433 "http2 table size update: 0"); | |
434 *pos++ = (1 << 5) | 0; | |
435 h2c->table_update = 0; | |
436 } | |
425 | 437 |
426 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0, | 438 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0, |
427 "http2 output header: \":status: %03ui\"", | 439 "http2 output header: \":status: %03ui\"", |
428 r->headers_out.status); | 440 r->headers_out.status); |
429 | 441 |