summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-05-26Introduced ngx_tcp_nodelay().Ruslan Ermilov2-0/+44
2017-04-27Added missing "fall through" comments (ticket #1259).Maxim Dounin1-0/+2
Found by gcc7 (-Wimplicit-fallthrough).
2017-04-25Version bump.Ruslan Ermilov1-2/+2
2017-04-18Core: removed extra ngx_alloc() and ngx_calloc() prototypes.Sergey Kandaurov1-3/+0
2017-04-12Core: improved JSON escaping.Valentin Bartenev1-5/+42
Two-character representations are now used for \b, \f, \n, \r, and \t.
2017-04-12Version bump.Ruslan Ermilov1-2/+2
2017-03-28Use ngx_array_init() to initialize arrays.Ruslan Ermilov1-19/+15
2017-03-28Version bump.Ruslan Ermilov1-2/+2
2017-03-22Version bump.Ruslan Ermilov1-2/+2
2017-03-07Introduced worker_shutdown_timeout.Maxim Dounin3-0/+64
The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
2017-03-07Core: introduced ngx_rbtree_next().Maxim Dounin2-0/+31
2017-03-07Removed casts not needed after 1f513d7f1b45.Ruslan Ermilov1-2/+2
2017-03-02Added missing static specifiers.Eran Kornblau1-4/+4
2017-02-17Fixed ngx_parse_size() / ngx_parse_offset() with 0-length strings.Maxim Dounin1-0/+10
2017-02-16Version bump.Maxim Dounin1-2/+2
2017-01-26Version bump.Vladimir Homutov1-2/+2
2017-01-20Fixed trailer construction with limit on FreeBSD and macOS.Maxim Dounin1-0/+3
The ngx_chain_coalesce_file() function may produce more bytes to send then requested in the limit passed, as it aligns the last file position to send to memory page boundary. As a result, (limit - send) may become negative. This resulted in big positive number when converted to size_t while calling ngx_output_chain_to_iovec(). Another part of the problem is in ngx_chain_coalesce_file(): it changes cl to the next chain link even if the current buffer is only partially sent due to limit. Therefore, if a file buffer was not expected to be fully sent due to limit, and was followed by a memory buffer, nginx called sendfile() with a part of the file buffer, and the memory buffer in trailer. If there were enough room in the socket buffer, this resulted in a part of the file buffer being skipped, and corresponding part of the memory buffer sent instead. The bug was introduced in 8e903522c17a (1.7.8). Configurations affected are ones using limits, that is, limit_rate and/or sendfile_max_chunk, and memory buffers after file ones (may happen when using subrequests or with proxying with disk buffering). Fix is to explicitly check if (send < limit) before constructing trailer with ngx_output_chain_to_iovec(). Additionally, ngx_chain_coalesce_file() was modified to preserve unfinished file buffers in cl.
2017-01-20Improved connection draining with small number of connections.Maxim Dounin2-2/+7
Closing up to 32 connections might be too aggressive if worker_connections is set to a comparable number (and/or there are only a small number of reusable connections). If an occasional connection shorage happens in such a configuration, it leads to closing all reusable connections instead of gradually reducing keepalive timeout to a smaller value. To improve granularity in such configurations we now close no more than 1/8 of all reusable connections at once. Suggested by Joel Cunningham.
2017-01-20Added cycle parameter to ngx_drain_connections().Maxim Dounin1-5/+5
No functional changes, mostly style.
2017-01-10Version bump.Ruslan Ermilov1-2/+2
2016-12-24Win32: support 64-bit compilation with MSVC.Maxim Dounin1-3/+3
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 Dounin1-5/+5
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-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-13Version bump.Ruslan Ermilov1-2/+2
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 Dounin1-12/+1
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-07Fixed spelling of logical AND operator, no functional changes.Sergey Kandaurov1-1/+1
Found by PVS-Studio.
2016-12-03Slab: improved double free detection.Ruslan Ermilov1-1/+1
Previously, an attempt to double free the starting page of the free range was not detected.
2016-12-03Slab: always show the requested allocation size in debug messages.Ruslan Ermilov1-1/+0
Previously, allocations smaller than min_size were shown as min_size.
2016-12-03Slab: style.Ruslan Ermilov1-3/+3
Removed redundant parentheses. No functional changes.
2016-11-21Version bump.Maxim Dounin1-2/+2
2016-11-10Core: slight optimization in ngx_chain_update_chains().hucongcong1-7/+9
It is not necessary to traverse *busy and link the *out when *out is NULL.
2016-11-03Cache: prefix-based temporary files.Maxim Dounin1-5/+27
On Linux, the rename syscall can be slow due to a global file system lock, acquired for the entire rename operation, unless both old and new files are in the same directory. To address this temporary files are now created in the same directory as the expected resulting cache file when using the "use_temp_path=off" parameter. This change mostly reverts 99639bfdfa2a and 3281de8142f5, restoring the behaviour as of a9138c35120d (with minor changes).
2016-10-18Core: show file contents only once while dumping configuration.Vladimir Homutov3-24/+66
Files are considered the same if the path used by nginx during parsing matches.
2016-10-14Style.Maxim Dounin1-1/+0
2016-10-13Version bump.Ruslan Ermilov1-2/+2
2016-10-10Modules compatibility: compatibility with NGX_HTTP_SSL.Maxim Dounin3-15/+17
With this change it is now possible to load modules compiled without the "--with-http_ssl_module" configure option into nginx binary compiled with it, and vice versa (if a module doesn't use ssl-specific functions), assuming both use the "--with-compat" option.
2016-10-10Modules compatibility: compatibility with NGX_HAVE_FILE_AIO.Maxim Dounin4-8/+6
With this change it is now possible to load modules compiled without the "--with-file-aio" configure option into nginx binary compiled with it, and vice versa, assuming both use the "--with-compat" option.