Klaus Demo nginx / 9cb22ef
HTTP/2: discard remaining request body after redirect. Previously, if unbuffered request body reading wasn't finished before the request was redirected to a different location using error_page or X-Accel-Redirect, and the request body is read again, this could lead to disastrous effects, such as a duplicate post_handler call or "http request count is zero" alert followed by a segmentation fault. This happened in the following configuration (ticket #1819): location / { proxy_request_buffering off; proxy_pass http://bad; proxy_intercept_errors on; error_page 502 = /error; } location /error { proxy_pass http://backend; } Sergey Kandaurov 30 days ago
1 changed file(s) with 9 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
946946 return ngx_http_v2_state_skip_padded(h2c, pos, end);
947947 }
948948
949 r = stream->request;
950
951 if (r->reading_body && !r->request_body_no_buffering) {
952 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
953 "skipping http2 DATA frame");
954
955 return ngx_http_v2_state_skip_padded(h2c, pos, end);
956 }
957
949958 size = end - pos;
950959
951960 if (size >= h2c->state.length) {
952961 size = h2c->state.length;
953962 stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG;
954963 }
955
956 r = stream->request;
957964
958965 if (r->request_body) {
959966 rc = ngx_http_v2_process_request_body(r, pos, size, stream->in_closed);