summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request_body.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-03-03Request body: avoid potential overflow.Maxim Dounin1-4/+4
2014-01-04Fixed "zero size buf in output" alerts.Maxim Dounin1-21/+37
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.
2013-11-11SPDY: fixed request hang with the auth request module.Valentin Bartenev1-1/+1
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.
2013-09-04Win32: Borland C compatibility fixes.Maxim Dounin1-4/+4
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.
2013-05-13Fixed lingering_time check.Maxim Dounin1-2/+2
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.
2013-05-11Request body: fixed r->count increment on allocation failure.Maxim Dounin1-1/+2
2013-04-16Request body: only read body in main request (ticket #330).Maxim Dounin1-1/+1
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.
2013-03-20Preliminary experimental support for SPDY draft 2.Valentin Bartenev1-0/+14
2013-03-14Request body: avoid linking rb->buf to r->header_in.Maxim Dounin1-1/+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.
2013-03-14Request body: next upstream fix.Maxim Dounin1-2/+2
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.
2013-02-01Request body: fixed client_body_in_file_only.Maxim Dounin1-1/+17
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).
2012-11-26Request body: block write events while reading body.Maxim Dounin1-0/+2
If write events are not blocked, an extra write event might happen for various reasons (e.g. as a result of a http pipelining), resulting in incorrect body being passed to a post handler. The problem manifested itself with the dav module only, as this is the only module which reads the body from a content phase handler (in contrast to exclusive content handlers like proxy). Additionally, dav module used to dump core in such situations due to ticket #238. See reports here: http://mailman.nginx.org/pipermail/nginx-devel/2012-November/002981.html http://serverfault.com/questions/449195/nginx-webdav-server-with-auth-request
2012-11-26Request body: error checking fixes, negative rb->rest handling.Maxim Dounin1-2/+11
Negative rb->rest can't happen with current code, but it's good to have it handled anyway. Found by Coverity (CID 744846, 744847, 744848).
2012-11-26Request body: improved handling of incorrect chunked request body.Maxim Dounin1-4/+15
While discarding chunked request body in some cases after detecting request body corruption no error was returned, while it was possible to correctly return 400 Bad Request. If error is detected too late, make sure to properly close connection. Additionally, in ngx_http_special_response_handler() don't return body of 500 Internal Server Error to a client if ngx_http_discard_request_body() fails, but disable keepalive and continue.
2012-11-26Request body: fixed discard of chunked request body.Maxim Dounin1-1/+1
Even if there is no preread data, make sure to always call ngx_http_discard_request_body_filter() in case of chunked request body to initialize r->headers_in.content_length_n for later use.
2012-11-21Request body: unbreak build without debug.Maxim Dounin1-0/+2
2012-11-21Request body: chunked transfer encoding support.Maxim Dounin1-160/+522
2012-11-21Request body: properly handle events while discarding body.Maxim Dounin1-7/+9
An attempt to call ngx_handle_read_event() before actually reading data from a socket might result in read event being disabled, which is wrong. Catched by body.t test on Solaris.
2012-11-21Request body: fixed socket leak on errors.Maxim Dounin1-10/+28
The r->main->count reference counter was always incremented in ngx_http_read_client_request_body(), while it is only needs to be incremented on positive returns.
2012-11-21Request body: code duplication reduced, no functional changes.Maxim Dounin1-25/+14
The r->request_body_in_file_only with empty body case is now handled in ngx_http_write_request_body().
2012-04-12Fixed grammar in error messages.Ruslan Ermilov1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2011-09-05Bugfix: read event was not blocked after reading body.Maxim Dounin1-0/+2
Read event should be blocked after reading body, else undefined behaviour might occur on additional client activity. This fixes segmentation faults observed with proxy_ignore_client_abort set.
2011-08-18Fix body with request_body_in_single_buf.Maxim Dounin1-1/+3
If there were preread data and request body was big enough first part of the request body was duplicated. See report here: http://mailman.nginx.org/pipermail/nginx/2011-July/027756.html
2011-08-18Correctly set body if it's preread and there are extra data.Maxim Dounin1-0/+1
Previously all available data was used as body, resulting in garbage after real body e.g. in case of pipelined requests. Make sure to use only as many bytes as request's Content-Length specifies.
2009-10-19restore discard body handler after ngx_http_set_writer() set it toIgor Sysoev1-4/+3
ngx_http_test_reading(), the bug was introduced in r3050
2009-10-19fix ngx_http_finalize_request() code after a body has been discardedIgor Sysoev1-9/+4
2009-10-19prevent handling discarded body as a pipelined requestIgor Sysoev1-0/+1
2009-10-02clear r->lingering_close to disable preventively callingIgor Sysoev1-1/+6
ngx_http_set_lingering_close() while request cleanup
2009-10-02update r3167: do not set r->discard_body if the body has been just discardedIgor Sysoev1-2/+1
2009-09-26fix r3078: do not increase request counter if body has been just discardedIgor Sysoev1-2/+3
2009-09-25fix discarding bodyIgor Sysoev1-5/+6
2009-09-01fix request counter handling while discarding body, introduced in r3050Igor Sysoev1-0/+1
2009-08-26request reference counterIgor Sysoev1-0/+2
2008-12-26send "100 Continue" just before reading request bodyIgor Sysoev1-0/+51
2008-12-09use "!= NGX_OK" instead of "== NGX_ERROR"Igor Sysoev1-3/+3
2008-09-05remove unused #include'sIgor Sysoev1-1/+0
2007-11-1564-bit time_t compatibilityIgor Sysoev1-1/+1
2007-10-18do not discard body if it has been already readIgor Sysoev1-1/+1
2007-09-01fix unlikely socket leakIgor Sysoev1-0/+1
2007-09-01fix socket leak introduced in r1374 when request header and body wasIgor Sysoev1-2/+2
in one packet and connection went to keep-alive state
2007-08-27cancel discarding body on EOFIgor Sysoev1-0/+4
2007-08-07discard request body before going to keep-alive state and use lingering timeoutsIgor Sysoev1-17/+59
2007-08-06rename ngx_http_discard_body() to ngx_http_discard_request_body()Igor Sysoev1-8/+8
2007-08-06block reading for level eventsIgor Sysoev1-0/+1
2007-08-06discard request body in cycleIgor Sysoev1-19/+22
2007-07-11style fixIgor Sysoev1-0/+1
2007-02-15fix formatIgor Sysoev1-1/+1
2007-01-25undo "client_body_in_file_only any"Igor Sysoev1-41/+7
and introduce "client_body_in_file_only clean" introduce ngx_pool_delete_file() to not break a possible third-party ngx_pool_cleanup_file() usage that may lead to an removal of the useful files delete unnecessary ngx_http_finalize_request_body()
2007-01-23delete temporary file for incomplete small request bodyIgor Sysoev1-2/+17