summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request_body.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-04-01 15:56:03 +0300
committerValentin Bartenev <vbart@nginx.com>2016-04-01 15:56:03 +0300
commit948eeca222c67dc6954ec0e68bf5c18e97e1a784 (patch)
treeb9442b62cff536807a10b6b9adce34c261b229dc /src/http/ngx_http_request_body.c
parentcedba685a1eb18ca960b2eab3fafdc2afdbd624a (diff)
downloadnginx-948eeca222c67dc6954ec0e68bf5c18e97e1a784.tar.gz
nginx-948eeca222c67dc6954ec0e68bf5c18e97e1a784.tar.bz2
HTTP/2: rewritten handling of request body.
There are two improvements: 1. Support for request body filters; 2. Receiving of request body is started only after the ngx_http_read_client_request_body() call. The last one fixes the problem when the client_max_body_size value might not be respected from the right location if the location was changed either during the process of receiving body or after the whole body had been received.
Diffstat (limited to 'src/http/ngx_http_request_body.c')
-rw-r--r--src/http/ngx_http_request_body.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index b5803d57b..55e7d0802 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -40,20 +40,20 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
r->main->count++;
+ if (r != r->main || r->request_body || r->discard_body) {
+ r->request_body_no_buffering = 0;
+ post_handler(r);
+ return NGX_OK;
+ }
+
#if (NGX_HTTP_V2)
- if (r->stream && r == r->main) {
+ if (r->stream) {
r->request_body_no_buffering = 0;
rc = ngx_http_v2_read_request_body(r, post_handler);
goto done;
}
#endif
- if (r != r->main || r->request_body || r->discard_body) {
- r->request_body_no_buffering = 0;
- post_handler(r);
- return NGX_OK;
- }
-
if (ngx_http_test_expect(r) != NGX_OK) {
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
goto done;
@@ -503,16 +503,16 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
ngx_int_t rc;
ngx_event_t *rev;
-#if (NGX_HTTP_V2)
- if (r->stream && r == r->main) {
- r->stream->skip_data = NGX_HTTP_V2_DATA_DISCARD;
+ if (r != r->main || r->discard_body || r->request_body) {
return NGX_OK;
}
-#endif
- if (r != r->main || r->discard_body || r->request_body) {
+#if (NGX_HTTP_V2)
+ if (r->stream) {
+ r->stream->skip_data = 1;
return NGX_OK;
}
+#endif
if (ngx_http_test_expect(r) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;