summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2016-12-27nginx-1.11.8-RELEASErelease-1.11.8Maxim Dounin1-0/+107
2016-12-26Stream: speed up TCP peer recovery.Roman Arutyunyan3-0/+37
Previously, an unavailable peer was considered recovered after a successful proxy session to this peer. Until then, only a single client connection per fail_timeout was allowed to be proxied to the peer. Since stream sessions can be long, it may take indefinite time for a peer to recover, limiting the ability of the peer to receive new connections. Now, a peer is considered recovered after a successful TCP connection is established to it. Balancers are notified of this event via the notify() callback.
2016-12-24Win32: compatiblity with OpenSSL 1.1.0.Maxim Dounin3-7/+25
OpenSSL 1.1.0 now uses normal "nmake; nmake install" instead of using custom "ms\do_ms.bat" script and "ms\nt.mak" makefile. And Configure now requires --prefix to be absolute, and no longer derives --openssldir from prefix (so it's specified explicitly). Generated libraries are now called "libcrypto.lib" and "libssl.lib" instead of "libeay32.lib" and "ssleay32.lib". Appropriate tests added to support both old and new variants. Additionally, openssl/lhash.h now triggers warning C4090 ('function' : different 'const' qualifiers), so the warning was disabled.
2016-12-24Win32: support 64-bit compilation with MSVC.Maxim Dounin4-16/+26
There are lots of C4244 warnings (conversion from 'type1' to 'type2', possible loss of data), so they were disabled. The same applies to C4267 warnings (conversion from 'size_t' to 'type', possible loss of data), most notably - conversion from ngx_str_t.len to ngx_variable_value_t.len (which is unsigned:28). Additionally, there is at least one case when it is not possible to fix the warning properly without introducing win32-specific code: recv() on win32 uses "int len", while POSIX defines "size_t len". The ssize_t type now properly defined for 64-bit compilation with MSVC. Caught by warning C4305 (truncation from '__int64' to 'ssize_t'), on "cutoff = NGX_MAX_SIZE_T_VALUE / 10" in ngx_atosz()). Several C4334 warnings (result of 32-bit shift implicitly converted to 64 bits) were fixed by adding explicit conversions. Several C4214 warnings (nonstandard extension used: bit field types other than int) in ngx_http_script.h fixed by changing bit field types from uintptr_t to unsigned.
2016-12-24Win32: fixed some warnings reported by Borland C.Maxim Dounin5-11/+14
Most notably, warning W8012 (comparing signed and unsigned values) reported in multiple places where an unsigned value of small type (e.g., u_short) is promoted to an int and compared to an unsigned value. Warning W8072 (suspicious pointer arithmetic) disabled, it is reported when we increment base pointer in ngx_shm_alloc().
2016-12-24Win32: minimized redefinition of ssize_t.Maxim Dounin1-1/+1
All variants of GCC have ssize_t available, there is no need to redefine it.
2016-12-24Win32: minimized redefinition of intptr_t/uintptr_t.Maxim Dounin1-1/+1
These types are available with MSVC (at least since 2003, in stddef.h), all variants of GCC (in stdint.h) and Watcom C. We need to define them only for Borland C.
2016-12-24Win32: stdint.h used for MinGW GCC.Maxim Dounin1-1/+1
There is no need to restrict stdint.h only to MinGW-w64 GCC, it is available with MinGW GCC as well.
2016-12-24Win32: fixed building with newer versions of MinGW GCC.Maxim Dounin1-0/+1
Macro to indicate that off_t was defined has been changed, so we now additionally define the new one.
2016-12-24Win32: added a variable to specify compiler.Maxim Dounin1-1/+2
This allows to set a different one from command line when needed. For example, to configure nginx with gcc as a compiler one could use "make -f misc/GNUmakefile win32 CC=gcc".
2016-12-23SSL: support AES256 encryption of tickets.Maxim Dounin2-16/+47
This implies ticket key size of 80 bytes instead of previously used 48, as both HMAC and AES keys are 32 bytes now. When an old 48-byte ticket key is provided, we fall back to using backward-compatible AES128 encryption. OpenSSL switched to using AES256 in 1.1.0, and we are providing equivalent security. While here, order of HMAC and AES keys was reverted to make the implementation compatible with keys used by OpenSSL with SSL_CTX_set_tlsext_ticket_keys(). Prodded by Christian Klinger.
2016-12-22Fixed missing "Location" field with some relative redirects.Ruslan Ermilov4-18/+10
Relative redirects did not work with directory redirects and auto redirects issued by nginx.
2016-12-21Core: relative redirects (closes #1000).Ruslan Ermilov4-2/+16
The current version of HTTP/1.1 standard allows relative references in redirects (https://tools.ietf.org/html/rfc7231#section-7.1.2). Allow this form for redirects generated by nginx by introducing the new directive absolute_redirect.
2016-12-21Limited recursion when evaluating variables.Ruslan Ermilov2-13/+61
Unlimited recursion might cause stack exhaustion in some misconfigurations.
2016-12-20Stream: client SSL certificates verification support.Vladimir Homutov2-0/+157
New directives: "ssl_verify_client", "ssl_verify_depth", "ssl_client_certificate", "ssl_trusted_certificate", and "ssl_crl". New variables: $ssl_client_cert, $ssl_client_raw_cert, $ssl_client_s_dn, $ssl_client_i_dn, $ssl_client_serial, $ssl_client_fingerprint, $ssl_client_verify, $ssl_client_v_start, $ssl_client_v_end, and $ssl_client_v_remain.
2016-12-19Stream ssl_preread: relaxed SSL version check.Roman Arutyunyan1-1/+1
SSL version 3.0 can be specified by the client at the record level for compatibility reasons. Previously, ssl_preread module rejected such connections, presuming they don't have SNI. Now SSL 3.0 is allowed at the record level.
2016-12-16Configure: detect nginx version for nginx.pm at make time.Ruslan Ermilov1-4/+5
2016-12-16Resolver: fixed handling of partially resolved SRV.Dmitry Volyntsev1-1/+5
The resolver handles SRV requests in two stages. In the first stage it gets all SRV RRs, and in the second stage it resolves the names from SRV RRs into addresses. Previously, if a response to an SRV request was cached, the queries to resolve names were not limited by a timeout. If a response to any of these queries was not received, the SRV request could never complete. If a response to an SRV request was not cached, and some of the queries to resolve names timed out, NGX_RESOLVE_TIMEDOUT was returned instead of successfully resolved addresses. To fix both issues, resolving of names is now always limited by a timeout.
2016-12-16Resolver: fixed a race between parallel name and addr resolves.Dmitry Volyntsev1-2/+2
Previously, ngx_resolve_name() and ngx_resolve_addr() may have rescheduled the resend timer while it was already in progress.
2016-12-16Resolver: fixed possible premature stop of the resend timer.Dmitry Volyntsev1-0/+1
Previously, ngx_resolve_name_done() and ngx_resolve_addr_done() may have stopped the resend timer prematurely while srv_resend_queue was not empty.
2016-12-16Resolver: fixed possible use-after-free in worker on fast shutdown.Ruslan Ermilov1-0/+4
The fix in a3dc657f4e95 was incomplete.
2016-12-15Resolver: fixed possible use-after-free in worker on fast shutdown.Ruslan Ermilov1-0/+4
2016-12-15SSL: backed out changeset e7cb5deb951d, reimplemented properly.Maxim Dounin2-6/+6
Changeset e7cb5deb951d breaks build on CentOS 5 with "dereferencing type-punned pointer will break strict-aliasing rules" warning. It is backed out. Instead, to keep builds with BoringSSL happy, type of the "value" variable changed to "char *", and an explicit cast added before calling ngx_parse_http_time().
2016-12-13SSL: fix call to BIO_get_mem_data().Piotr Sikora2-2/+2
Fixes build with BoringSSL. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2016-12-15Access log: support for json escaping.Valentin Bartenev2-12/+154
2016-12-13Contrib: added 'commentstring' for vim-commentary support.Armin Grodon1-0/+1
2016-12-13The size of cmcf->phase_engine.handlers explained.Ruslan Ermilov1-1/+4
2016-12-13Version bump.Ruslan Ermilov1-2/+2
2016-12-13release-1.11.7 tagMaxim Dounin1-0/+1
2016-12-13nginx-1.11.7-RELEASErelease-1.11.7Maxim Dounin1-0/+94
2016-12-10HTTP/2: prevented creating temp files for requests without body.Valentin Bartenev1-2/+4
The problem was introduced by 52bd8cc17f34.
2016-11-28HTTP/2: fixed posted streams handling.Valentin Bartenev3-38/+42
A bug was introduced by 82efcedb310b that could lead to timing out of responses or segmentation fault, when accept_mutex was enabled. The output queue in HTTP/2 can contain frames from different streams. When the queue is sent, all related write handlers need to be called. In order to do so, the streams were added to the h2c->posted queue after handling sent frames. Then this queue was processed in ngx_http_v2_write_handler(). If accept_mutex is enabled, the event's "ready" flag is set but its handler is not called immediately. Instead, the event is added to the ngx_posted_events queue. At the same time in this queue can be events from upstream connections. Such events can result in sending output queue before ngx_http_v2_write_handler() is triggered. And at the time ngx_http_v2_write_handler() is called, the output queue can be already empty with some streams added to h2c->posted. But after 82efcedb310b, these streams weren't processed if all frames have already been sent and the output queue was empty. This might lead to a situation when a number of streams were get stuck in h2c->posted queue for a long time. Eventually these streams might get closed by the send timeout. In the worst case this might also lead to a segmentation fault, if already freed stream was left in the h2c->posted queue. This could happen if one of the streams was terminated but wasn't closed, due to the HEADERS frame or a partially sent DATA frame left in the output queue. If this happened the ngx_http_v2_filter_cleanup() handler removed the stream from the h2c->waiting or h2c->posted queue on termination stage, before the frame has been sent, and the stream was again added to the h2c->posted queue after the frame was sent. In order to fix all these problems and simplify the code, write events of fake stream connections are now added to ngx_posted_events instead of using a custom h2c->posted queue.
2016-12-08Map: the "volatile" parameter.Ruslan Ermilov2-2/+28
By default, "map" creates cacheable variables [1]. With this parameter it creates a non-cacheable variable. An original idea was to deduce the cacheability of the "map" variable by checking the cacheability of variables specified in source and resulting values, but it turned to be too hard. For example, a cacheable variable can be overridden with the "set" directive or with the SSI "set" command. Also, keeping "map" variables cacheable by default is good for performance reasons. This required adding a new parameter. [1] Before db699978a33f (1.11.0), the cacheability of the "map" variable could vary depending on the cacheability of variables specified in resulting values (ticket #1090). This is believed to be a bug rather than a feature.
2016-12-08Map: simplified "map" block parser.Ruslan Ermilov2-2/+4
No functional changes.
2016-12-08Slab: commented bitmap initialization for small allocations.Ruslan Ermilov1-0/+1
2016-12-07Slab: free pages statistics.Ruslan Ermilov2-0/+6
2016-12-07Slab: slots statistics.Ruslan Ermilov2-11/+57
For each slot, the number of total and used entries, as well as the number of allocation requests and failures, are tracked.
2016-12-07Slab: simplified some math.Ruslan Ermilov1-17/+12
No functional changes.
2016-12-07Slab: simplified allocation from slots.Ruslan Ermilov1-79/+61
Removed code that would cause an endless loop, and removed condition check that is always false. The first page in the slot list is guaranteed to satisfy an allocation.
2016-12-07Slab: fixed the number of pages calculation.Ruslan Ermilov1-0/+1
When estimating the number of pages, do not count memory for slots. In some cases this gives one extra usable memory page.
2016-12-07Slab: added comment about list heads.Ruslan Ermilov1-1/+4
2016-12-07Slab: improved code readability.Ruslan Ermilov1-54/+49
No functional changes.
2016-12-07Core: fixed environment on exit.Maxim Dounin1-8/+40
On exit environment allocated from a pool is no longer available, leading to a segmentation fault if, for example, a library tries to use it from an atexit() handler. Fix is to allocate environment via ngx_alloc() instead, and explicitly free it using a pool cleanup handler if it's no longer used (e.g., on configuration reload).
2016-12-07Perl: removed special environment handling for the perl module.Maxim Dounin2-15/+4
In Perl 5.8.6 the default was switched to use putenv() when used as embedded library unless "PL_use_safe_putenv = 0" is explicitly used in the code. Therefore, for modern versions of Perl it is no longer necessary to restore previous environment when calling perl_destruct().
2016-12-07Perl: added PERL_SET_INTERP().Maxim Dounin1-0/+8
For Perl compiled with threads, without PERL_SET_INTERP() the PL_curinterp remains set to the first interpreter created (that is, one created at original start). As a result after a reload Perl thinks that operations are done withing a thread, and, most notably, denies to change environment. For example, the following code properly works on original start, but fails after a reload: perl 'sub { my $r = shift; $r->send_http_header("text/plain"); $ENV{TZ} = "UTC"; $r->print("tz: " . $ENV{TZ} . " (localtime " . (localtime()) . ")\n"); $ENV{TZ} = "Europe/Moscow"; $r->print("tz: " . $ENV{TZ} . " (localtime " . (localtime()) . ")\n"); return OK; }'; To fix this, PERL_SET_INTERP() added anywhere where PERL_SET_CONTEXT() was previously used. Note that PERL_SET_INTERP() doesn't seem to be documented anywhere. Yet it is used in some other software, and also seems to be the only solution possible.
2016-12-07Fixed spelling of logical AND operator, no functional changes.Sergey Kandaurov1-1/+1
Found by PVS-Studio.
2016-11-22Mp4: fixed setting wrong mdat atom size in very rare cases.hucongcong1-1/+3
Atom size is the sum of atom header size and atom data size. The specification says that the first 4 bytes are set to one when the atom size is greater than the maximum unsigned 32-bit value. Which means atom header size should be considered when the comparison takes place between atom data size and 0xffffffff.
2016-12-05SSL: $ssl_curves (ticket #1088).Maxim Dounin4-0/+76
The variable contains a list of curves as supported by the client. Known curves are listed by their names, unknown ones are shown in hex, e.g., "0x001d:prime256v1:secp521r1:secp384r1". Note that OpenSSL uses session data for SSL_get1_curves(), and it doesn't store full list of curves supported by the client when serializing a session. As a result $ssl_curves is only available for new sessions (and will be empty for reused ones). The variable is only meaningful when using OpenSSL 1.0.2 and above. With older versions the variable is empty.
2016-12-05SSL: $ssl_ciphers (ticket #870).Maxim Dounin4-0/+92
The variable contains list of ciphers as supported by the client. Known ciphers are listed by their names, unknown ones are shown in hex, e.g., ""AES128-SHA:AES256-SHA:0x00ff". The variable is fully supported only when using OpenSSL 1.0.2 and above. With older version there is an attempt to provide some information using SSL_get_shared_ciphers(). It only lists known ciphers though. Moreover, as OpenSSL uses session data for SSL_get_shared_ciphers(), and it doesn't store relevant data when serializing a session. As a result $ssl_ciphers is only available for new sessions (and not available for reused ones) when using OpenSSL older than 1.0.2.
2016-12-05SSL: $ssl_client_v_start, $ssl_client_v_end, $ssl_client_v_remain.Maxim Dounin3-0/+193