summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-08-23Cache: lock timeouts are now logged at info level.Maxim Dounin1-2/+1
2013-08-23Upstream: posted requests handling after ssl handshake errors.Maxim Dounin1-0/+6
Missing call to ngx_http_run_posted_request() resulted in a main request hang if subrequest's ssl handshake with an upstream server failed for some reason. Reported by Aviram Cohen.
2013-08-23Fixed try_files with empty argument (ticket #390).Maxim Dounin1-1/+3
2013-07-30Added safety belt for the case of sending header twice.Sergey Kandaurov1-0/+6
The aforementioned situation is abnormal per se and as such it now forces request termination with appropriate error message.
2013-07-30Autoindex: improved ngx_de_info() error handling.Sergey Kandaurov3-2/+3
This allows to build a directory listing whenever a loop exists in symbolic link resolution of the path argument.
2013-07-30Autoindex: return NGX_ERROR on error if headers were sent.Sergey Kandaurov1-2/+2
This prevents ngx_http_finalize_request() from issuing ngx_http_special_response_handler() on a freed context.
2013-08-20Style improved after 12dd27b74117.Maxim Dounin2-12/+10
2013-08-20Backed out f1a91825730a and 7094bd12c1ff.Maxim Dounin13-45/+34
While ngx_get_full_name() might have a bit more descriptive arguments, the ngx_conf_full_name() is generally easier to use when parsing configuration and limits exposure of cycle->prefix / cycle->conf_prefix details.
2013-08-21Auth request module import.Maxim Dounin1-0/+444
2013-08-21Minor ngx_http_parse_request_line() optimization.Maxim Dounin1-0/+3
Noted by Nils Kuhnhenn.
2013-08-20Format specifier fixes in error logging.Sergey Kandaurov5-6/+6
2013-08-15SPDY: alert about activated fake events instead of deleting them.Valentin Bartenev1-2/+4
They refer to the same socket descriptor as our real connection, and deleting them will stop processing of the connection. Events of fake connections must not be activated, and if it happened there is nothing we can do. The whole processing should be terminated as soon as possible, but it is not obvious how to do this safely.
2013-08-15SPDY: do not reject headers with empty value (ticket #396).Valentin Bartenev1-4/+0
A quote from SPDY draft 2 specification: "The length of each name and value must be greater than zero. A receiver of a zero-length name or value must send a RST_STREAM with code PROTOCOL error." But it appears that Chrome browser allows sending requests over SPDY/2 connection using JavaScript that contain headers with empty values. For better compatibility across SPDY clients and to be compliant with HTTP, such headers are no longer rejected. Also, it is worth noting that in SPDY draft 3 the statement has been changed so that it permits empty values for headers.
2013-08-15SPDY: fixed corruption of headers with names longer than 255.Valentin Bartenev1-2/+16
It is a bad idea to put zero byte in position where the length of the next header name can be stored before it was parsed.
2013-08-15Unbreak building on Linux without sendfile64() support.Valentin Bartenev1-3/+3
It was broken in 8e446a2daf48 when the NGX_SENDFILE_LIMIT constant was added to ngx_linux_sendfile_chain.c having the same name as already defined one in ngx_linux_config.h. The newer is needed to overcome a bug in old Linux kernels by limiting the number of bytes to send per sendfile() syscall. The older is used with sendfile() on ancient kernels that works with 32-bit offsets only. One of these renamed to NGX_SENDFILE_MAXSIZE.
2013-08-13Referer module: fixed regex matching against HTTPS referers.Sergey Kandaurov1-1/+3
When matching a compiled regex against value in the "Referer" header field, the length was calculated incorrectly for strings that start from "https://". This might cause matching to fail for regexes with end-of-line anchors. Patch by Liangbin Li.
2013-08-08Don't lose pointer to first nonempty buf in ngx_*_sendfile_chain().Gleb Smirnoff4-66/+58
In ngx_*_sendfile_chain() when calculating pointer to a first non-zero sized buf, use "in" as iterator. This fixes processing of zero sized buf(s) after EINTR. Otherwise function can return zero sized buf to caller, and later ngx_http_write_filter() logs warning.
2013-08-06API change: removed the ngx_conf_full_name() function.Valentin Bartenev2-12/+0
The ngx_get_full_name() should be used instead.
2013-08-06Replaced ngx_conf_full_name() with ngx_get_full_name().Valentin Bartenev12-22/+45
The ngx_get_full_name() function takes more readable arguments list.
2013-08-06Fixed memory leaks in the root and auth_basic_user_file directives.Valentin Bartenev6-94/+112
If a relative path is set by variables, then the ngx_conf_full_name() function was called while processing requests, which causes allocations from the cycle pool. A new function that takes pool as an argument was introduced.
2013-08-05Image filter: use "application/json" MIME type for JSON output.Valentin Bartenev1-1/+1
As it is defined by RFC 4627, and allows for various browser tools like JSONView to display JSON well-formatted.
2013-08-05Core: guard use of AI_ADDRCONFIG.Ruslan Ermilov1-0/+2
Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support. Reported by Piotr Sikora.
2013-08-05Fixed build with signed socklen_t and unix sockets.Maxim Dounin1-1/+1
This seems to be the case at least under Cygwin, where build was broken by 05ba5bce31e0 (1.5.3). Reported by Kevin Worthington, http://mailman.nginx.org/pipermail/nginx/2013-August/040028.html.
2013-08-05Core: only resolve address families configured on the local system.Ruslan Ermilov1-0/+1
This is done by passing AI_ADDRCONFIG to getaddrinfo(). On Linux, setting net.ipv6.conf.all.disable_ipv6 to 1 will now be respected. On FreeBSD, AI_ADDRCONFIG filtering is currently implemented by attempting to create a datagram socket for the corresponding family, which succeeds even if the system doesn't in fact have any addresses of that family configured. That is, if the system with IPv6 support in the kernel doesn't have IPv6 addresses configured, AI_ADDRCONFIG will filter out IPv6 only inside a jail without IPv6 addresses or with IPv6 disabled.
2013-07-31MIME: use "application/javascript" for .js files.Valentin Bartenev1-1/+1
Though there are several MIME types commonly used for JavaScript nowadays, the most common being "text/javascript", "application/javascript", and currently used by nginx "application/x-javascript", RFC 4329 prefers "application/javascript". The "charset_types" directive's default value was adjusted accordingly.
2013-07-31Version bump.Sergey Kandaurov1-2/+2
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.