summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-03-29Merge of r5138: use of NGX_FILE_ERROR.Maxim Dounin4-6/+8
Use NGX_FILE_ERROR for handling file operations errors. On Win32 platforms 0 is used to indicate errors in file operations, so comparing against either -1 or NGX_OK is not portable. This was not much of an issue in patched code, since only ngx_fd_info() test is actually reachable on Win32 and in worst case it might result in bogus error log entry. Patch by Piotr Sikora.
2013-03-29Merge of r5117, r5123: allocation errors handing during upgrade.Maxim Dounin1-0/+4
*) Core: guard against failed allocation during binary upgrade. Patch by Piotr Sikora. *) Core: fixed resource leak if binary upgrade fails due to no memory. Found by Coverity (CID 992320).
2013-03-29Version bump.Maxim Dounin1-2/+2
2013-02-11Merge of r4985, r4986, r4987, r4988, r4989, r5002: access_log gzip.Maxim Dounin3-48/+7
*) Access log: fixed redundant buffer reallocation. Previously a new buffer was allocated for every "access_log" directive with the same file path and "buffer=" parameters, while only one buffer per file is used. *) Reopening log files code moved to a separate function. The code refactored in a way to call custom handler that can do appropriate cleanup work (if any), like flushing buffers, finishing compress streams, finalizing connections to log daemon, etc.. *) Access log: the "flush" parameter of the "access_log" directive. *) Configure: added the NGX_ZLIB define. This was introduced for conditional compilation of the code that requires the zlib library. *) Access log: the "gzip" parameter of the "access_log" directive. Note: this requires zlib version 1.2.0.4 or above to work. *) The data pointer in ngx_open_file_t objects must be initialized. Uninitialized pointer may result in arbitrary segfaults if access_log is used without buffer and without variables in file path. Patch by Tatsuhiko Kubo (ticket #268).
2013-02-11Merge of r4993, r4994, r4997, r5000: geo ipv6 support.Maxim Dounin2-0/+206
*) Geo: IPv6 support. The "ranges" mode is still limited to IPv4 only. *) Geo: properly initialize ngx_cidr_t when dealing with "default". *) Geo: made "default" affect both IPv4 and IPv6 when using prefixes. Previously, "default" was equivalent to specifying 0.0.0.0/0, now it's equivalent to specifying both 0.0.0.0/0 and ::/0 (if support for IPv6 is enabled) with the same value. *) Geo: improved code readability.
2013-02-11Merge of r4968, r4969, r4977, r4980, r4981, r4990: geo fixes.Maxim Dounin1-5/+5
*) Geo: improved ngx_http_geo_block() code readability. *) Geo: fixed the "ranges" without ranges case. The following configuration returned an empty value for $geo: geo $geo { ranges; default default; } *) Fixed return type of internal function that allocates radix tree nodes. *) There's no need to normalize address returned by ngx_ptocidr(). *) Geo: ensure that default entry is always present. If 0.0.0.0/32 entry was present and there was no explicit "default", we failed to add an empty string as a default value. *) Trailing whitespace fix.
2013-02-10Merge of r4967: ngx_write_fd() and ngx_read_fd() errors handling.Maxim Dounin3-6/+6
The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error, so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows platforms) might result in inaccurate error message in the error log. Also the ngx_errno global variable is being set only if the returned value is -1.
2013-02-10Merge of r4945, r4984: ngx_inet.[ch] minor fixes.Maxim Dounin2-2/+2
*) 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-09Version bump.Maxim Dounin1-2/+2
2012-12-10Merge of r4933, r4933: shared memory fixes.Maxim Dounin2-4/+6
*) 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-10Merge of r4918: cache manager startup with many listen sockets.Maxim Dounin1-0/+2
Fixed failure to start cache manager and cache loader processes if there were more than 512 listening sockets in configuration.
2012-12-10Version bump.Maxim Dounin1-2/+2
2012-11-13Merge of r4891: worker_processes auto.Maxim Dounin1-2/+33
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-12Merge of r4872, r4893: resolver cached addresses random rotation.Maxim Dounin1-2/+29
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-12Merge of r4870, r4871, r4890, r4895: minor fixes.Maxim Dounin4-16/+18
*) 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-12Version bump.Maxim Dounin1-2/+2
2012-09-24Merge of r4828: "include" with wildcards in map and types blocks.Maxim Dounin2-2/+2
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-24Merge of r4785, r4795, r4811, r4812, r4816, r4822: coverity.Maxim Dounin2-11/+18
*) 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-24Merge of r4784: fixed the -p parameter handling.Maxim Dounin1-1/+1
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-24Merge of r4778, r4782, r4783, r4824, r4830, r4834: minor fixes.Maxim Dounin6-13/+17
*) 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-24Version bump.Maxim Dounin1-2/+2
2012-08-06Merge of r4739: s/ngx_shmtx_destory/ngx_shmtx_destroy/.Maxim Dounin2-4/+4
2012-08-06Merge of r4769: better diagnostics for directives in wrong context.Maxim Dounin2-22/+15
2012-08-06Merge of r4765: reduced the number of preprocessor directives.Maxim Dounin1-5/+1
2012-08-06Merge of r4760, r4761: -Wmissing-prototypes.Maxim Dounin2-0/+5
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-06Version bump.Maxim Dounin1-2/+2
2012-07-02Merge of r4690: conflicting wildcard server names fix.Maxim Dounin1-11/+13
With previous code wildcard names were added to hash even if conflict was detected. This resulted in identical names in hash and segfault later in ngx_hash_wildcard_init().
2012-07-02Merge of r4654, r4672, r4684, r4685, r4692: resolver changes.Maxim Dounin1-16/+17
*) Resolver: fixed format specification. Patch by Yichun Zhang (agentzh). *) Support for IPv6 literals and an optional port in resolver. *) Fixed crash in ngx_resolver_cleanup_tree(). If sending a DNS request fails with an error (e.g., when mistakenly trying to send it to a local IP broadcast), such a request is not deleted if there are clients waiting on it. However, it was still erroneously removed from the queue. Later ngx_resolver_cleanup_tree() attempted to remove it from the queue again that resulted in a NULL pointer dereference. *) When "resolver" is configured with a domain name, only the first resolved address was used. Now all addresses will be used. *) Fixed segfault with poll and resolver used. Poll event method needs ngx_cycle->files to work, and use of ngx_exit_cycle without files set caused null pointer dereference in resolver's cleanup on udp socket close.
2012-07-02Merge of r4671: support for IPv6 literals in proxy_pass and so on.Maxim Dounin1-7/+30
2012-07-02Merge of r4653: ngx_inet.c code reduction.Maxim Dounin1-19/+2
Code reduction (no functional changes).
2012-07-02Merge of r4644:Maxim Dounin1-1/+6
Fixed potential null pointer dereference in ngx_resolver_create(). While here, improved error message.
2012-07-02Merge of r4643:Maxim Dounin1-5/+0
Removed historical and now redundant syntax pre-checks in ngx_parse_url().
2012-06-29Merge of r4639, r4640: C++ fixes.Maxim Dounin2-5/+5
Fixed the ngx_regex.h header file compatibility with C++. Fixed building --with-cpp_test_module on some systems.
2012-06-25Version bump.Maxim Dounin1-2/+2
2012-06-04Merge of r4611, r4620: resolver fixes.Maxim Dounin1-2/+14
*) Fixed segmentation fault in ngx_resolver_create_name_query(). If name passed for resolution was { 0, NULL } (e.g. as a result of name server returning CNAME pointing to ".") pointer wrapped to (void *) -1 resulting in segmentation fault on an attempt to dereference it. Reported by Lanshun Zhou. *) Resolver: protection from duplicate responses. If we already had CNAME in resolver node (i.e. rn->cnlen and rn->u.cname set), and got additional response with A record, it resulted in rn->cnlen set and rn->u.cname overwritten by rn->u.addr (or rn->u.addrs), causing segmentation fault later in ngx_resolver_free_node() on an attempt to free overwritten rn->u.cname. The opposite (i.e. CNAME got after A) might cause similar problems as well.
2012-06-04Version bump.Maxim Dounin1-2/+2
2012-04-23Version bump.Maxim Dounin1-2/+2
2012-04-23Fix of "%f" format handling.Igor Sysoev1-16/+19
ngx_sprintf("%.2f", 0.999) incorrectly resulted in "0.100" instead of "1.00".
2012-04-18Don't silently ignore the last line of configuration file thatRuslan Ermilov1-1/+1
consists solely of one unterminated token (inspired by #150).
2012-04-12Fixed grammar in error messages.Ruslan Ermilov2-2/+3
2012-04-12Version bump.Maxim Dounin1-2/+2
2012-04-12Reduced the number of lines of code in ngx_inet_addr().Ruslan Ermilov1-5/+1
2012-04-11Improved readability of the code that produces bitmask from prefix.Ruslan Ermilov1-2/+2
In collaboration with Maxim Dounin.
2012-04-06Fixed signed integer overflows in timer code (ticket #145).Maxim Dounin1-2/+1
Integer overflow is undefined behaviour in C and this indeed caused problems on Solaris/SPARC (at least in some cases). Fix is to subtract unsigned integers instead, and then cast result to a signed one, which is implementation-defined behaviour and used to work. Strictly speaking, we should compare (unsigned) result with the maximum value of the corresponding signed integer type instead, this will be defined behaviour. This will require much more changes though, and considered to be overkill for now.
2012-04-05Comment fixed.Andrey Belov1-1/+1
2012-04-03In ngx_ptocidr(), check that the supplied prefix length is withinRuslan Ermilov1-0/+7
the allowed range.
2012-04-03Fixed spelling in multiline C comments.Ruslan Ermilov5-6/+6
2012-04-02Version bump.Maxim Dounin1-2/+2
2012-03-22Resolver: added missing sanity checking when creating name queries.Maxim Dounin1-1/+5
Found by Veracode.
2012-03-21worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.Ruslan Ermilov2-11/+11