summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2013-07-30nginx-1.5.3-RELEASErelease-1.5.3Maxim Dounin1-0/+75
2013-07-29Perl: fixed syntax usage for C preprocessor directives.Sergey Kandaurov1-7/+4
As per perlxs, C preprocessor directives should be at the first non-whitespace of a line to avoid interpreting them as comments. #if and #endif are moved so that there are no blank lines before them to retain them as part of the function body.
2013-07-29Upstream: reliably detect connection failures with SSL peers.Ruslan Ermilov1-0/+5
2013-07-25Upstream: no last buffer on errors.Maxim Dounin1-2/+10
Previously, after sending a header we always sent a last buffer and finalized a request with code 0, even in case of errors. In some cases this resulted in a loss of ability to detect the response wasn't complete (e.g. if Content-Length was removed from a response by gzip filter). This change tries to propogate to a client information that a response isn't complete in such cases. In particular, with this change we no longer pretend a returned response is complete if we wasn't able to create a temporary file. If an error code suggests the error wasn't fatal, we flush buffered data and disable keepalive, then finalize request normally. This allows to to propogate information about a problem to a client, while still sending all the data we've got from an upstream.
2013-07-25Upstream: request finalization rework.Maxim Dounin1-14/+17
No semantic changes expected, though some checks are done differently. In particular, the r->cached flag is no longer explicitly checked. Instead, we relay on u->header_sent not being set if a response is sent from a cache.
2013-07-25Upstream: NGX_HTTP_CLIENT_CLOSED_REQUEST no longer reset to 0.Maxim Dounin1-0/+1
The NGX_HTTP_CLIENT_CLOSED_REQUEST code is allowed to happen after we started sending a response (much like NGX_HTTP_REQUEST_TIME_OUT), so there is no need to reset response code to 0 in this case.
2013-07-25Upstream: added check if a response is complete.Maxim Dounin2-4/+31
Checks were added to both buffered and unbuffered code paths to detect and complain if a response is incomplete. Appropriate error codes are now passed to ngx_http_upstream_finalize_request(). With this change in unbuffered mode we now use u->length set to -1 as an indicator that EOF is allowed per protocol and used to indicate response end (much like its with p->length in buffered mode). Proxy module was changed to set u->length to 1 (instead of previously used -1) in case of chunked transfer encoding used to comply with the above.
2013-07-25Upstream: u->length now defaults to -1 (API change).Maxim Dounin2-2/+5
That is, by default we assume that response end is signalled by a connection close. This seems to be better default, and in line with u->pipe->length behaviour. Memcached module was modified accordingly.
2013-07-25Upstream: fixed store/cache of unfinished responses.Maxim Dounin1-3/+5
In case of upstream eof, only responses with u->pipe->length == -1 are now cached/stored. This ensures that unfinished chunked responses are not cached. Note well - previously used checks for u->headers_in.content_length_n are preserved. This provides an additional level of protection if protol data disagree with Content-Length header provided (e.g., a FastCGI response is sent with wrong Content-Length, or an incomple SCGI or uwsgi response), as well as protects from storing of responses to HEAD requests. This should be reconsidered if we'll consider caching of responses to HEAD requests.
2013-07-25Upstream: replaced u->pipe->temp_file with p->temp_file.Maxim Dounin1-5/+5
While here, redundant parentheses removed. No functional changes.
2013-07-25Upstream: NGX_ERROR after pipe errors.Maxim Dounin1-4/+4
2013-07-25Upstream: NGX_HTTP_GATEWAY_TIME_OUT after upstream timeouts.Maxim Dounin1-3/+3
There is no real difference from previously used 0 as NGX_HTTP_* will become 0 in ngx_http_upstream_finalize_request(), but the change preserves information about a timeout a bit longer. Previous use of ETIMEDOUT in one place was just wrong. Note well that with cacheable responses there will be a difference (code in ngx_http_upstream_finalize_request() will store the error in cache), though this change doesn't touch cacheable case.
2013-07-25Upstream: ngx_http_upstream_finalize_request(NGX_ERROR) on errors.Maxim Dounin1-25/+25
Previously, ngx_http_upstream_finalize_request(0) was used in most cases after errors. While with current code there is no difference, use of NGX_ERROR allows to pass a bit more information into ngx_http_upstream_finalize_request().
2013-07-25Upstream: consistent error handling after u->input_filter_init().Maxim Dounin1-2/+1
In all cases ngx_http_upstream_finalize_request() with NGX_ERROR now used. Previously used NGX_HTTP_INTERNAL_SERVER_ERROR in the subrequest in memory case don't cause any harm, but inconsistent with other uses.
2013-07-25Upstream: busy lock remnants removed.Maxim Dounin1-14/+0
2013-06-13Upstream: stale comments removed.Maxim Dounin1-12/+0
2013-07-25Gzip: clearing of c->buffered if all data are flushed.Maxim Dounin1-2/+4
This allows to finalize unfinished responses while still sending as much data as available.
2013-07-25Event pipe: fixed writing cache header to a temp file.Maxim Dounin1-7/+4
With previous code the p->temp_file->offset wasn't adjusted if a temp file was written by the code in ngx_event_pipe_write_to_downstream() after an EOF, resulting in cache not being used with empty scgi and uwsgi responses with Content-Length set to 0. Fix it to call ngx_event_pipe_write_chain_to_temp_file() there instead of calling ngx_write_chain_to_temp_file() directly.
2013-06-14Fixed ngx_http_test_reading() to finalize request properly.Maxim Dounin1-1/+1
Previous code called ngx_http_finalize_request() with rc = 0. This is ok if a response status was already set, but resulted in "000" being logged if it wasn't. In particular this happened with limit_req if a connection was prematurely closed during limit_req delay.
2013-07-25Sub filter: fixed matching after a partial match.Maxim Dounin1-31/+69
After a failed partial match we now check if there is another partial match in previously matched substring to fix cases like "aab" in "aaab". The ctx->saved string is now always sent if it's present on return from the ngx_http_sub_parse() function (and reset accordingly). This allows to release parts of previously matched data.
2013-07-25Sub filter: fixed incomplete last buffer on partial match.Maxim Dounin1-0/+20
If a pattern was partially matched at a response end, partially matched string wasn't send. E.g., a response "fo" was truncated to an empty response if partially mathed by a pattern "foo".
2013-07-25Sub filter: flush buffers handling.Maxim Dounin1-1/+4
2013-07-25Sub filter: switched to ngx_chain_get_free_buf().Maxim Dounin1-62/+23
No functional changes.
2013-07-25Sub filter: stale comments removed.Maxim Dounin1-3/+0
2013-07-25On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in msecs.Ruslan Ermilov2-4/+21
Based on a patch by Sepherosa Ziehau.
2013-07-25Style: reuse one int variable in ngx_configure_listening_sockets().Ruslan Ermilov1-11/+8
No functional changes.
2013-07-24SPDY: fixed segfault with "client_body_in_file_only" enabled.Valentin Bartenev1-9/+2
It is possible to send FLAG_FIN in additional empty data frame, even if it is known from the content-length header that request body is empty. And Firefox actually behaves like this (see ticket #357). To simplify code we sacrificed our microoptimization that did not work right due to missing check in the ngx_http_spdy_state_data() function for rb->buf set to NULL.
2013-07-19Xslt: exsltRegisterAll() moved to preconfiguration.Maxim Dounin1-2/+10
The exsltRegisterAll() needs to be called before XSLT stylesheets are compiled, else stylesheet compilation hooks will not work. This change fixes EXSLT Functions extension.
2013-07-13Events: honor NGX_USE_GREEDY_EVENT when kqueue support is enabled.Valentin Bartenev2-2/+4
Currently this flag is needed for epoll and rtsig, and though these methods usually present on different platforms than kqueue, nginx can be compiled to support all of them.
2013-07-11Style.Maxim Dounin3-3/+3
2013-07-11Configure: perl Makefile rebuild after configure.Maxim Dounin1-0/+1
The $NGX_AUTO_CONFIG_H added to perl module Makefile dependencies to make sure it's always rebuild after a configure. It is needed as we expand various variables used for Makefile generation during configure (in particular, nginx version).
2013-07-11Core: fixed possible use of an uninitialized variable.Vladimir Homutov1-0/+2
The call to ngx_sock_ntop() in ngx_connection_local_sockaddr() might be performed with the uninitialized "len" variable. The fix is to initialize variable to the size of corresponding socket address type. The issue was introduced in commit 05ba5bce31e0.
2013-07-11Core: extended ngx_sock_ntop() with socklen parameter.Vladimir Homutov10-19/+39
On Linux, sockaddr length is required to process unix socket addresses properly due to unnamed sockets (which don't have sun_path set at all) and abstract namespace sockets.
2013-07-05Make macros safe.Gleb Smirnoff3-10/+10
2013-07-03Upstream: updated list of ngx_event_connect_peer() return values.Ruslan Ermilov1-1/+1
ngx_http_upstream_get_keepalive_peer() may return NGX_DONE to indicate that the cached keepalive connection is reused.
2013-06-28Core: consolidated log-related code.Vladimir Homutov4-30/+51
The stderr redirection code is moved to ngx_log_redirect_stderr(). The opening of the default log code is moved to ngx_log_open_default().
2013-07-02Version bump.Maxim Dounin1-2/+2
2013-07-02release-1.5.2 tagMaxim Dounin1-0/+1
2013-07-02nginx-1.5.2-RELEASErelease-1.5.2Maxim Dounin1-0/+49
2013-06-28Fixed ngx_http_parse_chunked() minimal length calculation.Maxim Dounin1-2/+3
Minimal data length we expect for further calls was calculated incorrectly if parsing stopped right after parsing chunk size. This might in theory affect clients and/or backends using LF instead of CRLF. Patch by Dmitry Popov.
2013-06-26Fixed build on Linux with x32 ABI.Maxim Dounin1-2/+7
On Linux x32 inclusion of sys/sysctl.h produces an error. As sysctl() is only used by rtsig event method code, which is legacy and not compiled in by default on modern linuxes, the sys/sysctl.h file now only included if rtsig support is enabled. Based on patch by Serguei I. Ivantsov.
2013-06-20Core: support several "error_log" directives.Vladimir Homutov5-67/+106
When several "error_log" directives are specified in the same configuration block, logs are written to all files with a matching log level. All logs are stored in the singly-linked list that is sorted by log level in the descending order. Specific debug levels (NGX_LOG_DEBUG_HTTP,EVENT, etc.) are not supported if several "error_log" directives are specified. In this case all logs will use debug level that has largest absolute value.
2013-06-19Simplified ngx_list_create().Ruslan Ermilov1-9/+1
2013-06-12Valgrind: another complaint about uninitialized bytes.Tatsuhiko Kubo1-0/+2
2013-06-13SPDY: fixed code style, no functional changes.Valentin Bartenev1-1/+2
2013-06-13Core: moved initialization of log level.Vladimir Homutov2-3/+2
The cycle->new_log->log_level should only be initialized by ngx_init_cycle() if no error logs were found in the configuration. This move allows to get rid of extra initialization in ngx_error_log().
2013-06-07SPDY: pass through the full status when available.Jim Radford1-3/+12
Avoid stripping the status text when proxying for compatibility with http.
2013-06-10Perl: fixed r->header_in("Cookie") (ticket #351).Maxim Dounin1-9/+27
It was broken by X-Forwarded-For related changes in f7fe817c92a2 (1.3.14) as hh->offset is no longer 0 for Cookie.
2013-06-05Fixed debug logging in ngx_http_parse_complex_uri().Maxim Dounin1-2/+2
The *u previously logged isn't yet initialized at this point, and Valgrind complains.
2013-06-05Mail: fixed possible uninitialized memory access.Maxim Dounin1-0/+4
Found by Valgrind.