Commit graph

4198 commits

Author SHA1 Message Date
Maxim Dounin
aa94ea5dea Merge of r4915, r4916, r4917: upstream minor fixes.
*) Upstream: honor the "down" flag for a single server.

   If an upstream block was defined with the only server marked as
   "down", e.g.

       upstream u {
           server 127.0.0.1:8080 down;
       }

   an attempt was made to contact the server despite the "down" flag.
   It is believed that immediate 502 response is better in such a
   case, and it's also consistent with what is currently done in case
   of multiple servers all marked as "down".

*) Upstream: better detection of connect() failures with kqueue.

   Pending EOF might be reported on both read and write events, whichever
   comes first, so check both of them.

   Patch by Yichun Zhang (agentzh), slightly modified.
2012-12-10 16:35:32 +00:00
Maxim Dounin
02615df1bb Merge of r4914: variables $request_time and $msec.
Log module counterparts are preserved for efficiency.
2012-12-10 16:03:56 +00:00
Maxim Dounin
032c4f2425 Merge of r4913: fixed CPU affinity on respawn of dead workers.
Worker processes are now made aware of their sequential number needed
to select CPU affinity mask.  This replaces a workaround from r4865.
2012-12-10 16:00:55 +00:00
Maxim Dounin
4be8258166 Version bump. 2012-12-10 15:43:41 +00:00
Maxim Dounin
8bf9560e56 release-1.2.5 tag 2012-11-13 13:35:19 +00:00
Maxim Dounin
e487de6fa9 nginx-1.2.5-RELEASE 2012-11-13 13:34:59 +00:00
Maxim Dounin
071831dc3d Merge of r4896: event pipe: fixed handling of buf_to_file data.
Input filter might free a buffer if there is no data in it, and in case
of first buffer (used for cache header and request header, aka p->buf_to_file)
this resulted in cache corruption.  Buffer memory was reused to read upstream
response before headers were written to disk.

Fix is to avoid moving pointers in ngx_event_pipe_add_free_buf() to a buffer
start if we were asked to free a buffer used by p->buf_to_file.

This fixes occasional cache file corruption, usually resulted
in "cache file ... has md5 collision" alerts.

Reported by Anatoli Marinov.
2012-11-13 11:24:14 +00:00
Maxim Dounin
e1fd544763 Merge of r4892: keepalive memory usage optimization.
The ngx_http_keepalive_handler() function is now trying to not
keep c->buffer's memory for idle connections.

This behaviour is consistent with the ngx_http_set_keepalive()
function and it should decrease memory usage in some cases (especially
if epoll/rtsig is used).
2012-11-13 11:21:31 +00:00
Maxim Dounin
41b2b12346 Merge of r4891: worker_processes auto.
Core: the "auto" parameter of the "worker_processes" directive.

The parameter will set the number of worker processes to the
autodetected number of available CPU cores.
2012-11-13 11:00:37 +00:00
Maxim Dounin
5e727f5775 Merge of r4886, r4887, r4894: log variables generalization:
*) Log: $apache_bytes_sent removed.  It was renamed to $body_bytes_sent
   in nginx 0.3.10 and the old name is deprecated since then.

*) Variable $bytes_sent.  It replicates variable $bytes_sent as previously
   available in log module only.  Patch by Benjamin Grössing (with minor
   changes).

*) Variables $connection and $connection_requests.  Log module
   counterparts are removed as they aren't used often and there is no
   need to preserve them for efficiency.
2012-11-13 10:45:23 +00:00
Maxim Dounin
c6276b4150 Merge of r4885: ssl_verify_client optional_no_ca.
SSL: the "ssl_verify_client" directive parameter "optional_no_ca".

This parameter allows to don't require certificate to be signed by
a trusted CA, e.g. if CA certificate isn't known in advance, like in
WebID protocol.

Note that it doesn't add any security unless the certificate is actually
checked to be trusted by some external means (e.g. by a backend).

Patch by Mike Kazantsev, Eric O'Connor.
2012-11-13 10:42:16 +00:00
Maxim Dounin
a07ab9ad54 Merge of r4872, r4893: resolver cached addresses random rotation.
Resolver: cached addresses are returned with random rotation now.

This ensures balancing when working with dynamically resolved upstream
servers with multiple addresses.

Based on patch by Anton Jouline.
2012-11-12 18:47:07 +00:00
Maxim Dounin
f4fd2d59a3 Merge of r4870, r4871, r4890, r4895: minor fixes.
*) Made sure to initialize the entire ngx_file_t structure.
   Found by Coverity.

*) Correct plural form for "path" in the whole source base.

*) Removed conditional compilation from waitpid() error test.

   There are reports that call to a signal handler for an exited process
   despite waitpid() already called for the process may happen on Linux
   as well.

*) Style, parentheses instead of braces in misc/GNUMakefile.
2012-11-12 18:39:51 +00:00
Maxim Dounin
1c640c946f Merge of r4868, r4869: SSL minor fixes.
*) SSL: fixed compression workaround to remove all methods.

   Previous code used sk_SSL_COMP_delete(ssl_comp_methods, i) while iterating
   stack from 0 to n, resulting in removal of only even compression methods.

   In real life this change is a nop, as there is only one compression method
   which is enabled by default in OpenSSL.

*) SSL: added version checks for ssl compression workaround.

   The SSL_COMP_get_compression_methods() is only available as an API
   function in OpenSSL 0.9.8+, require it explicitly to unbreak build
   with OpenSSL 0.9.7.
2012-11-12 18:00:32 +00:00
Maxim Dounin
7988f4aca5 Merge of r4866, r4867: configure fixes.
*) Configure: help updated to list upstream keepalive and least_conn.
   Patch by Joshua Zhu.

*) Configure: additional test for ExtUtils::Embed perl module presence.
   Now perl configure will correctly fail if ExtUtils::Embed perl module
   is not present in the system (found on Amazon Linux AMI, as of
   release 2012.03).
2012-11-12 17:57:57 +00:00
Maxim Dounin
8541966db2 Merge of r4865: clearing of cpu_affinity after process spawn.
This fixes unwanted/incorrect cpu_affinity use on dead worker processes
respawn.  While this is not ideal, it's expected to be better when previous
situation where multiple processes were spawn with identical CPU affinity
set.

Reported by Charles Chen.
2012-11-12 17:54:49 +00:00
Maxim Dounin
3cf301db77 Version bump. 2012-11-12 17:03:38 +00:00
Maxim Dounin
3676939732 release-1.2.4 tag 2012-09-25 13:43:03 +00:00
Maxim Dounin
7965a30a78 nginx-1.2.4-RELEASE 2012-09-25 13:42:43 +00:00
Maxim Dounin
ee1acd5389 Stable: removed gunzip module from win32 helper target.
Gunzip filter isn't merged into stable branch.
2012-09-25 10:41:22 +00:00
Maxim Dounin
3cc0fe30d8 Merge of r4835, r4841: improved welcome and 50x error pages. 2012-09-24 19:14:17 +00:00
Maxim Dounin
8a90b57fc9 Merge of r4833: limit req: fix of rbtree node insertion.
Limit req: fix of rbtree node insertion on hash collisions.

The rbtree used in ngx_http_limit_req_module has two level of keys, the top is
hash, and the next is the value string itself. However, when inserting a new
node, only hash has been set, while the value string has been left empty.

The bug was introduced in r4419 (1.1.14).
Found by Charles Chen.
2012-09-24 19:11:45 +00:00
Maxim Dounin
917a5c0a6f Merge of r4829: fixed strict aliasing with ipv6 (ticket #201).
Fixed strict aliasing bugs when dealing with IPv4-mapped IPv6
addresses.
2012-09-24 19:06:48 +00:00
Maxim Dounin
8831af3698 Merge of r4828: "include" with wildcards in map and types blocks.
The "include" directive should be able to include multiple files if
given a filename mask.  Fixed this to work for "include" directives
inside the "map" or "types" blocks.  The "include" directive inside
the "geo" block is still not fixed.
2012-09-24 19:05:02 +00:00
Maxim Dounin
2b64e62233 Merge of r4817: geo: fixed handling of ranges without default set.
The bug had appeared in 0.8.43 (r3653).  Patch by Weibin Yao.
2012-09-24 19:02:16 +00:00
Maxim Dounin
8cc4f6248a Merge of r4815: map: fixed optimization of variables as values.
Previous code incorrectly used ctx->var_values as an array of pointers to
ngx_http_variable_value_t, but the array contains structures, not pointers.
Additionally, ctx->var_values inspection failed to properly set var on
match.
2012-09-24 19:00:02 +00:00
Maxim Dounin
6286f9c062 Merge of r4813, r4814, r4818, r4819, r4820, r4823: mail fixes.
*) Corrected the directive name in the ngx_mail_auth_http_module
   error message.

*) Don't let the well-known port in the "listen" directive to
   override the already set "protocol".

*) Fixed sorting of listen addresses (ticket #187).  For http module
   this problem was already fixed in r4756.

*) Removed a stale "AF_INET only" comment.  IPv6 client connections
   in mail modules have been supported since r2856.

*) Fixed handling of AF_UNIX addresses in "listen".  This makes AF_UNIX
   addresses in mail officially supported.

*) Whitespace fix.
2012-09-24 18:58:13 +00:00
Maxim Dounin
be844866bb Merge of r4785, r4795, r4811, r4812, r4816, r4822: coverity.
*) Resolver: fixed possible memory leak in ngx_resolver_create().

*) Explicitly ignore returned value from unlink() in ngx_open_tempfile().

*) Explicitly ignore returned value from close() in ngx_event_core_init_conf().

*) Added three missing checks for NULL after ngx_array_push() calls.

*) Crypt: fixed handling of corrupted SSHA entries in password file.

*) Mark logically dead code with corresponding comment.

Found by / prodded by Coverity.
2012-09-24 18:54:28 +00:00
Maxim Dounin
e1e56351f1 Merge of r4784: fixed the -p parameter handling.
Ensure that the path supplied always ends with a `/' except when empty.
An empty value now corresponds to the current directory instead of `/'.
2012-09-24 18:50:25 +00:00
Maxim Dounin
38df2aa726 Merge of r4842: fixed make macros to use parentheses.
Configure: fixed make macros to use parentheses instead of braces.
Parentheses are more portable, in particular they are understood by
nmake while braces aren't.
2012-09-24 18:46:50 +00:00
Maxim Dounin
b22f4fb6f0 Merge of r4779, r4840, r4843, r4844: win32 changes.
*) Fixed build with Visual Studio 2005 Express.

   It is available via winetricks which makes it still usable, and has
   an old crtdefs.h which uses _CRT_SECURE_NO_DEPRECATE instead of
   _CRT_SECURE_NO_WARNINGS to suppress warnings.

   Reported by HAYASHI Kentaro,
   http://mailman.nginx.org/pipermail/nginx-devel/2012-August/002542.html

*) Configure: provide inflate() when building zlib on win32.

*) Helper target "win32" to run configure for win32 builds.

*) Updated zlib used for win32 builds.
2012-09-24 18:37:14 +00:00
Maxim Dounin
cc1bb6ebdf Merge of r4778, r4782, r4783, r4824, r4830, r4834: minor fixes.
*) Reorder checks in ngx_shared_memory_add() for more consistent
   error messages.

*) Added "const" to ngx_memcpy() with NGX_MEMCPY_LIMIT defined.  This
   fixes warning produced during compilation of the ngx_http_geoip_module
   due to const qualifier being discarded.

*) Fixed possible use of old cached times if runtime went backwards.

   If ngx_time_sigsafe_update() updated only ngx_cached_err_log_time, and
   then clock was adjusted backwards, the cached_time[slot].sec might
   accidentally match current seconds on next ngx_time_update() call,
   resulting in various cached times not being updated.

   Fix is to clear the cached_time[slot].sec to explicitly mark cached times
   are stale and need updating.

*) Radix tree preallocation fix.  The preallocation size was calculated
   incorrectly and was always 8 due to sizeof(ngx_radix_tree_t) accidentally
   used instead of sizeof(ngx_radix_node_t).

*) Fixed overflow if ngx_slab_alloc() is called with very big "size"
   argument.

*) Write filter: replaced unneeded loop with one to free chains.
   Noted by Gabor Lekeny.
2012-09-24 18:34:04 +00:00
Maxim Dounin
97047b74c5 Merge of r4777, r4780, r4831, r4832: release process changes.
*) Simplified makefile that builds CHANGES.

*) Removed the need in Perl to generate ZIP archive of nginx/Windows.

*) Converted DOS-style newlines in dump.xslt.

*) Pass changes.xml thru xmllint when generating CHANGES and CHANGES.ru.
2012-09-24 18:30:26 +00:00
Maxim Dounin
ad80992b26 Version bump. 2012-09-24 18:24:07 +00:00
Maxim Dounin
083596dbb0 release-1.2.3 tag 2012-08-07 12:36:19 +00:00
Maxim Dounin
05b8ccb52b nginx-1.2.3-RELEASE 2012-08-07 12:35:56 +00:00
Maxim Dounin
17a5184e3a Merge of r4739: s/ngx_shmtx_destory/ngx_shmtx_destroy/. 2012-08-06 18:09:23 +00:00
Maxim Dounin
ffe8787e23 Merge of r4775: updated PCRE used for win32 builds. 2012-08-06 17:38:12 +00:00
Maxim Dounin
f20d1bae3f Merge of r4771: ngx_http_find_virtual_server() fix.
The ngx_http_find_virtual_server() function should return NGX_DECLINED
if virtual server not found.
2012-08-06 17:36:30 +00:00
Maxim Dounin
52df349abc Merge of r4770: hide_headers/pass_headers inheritance fix.
Hide headers and pass headers arrays might not be inherited correctly
into a nested location, e.g. in configuration like

    server {
        proxy_hide_header X-Foo;
        location / {
            location /nested/ {
                proxy_pass_header X-Pad;
            }
        }
    }

the X-Foo header wasn't hidden in the location /nested/.

Reported by Konstantin Svist,
http://mailman.nginx.org/pipermail/nginx-ru/2012-July/047555.html
2012-08-06 17:34:08 +00:00
Maxim Dounin
5ff6b77a01 Merge of r4769: better diagnostics for directives in wrong context. 2012-08-06 17:31:32 +00:00
Maxim Dounin
77dc045e9e Merge of r4766, r4767: ngx_http_upstream_add() changes.
*) Fixed to return NULL if an error occurs.

*) Microoptimization: replaced an expression known to be constant with
   the constant value.
2012-08-06 17:20:01 +00:00
Maxim Dounin
af87c31654 Merge of r4765: reduced the number of preprocessor directives. 2012-08-06 17:15:23 +00:00
Maxim Dounin
726a071b0f Merge of r4764: debug_connection with a domain name change.
When "debug_connection" is configured with a domain name, only the first
resolved address was used.  Now all addresses will be used.
2012-08-06 17:13:20 +00:00
Maxim Dounin
201d0da810 Merge of r4763: added the Clang compiler support.
The -Werror is commented out to not break builds on Linux.
2012-08-06 17:10:35 +00:00
Maxim Dounin
d833679582 Merge of r4760, r4761: -Wmissing-prototypes.
Fixed compilation with -Wmissing-prototypes.  Added a commented
out -Wmissing-prototypes to CFLAGS.  It is commented out to not break
builds with 3rd party modules.
2012-08-06 17:07:28 +00:00
Maxim Dounin
09e0f2a76e Merge of r4759, r4762, r4768: configure minor fixes.
*) Replaced a number of "else if" with "elif".

*) Made sure to run configure in a "C" locale.  Otherwise, we may fail
   to properly detect a version of compiler.

*) Removed extraneous GCC warning flags.
2012-08-06 17:03:01 +00:00
Maxim Dounin
f03effbc47 Merge of r4758: win32: fixed cpu hog after process startup failure.
If ngx_spawn_process() failed while starting a process, the process
handle was closed but left non-NULL in the ngx_processes[] array.
The handle later was used in WaitForMultipleObjects() (if there
were multiple worker processes configured and at least one worker
process was started successfully), resulting in infinite loop.

Reported by Ricardo Villalobos Guevara:
http://mailman.nginx.org/pipermail/nginx-devel/2012-July/002494.html
2012-08-06 16:24:22 +00:00
Maxim Dounin
26960680e4 Merge of r4757: debugging messages in limit_conn.
Fixed debugging messages to account that limit_zone was renamed to limit_conn.
2012-08-06 16:19:35 +00:00
Maxim Dounin
9e518898de Version bump. 2012-08-06 16:06:36 +00:00