comparison src/http/v2/ngx_http_v2.c @ 7568:2e61e4b6bcd9

HTTP/2: switched back to RST_STREAM with NO_ERROR. In 8df664ebe037, we've switched to maximizing stream window instead of sending RST_STREAM. Since then handling of RST_STREAM with NO_ERROR was fixed at least in Chrome, hence we switch back to using RST_STREAM. This allows more effective rejecting of large bodies, and also minimizes non-payload traffic to be accounted in the next patch.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 18 Sep 2019 20:28:09 +0300
parents fd6dcc6f8a49
children 80359395b345
comparison
equal deleted inserted replaced
7567:ef7ee19776db 7568:2e61e4b6bcd9
4282 { 4282 {
4283 h2c->connection->error = 1; 4283 h2c->connection->error = 1;
4284 } 4284 }
4285 4285
4286 } else if (!stream->in_closed) { 4286 } else if (!stream->in_closed) {
4287 #if 0
4288 if (ngx_http_v2_send_rst_stream(h2c, node->id, NGX_HTTP_V2_NO_ERROR) 4287 if (ngx_http_v2_send_rst_stream(h2c, node->id, NGX_HTTP_V2_NO_ERROR)
4289 != NGX_OK) 4288 != NGX_OK)
4290 { 4289 {
4291 h2c->connection->error = 1; 4290 h2c->connection->error = 1;
4292 } 4291 }
4293 #else
4294 /*
4295 * At the time of writing at least the latest versions of Chrome
4296 * do not properly handle RST_STREAM with NO_ERROR status.
4297 *
4298 * See: https://bugs.chromium.org/p/chromium/issues/detail?id=603182
4299 *
4300 * As a workaround, the stream window is maximized before closing
4301 * the stream. This allows a client to send up to 2 GB of data
4302 * before getting blocked on flow control.
4303 */
4304
4305 if (stream->recv_window < NGX_HTTP_V2_MAX_WINDOW
4306 && ngx_http_v2_send_window_update(h2c, node->id,
4307 NGX_HTTP_V2_MAX_WINDOW
4308 - stream->recv_window)
4309 != NGX_OK)
4310 {
4311 h2c->connection->error = 1;
4312 }
4313 #endif
4314 } 4292 }
4315 } 4293 }
4316 4294
4317 if (h2c->state.stream == stream) { 4295 if (h2c->state.stream == stream) {
4318 h2c->state.stream = NULL; 4296 h2c->state.stream = NULL;