diff options
| author | Valentin Bartenev <vbart@nginx.com> | 2017-04-24 14:17:13 +0300 |
|---|---|---|
| committer | Valentin Bartenev <vbart@nginx.com> | 2017-04-24 14:17:13 +0300 |
| commit | 55b37eff8f700ea1dd279368d5a4a7b00f3c1344 (patch) | |
| tree | 652b05a1c5092b7817fe206db3d7cb7b1bf00559 /src/http/ngx_http_request_body.c | |
| parent | d35c83a3250bedaa85971ddf2cfcd9b703a256ea (diff) | |
| download | nginx-55b37eff8f700ea1dd279368d5a4a7b00f3c1344.tar.gz nginx-55b37eff8f700ea1dd279368d5a4a7b00f3c1344.tar.bz2 | |
HTTP/2: reduced difference to HTTP/1.x in reading request body.
Particularly, this eliminates difference in behavior for requests without body
and deduplicates code.
Prodded by Piotr Sikora.
Diffstat (limited to 'src/http/ngx_http_request_body.c')
| -rw-r--r-- | src/http/ngx_http_request_body.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c index 2f664848d..c4f092e59 100644 --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -46,13 +46,6 @@ ngx_http_read_client_request_body(ngx_http_request_t *r, return NGX_OK; } -#if (NGX_HTTP_V2) - if (r->stream) { - rc = ngx_http_v2_read_request_body(r, post_handler); - goto done; - } -#endif - if (ngx_http_test_expect(r) != NGX_OK) { rc = NGX_HTTP_INTERNAL_SERVER_ERROR; goto done; @@ -85,6 +78,13 @@ ngx_http_read_client_request_body(ngx_http_request_t *r, return NGX_OK; } +#if (NGX_HTTP_V2) + if (r->stream) { + rc = ngx_http_v2_read_request_body(r); + goto done; + } +#endif + preread = r->header_in->last - r->header_in->pos; if (preread) { @@ -805,7 +805,11 @@ ngx_http_test_expect(ngx_http_request_t *r) if (r->expect_tested || r->headers_in.expect == NULL - || r->http_version < NGX_HTTP_VERSION_11) + || r->http_version < NGX_HTTP_VERSION_11 +#if (NGX_HTTP_V2) + || r->stream != NULL +#endif + ) { return NGX_OK; } |
