aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request_body.c
Commit message (Collapse)AuthorAge
* Proxy: proxy_pass_trailers directive.Sergey Kandaurov2024-09-13
| | | | The directive allows to pass upstream response trailers to client.
* QUIC: modified HTTP version test.Roman Arutyunyan2022-01-12
| | | | | The new condition produces smaller diff to the default branch and is similar to HTTP/2 case.
* Merged with the default branch.Sergey Kandaurov2021-11-03
|\
| * Request body: do not create temp file if there's nothing to write.Roman Arutyunyan2021-09-10
| | | | | | | | | | | | | | | | | | Do this only when the entire request body is empty and r->request_body_in_file_only is set. The issue manifested itself with missing warning "a client request body is buffered to a temporary file" when the entire rb->buf is full and all buffers are delayed by a filter.
* | Merged with the default branch.Sergey Kandaurov2021-09-01
|\|
| * Request body: reading body buffering in filters.Maxim Dounin2021-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | If a filter wants to buffer the request body during reading (for example, to check an external scanner), it can now do so. To make it possible, the code now checks rb->last_saved (introduced in the previous change) along with rb->rest == 0. Since in HTTP/2 this requires flow control to avoid overflowing the request body buffer, so filters which need buffering have to set the rb->filter_need_buffering flag on the first filter call. (Note that each filter is expected to call the next filter, so all filters will be able set the flag if needed.)
| * Request body: introduced rb->last_saved flag.Maxim Dounin2021-08-29
| | | | | | | | | | | | It indicates that the last buffer was received by the save filter, and can be used to check this at higher levels. To be used in the following changes.
| * Request body: added alert to catch duplicate body saving.Maxim Dounin2021-08-29
| | | | | | | | | | | | If due to an error ngx_http_request_body_save_filter() is called more than once with rb->rest == 0, this used to result in a segmentation fault. Added an alert to catch such errors, just in case.
| * Request body: missing comments about initialization.Maxim Dounin2021-08-29
| |
* | HTTP/3: refactored request body parser.Roman Arutyunyan2021-01-25
| | | | | | | | | | | | | | | | The change reduces diff to the default branch for src/http/ngx_http_request_body.c. Also, client Content-Length, if present, is now checked against the real body size sent by client.
* | Merged with the default branch.Sergey Kandaurov2020-11-24
|\|
| * Request body: removed error assumption (ticket #2058).Maxim Dounin2020-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | Before introduction of request body filter in 42d9beeb22db, the only possible return code from the ngx_http_request_body_filter() call without actual buffers was NGX_HTTP_INTERNAL_SERVER_ERROR, and the code in ngx_http_read_client_request_body() hardcoded the only possible error to simplify the code of initial call to set rb->rest. This is no longer true after introduction of request body filters though, as a request body filter might need to return other errors, such as 403. Fix is to preserve the error code actually returned by the call instead of assuming 500.
| * Request body: improved logging.Maxim Dounin2020-11-09
| | | | | | | | | | | | | | Added logging before returning NGX_HTTP_INTERNAL_SERVER_ERROR if there are busy buffers after a request body flush. This should never happen with current code, though bugs can be introduced by 3rd party modules. Make sure debugging will be easy enough.
| * SSL: fixed non-working SSL shutdown on lingering close.Ruslan Ermilov2020-11-06
| | | | | | | | | | | | | | | | When doing lingering close, the socket was first shut down for writing, so SSL shutdown initiated after lingering close was not able to send the close_notify alerts (ticket #2056). The fix is to call ngx_ssl_shutdown() before shutting down the socket.
* | QUIC: renamed c->qs to c->quic.Roman Arutyunyan2020-11-10
| |
* | HTTP/3: removed HTTP/3 parser call from discard body filter.Roman Arutyunyan2020-09-16
| | | | | | | | Request body discard is disabled for QUIC streams anyway.
* | HTTP/3: fixed handling request body eof.Roman Arutyunyan2020-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While for HTTP/1 unexpected eof always means an error, for HTTP/3 an eof right after a DATA frame end means the end of the request body. For this reason, since adding HTTP/3 support, eof no longer produced an error right after recv() but was passed to filters which would make a decision. This decision was made in ngx_http_parse_chunked() and ngx_http_v3_parse_request_body() based on the b->last_buf flag. Now that since 0f7f1a509113 (1.19.2) rb->chunked->length is a lower threshold for the expected number of bytes, it can be set to zero to indicate that more bytes may or may not follow. Now it's possible to move the check for eof from parser functions to ngx_http_request_body_chunked_filter() and clean up the parsing code. Also, in the default branch, in case of eof, the following three things happened, which were replaced with returning NGX_ERROR while implementing HTTP/3: - "client prematurely closed connection" message was logged - c->error flag was set - NGX_HTTP_BAD_REQUEST was returned The change brings back this behavior for HTTP/1 as well as HTTP/3.
* | HTTP/3: drop the unwanted remainder of the request.Roman Arutyunyan2020-08-25
| | | | | | | | | | | | | | | | As per HTTP/3 draft 29, section 4.1: When the server does not need to receive the remainder of the request, it MAY abort reading the request stream, send a complete response, and cleanly close the sending part of the stream.
* | HTTP/3: request more client body bytes.Roman Arutyunyan2020-08-18
| | | | | | | | | | | | | | | | | | Previously the request body DATA frame header was read by one byte because filters were called only when the requested number of bytes were read. Now, after 08ff2e10ae92 (1.19.2), filters are called after each read. More bytes can be read at once, which simplifies and optimizes the code. This also reduces diff with the default branch.
* | Merged with the default branch.Roman Arutyunyan2020-08-18
|\|
| * Request body: optimized handling of small chunks.Maxim Dounin2020-08-06
| | | | | | | | | | If there is a previous buffer, copy small chunks into it instead of allocating additional buffer.
| * Request body: allowed large reads on chunk boundaries.Maxim Dounin2020-08-06
| | | | | | | | | | | | If some additional data from a pipelined request happens to be read into the body buffer, we copy it to r->header_in or allocate an additional large client header buffer for it.
| * Request body: all read data are now sent to filters.Maxim Dounin2020-08-06
| | | | | | | | | | This is a prerequisite for the next change to allow large reads on chunk boundaries.
* | HTTP/3: move body parser call out of ngx_http_parse_chunked().Roman Arutyunyan2020-05-14
| | | | | | | | | | The function ngx_http_parse_chunked() is also called from the proxy module to parse the upstream response. It should always parse HTTP/1 body in this case.
* | Parsing HTTP/3 request body.Roman Arutyunyan2020-03-27
|/
* HTTP/2: reduced difference to HTTP/1.x in reading request body.Valentin Bartenev2017-04-24
| | | | | | | Particularly, this eliminates difference in behavior for requests without body and deduplicates code. Prodded by Piotr Sikora.
* Request body: commented out debug printing of old buffers.Maxim Dounin2017-02-08
| | | | | This is not really needed in practice, and causes excessive debug output in some of our tests.
* Request body: c->error on "100 Continue" errors (ticket #1194).Maxim Dounin2017-02-08
|
* HTTP/2: support for unbuffered upload of request body.Valentin Bartenev2016-04-01
|
* HTTP/2: rewritten handling of request body.Valentin Bartenev2016-04-01
| | | | | | | | | | | | | 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.
* Request body: moved handling of the last part in the save filter.Valentin Bartenev2016-03-01
| | | | No functional changes.
* Request body: removed surplus assigment, no functional changes.Valentin Bartenev2016-01-12
| | | | | Setting rb->bufs to NULL is surplus after ngx_http_write_request_body() has returned NGX_OK.
* The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev2015-09-11
| | | | The SPDY support is removed, as it's incompatible with the new module.
* Request body: always flush buffers if request buffering is off.Valentin Bartenev2015-04-06
| | | | | | This fixes unbuffered proxying to SSL backends, since it prevents ngx_ssl_send_chain() from accumulation of request body in the SSL buffer.
* Request body: unbuffered reading.Maxim Dounin2015-03-23
| | | | | | | | | | | The r->request_body_no_buffering flag was introduced. It instructs client request body reading code to avoid reading the whole body, and to call post_handler early instead. The caller should use the ngx_http_read_unbuffered_request_body() function to read remaining parts of the body. Upstream module is now able to use this mode, if configured with the proxy_request_buffering directive.
* Request body: filters support.Maxim Dounin2015-03-23
|
* Request body: moved request body writing to save filter.Maxim Dounin2015-03-23
|
* Request body: free chain links in ngx_http_write_request_body().Maxim Dounin2015-03-23
|
* Format specifier fixed for file size of buffers.Maxim Dounin2015-03-23
|
* Request body: avoid potential overflow.Maxim Dounin2014-03-03
|
* Fixed "zero size buf in output" alerts.Maxim Dounin2014-01-04
| | | | | | | | | | If a request had an empty request body (with Content-Length: 0), and there were preread data available (e.g., due to a pipelined request in the buffer), the "zero size buf in output" alert might be logged while proxying the request to an upstream. Similar alerts appeared with client_body_in_file_only if a request had an empty request body.
* SPDY: fixed request hang with the auth request module.Valentin Bartenev2013-11-11
| | | | | | We should just call post_handler() when subrequest wants to read body, like it happens for HTTP since rev. f458156fd46a. An attempt to init request body for subrequests results in hang if the body was not already read.
* Win32: Borland C compatibility fixes.Maxim Dounin2013-09-04
| | | | | | | | | | Several false positive warnings silenced, notably W8012 "Comparing signed and unsigned" (due to u_short values promoted to int), and W8072 "Suspicious pointer arithmetic" (due to large type values added to pointers). With this patch, it's now again possible to compile nginx using bcc32, with options we normally compile on win32 minus ipv6 and ssl.
* Fixed lingering_time check.Maxim Dounin2013-05-13
| | | | | | | | | | | | | There are two significant changes in this patch: 1) The <= 0 comparison is done with a signed type. This fixes the case of ngx_time() being larger than r->lingering_time. 2) Calculation of r->lingering_time - ngx_time() is now always done in the ngx_msec_t type. This ensures the calculation is correct even if time_t is unsigned and differs in size from ngx_msec_t. Thanks to Lanshun Zhou.
* Request body: fixed r->count increment on allocation failure.Maxim Dounin2013-05-11
|
* Request body: only read body in main request (ticket #330).Maxim Dounin2013-04-16
| | | | | | | | | | Before 1.3.9 an attempt to read body in a subrequest only caused problems if body wasn't already read or discarded in a main request. Starting with 1.3.9 it might also cause problems if body was discarded by a main request before subrequest start. Fix is to just ignore attempts to read request body in a subrequest, which looks like right thing to do anyway.
* Preliminary experimental support for SPDY draft 2.Valentin Bartenev2013-03-20
|
* Request body: avoid linking rb->buf to r->header_in.Maxim Dounin2013-03-14
| | | | | | | | Code to reuse of r->request_body->buf in upstream module assumes it's dedicated buffer, hence after 1.3.9 (r4931) it might reuse r->header_in if client_body_in_file_only was set, resulting in original request corruption. It is considered to be safer to always create a dedicated buffer for rb->bufs to avoid such problems.
* Request body: next upstream fix.Maxim Dounin2013-03-14
| | | | | | | | | | | | | | After introduction of chunked request body handling in 1.3.9 (r4931), r->request_body->bufs buffers have b->start pointing to original buffer start (and b->pos pointing to real data of this particular buffer). While this is ok as per se, it caused bad things (usually original request headers included before the request body) after reinit of the request chain in ngx_http_upstream_reinit() while sending the request to a next upstream server (which used to do b->pos = b->start for each buffer in the request chain). Patch by Piotr Sikora.
* Request body: fixed client_body_in_file_only.Maxim Dounin2013-02-01
| | | | | | | | After introduction of chunked request body reading support in 1.3.9 (r4931), the rb->bufs wasn't set if request body was fully preread while calling the ngx_http_read_client_request_body() function. Reported by Yichun Zhang (agentzh).