comparison src/http/v2/ngx_http_v2.c @ 6375:e30c72b0dfda

HTTP/2: fixed request length accounting. Now it includes not only the received body size, but the size of headers block as well.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 02 Feb 2016 16:33:55 +0300
parents f598de1bfcd4
children 0e0e2e522fa2
comparison
equal deleted inserted replaced
6374:f598de1bfcd4 6375:e30c72b0dfda
1183 stream = ngx_http_v2_create_stream(h2c); 1183 stream = ngx_http_v2_create_stream(h2c);
1184 if (stream == NULL) { 1184 if (stream == NULL) {
1185 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); 1185 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR);
1186 } 1186 }
1187 1187
1188 stream->request->request_length = h2c->state.length;
1189
1188 stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG; 1190 stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG;
1189 stream->node = node; 1191 stream->node = node;
1190 1192
1191 node->stream = stream; 1193 node->stream = stream;
1192 1194
1749 "client sent inappropriate frame while CONTINUATION was expected"); 1751 "client sent inappropriate frame while CONTINUATION was expected");
1750 1752
1751 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); 1753 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR);
1752 } 1754 }
1753 1755
1754 h2c->state.length += ngx_http_v2_parse_length(head);
1755 h2c->state.flags |= p[4]; 1756 h2c->state.flags |= p[4];
1756 1757
1757 if (h2c->state.sid != ngx_http_v2_parse_sid(&p[5])) { 1758 if (h2c->state.sid != ngx_http_v2_parse_sid(&p[5])) {
1758 ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, 1759 ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
1759 "client sent CONTINUATION frame with incorrect identifier"); 1760 "client sent CONTINUATION frame with incorrect identifier");
1763 1764
1764 p = pos; 1765 p = pos;
1765 pos += NGX_HTTP_V2_FRAME_HEADER_SIZE; 1766 pos += NGX_HTTP_V2_FRAME_HEADER_SIZE;
1766 1767
1767 ngx_memcpy(pos, p, len); 1768 ngx_memcpy(pos, p, len);
1769
1770 len = ngx_http_v2_parse_length(head);
1771
1772 h2c->state.length += len;
1773
1774 if (h2c->state.stream) {
1775 h2c->state.stream->request->request_length += len;
1776 }
1768 1777
1769 h2c->state.handler = handler; 1778 h2c->state.handler = handler;
1770 return pos; 1779 return pos;
1771 } 1780 }
1772 1781