Commit Graph

4209 Commits

Author SHA1 Message Date
Maxim Dounin
deee4cafa0 Merge of r4946, r4978: perl.
*) Fixed build with embedded perl in certain setups (ticket #48).

*) Brought the link to ngx_http_perl_module documentation up to date.
2013-02-10 02:58:03 +00:00
Maxim Dounin
dcec6574b8 Merge of r4945, r4984: ngx_inet.[ch] minor fixes.
*) Fixed the NGX_SOCKADDR_STRLEN macro definition.
   The ngx_sock_ntop() function, when told to print both address and port,
   prints IPv6 address in square brackets, followed by colon and port.

*) Properly initialize "struct in6_addr" with zeroes.
2013-02-10 02:56:03 +00:00
Maxim Dounin
4f535b103e Merge of r4944: removed GLOB_NOSORT glob option.
This will result in alphabetical sorting of included files if
the "include" directive with wildcards is used.

Note that the behaviour is now different from that on Windows, where
alphabetical sorting is not guaranteed for FindFirsFile()/FindNextFile()
(used to be alphabetical on NTFS, but not on FAT).

Approved by Igor Sysoev, prodded by many.
2013-02-09 21:27:37 +00:00
Maxim Dounin
5abb6ff1f0 Version bump. 2013-02-09 21:07:06 +00:00
Maxim Dounin
4dcc362967 release-1.2.6 tag 2012-12-11 14:26:07 +00:00
Maxim Dounin
33e5b473af nginx-1.2.6-RELEASE 2012-12-11 14:24:23 +00:00
Maxim Dounin
663e14e10d Merge of r4921, r4922, r4923, r4924, r4925: request body fixes.
*) Request body: fixed "501 Not Implemented" error handling.

   It is not about "Method" but a generic message, and is expected to be used
   e.g. if specified Transfer-Encoding is not supported.  Fixed message to
   match RFC 2616.

   Additionally, disable keepalive on such errors as we won't be able to read
   request body correctly if we don't understand Transfer-Encoding used.

*) Request body: $request_body variable generalization.

   The $request_body variable was assuming there can't be more than two
   buffers.  While this is currently true due to request body reading
   implementation details, this is not a good thing to depend on and may
   change in the future.

*) Request body: code duplication reduced, no functional changes.

   The r->request_body_in_file_only with empty body case is now handled in
   ngx_http_write_request_body().

*) Request body: fixed socket leak on errors.

   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.

*) Request body: properly handle events while discarding body.

   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-12-11 13:18:50 +00:00
Maxim Dounin
f45e938b89 Merge of r4933, r4933: shared memory fixes.
*) Fixed location of debug message in ngx_shmtx_lock().

*) Core: don't reuse shared memory zone that changed ownership (ticket #210).

   nginx doesn't allow the same shared memory zone to be used for different
   purposes, but failed to check this on reconfiguration.  If a shared memory
   zone was used for another purpose in the new configuration, nginx attempted
   to reuse it and crashed.
2012-12-10 18:17:32 +00:00
Maxim Dounin
59833d5450 Merge of r4920, r4939: ngx_write_chain_to_file() fixes.
*) Core: added debug logging of writev() in ngx_write_chain_to_file().

*) Core: fixed ngx_write_chain_to_file() with IOV_MAX reached.

   Catched by dav_chunked.t on Solaris.  In released versions this might
   potentially result in corruption of complex protocol responses if they
   were written to disk and there were more distinct buffers than IOV_MAX
   in a single write.
2012-12-10 18:04:54 +00:00
Maxim Dounin
c460629181 Merge of r4919: fixed segfault on PUT in dav module.
Dav: fixed segfault on PUT if body was already read (ticket #238).

If request body reading happens with different options it's possible
that there will be no r->request_body->temp_file available (or even
no r->request_body available if body was discarded).  Return internal
server error in this case instead of committing suicide by dereferencing
a null pointer.
2012-12-10 17:51:10 +00:00
Maxim Dounin
e3cf44789f Merge of r4918: cache manager startup with many listen sockets.
Fixed failure to start cache manager and cache loader processes
if there were more than 512 listening sockets in configuration.
2012-12-10 17:46:51 +00:00
Maxim Dounin
72bba4144b 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
18590cd21e 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
50832b0177 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
2948d7cfc2 Version bump. 2012-12-10 15:43:41 +00:00
Maxim Dounin
4256e45d66 release-1.2.5 tag 2012-11-13 13:35:19 +00:00
Maxim Dounin
98556739a5 nginx-1.2.5-RELEASE 2012-11-13 13:34:59 +00:00
Maxim Dounin
13cda62555 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
1954cf149a 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
de72cc29aa 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
3f72b59412 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
71b6604e44 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
0e6c7b0614 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
033598bc07 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
d39777712d 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
745c7d9c8e 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
41bdb0f93d 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
de68f145bf Version bump. 2012-11-12 17:03:38 +00:00
Maxim Dounin
d7c1c21da8 release-1.2.4 tag 2012-09-25 13:43:03 +00:00
Maxim Dounin
a841b3ab2c nginx-1.2.4-RELEASE 2012-09-25 13:42:43 +00:00
Maxim Dounin
83ec7bdbf3 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
b9efe317d4 Merge of r4835, r4841: improved welcome and 50x error pages. 2012-09-24 19:14:17 +00:00
Maxim Dounin
9e5528f244 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
21ccde77f5 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
adceda60bd 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
892410148f 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
2953f4aa39 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
9288e6587b 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
191e31938e 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
f8c0690d37 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
90c3d53146 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
ae5736bfa4 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
ce750db233 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
649cd3b401 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
bd0a1916dd Version bump. 2012-09-24 18:24:07 +00:00
Maxim Dounin
c925a2afeb release-1.2.3 tag 2012-08-07 12:36:19 +00:00
Maxim Dounin
fe3b78f0d4 nginx-1.2.3-RELEASE 2012-08-07 12:35:56 +00:00
Maxim Dounin
67dbb8b8d0 Merge of r4739: s/ngx_shmtx_destory/ngx_shmtx_destroy/. 2012-08-06 18:09:23 +00:00
Maxim Dounin
567dc0b265 Merge of r4775: updated PCRE used for win32 builds. 2012-08-06 17:38:12 +00:00
Maxim Dounin
6087743fe2 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