summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-04-26Stable branch.Maxim Dounin1-2/+2
2016-04-19Thread pools: memory barriers in task completion notifications.Maxim Dounin1-0/+4
The ngx_thread_pool_done object isn't volatile, and at least some compilers assume that it is permitted to reorder modifications of volatile and non-volatile objects. Added appropriate ngx_memory_barrier() calls to make sure all modifications will happen before the lock is released. Reported by Mindaugas Rasiukevicius, http://mailman.nginx.org/pipermail/nginx-devel/2016-April/008160.html.
2016-04-12Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse (as in e444e8f6538b).Ruslan Ermilov1-1/+1
2016-04-08Removed redundant "u" format specifier.Ruslan Ermilov2-3/+3
It is implied for "x" and "X".
2016-04-07Version bump.Ruslan Ermilov1-2/+2
2016-04-01Core: removed incorrect GCC 2.7 check.Maxim Dounin1-5/+0
It was broken since introduction (__GNU__ instead of __GNUC__) and did nothing. Moreover, GCC 2.7 is happy with the normal version of the code. Reported by Joel Cunningham, http://mailman.nginx.org/pipermail/nginx-devel/2016-March/007964.html.
2016-03-31SSL: SSLeay_version() is deprecated in OpenSSL 1.1.0.Maxim Dounin1-3/+2
SSLeay_version() and SSLeay() are no longer available if OPENSSL_API_COMPAT is set to 0x10100000L. Switched to using OpenSSL_version() instead. Additionally, we now compare version strings instead of version numbers, and this correctly works for LibreSSL as well.
2016-03-31Removed the prototype mysql module.Ruslan Ermilov2-3/+2
2016-03-31Fixed ngx_os_signal_process() prototype.Ruslan Ermilov1-2/+2
2016-03-31Fixed format specifiers in ngx_sprintf().Sergey Kandaurov2-3/+3
2016-03-31Fixed logging.Sergey Kandaurov4-7/+8
2016-03-31Fixed logging with variable field width.Sergey Kandaurov1-1/+1
2016-03-31Fixed logging in close error handling.Sergey Kandaurov1-1/+1
2016-03-30Style.Ruslan Ermilov11-83/+83
2016-03-30Version bump.Ruslan Ermilov1-2/+2
2016-03-29Win32: additional error code NGX_EEXIST_FILE (ticket #910).Maxim Dounin1-2/+2
On Windows there are two possible error codes which correspond to the EEXIST error code: ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW), and ERROR_ALREADY_EXISTS used by CreateDirectory(). MoveFile() seems to use both: ERROR_ALREADY_EXISTS when moving within one filesystem, and ERROR_FILE_EXISTS when copying a file to a different drive.
2016-02-26Core: allow strings without null-termination in ngx_parse_url().Piotr Sikora1-2/+4
This fixes buffer over-read while using variables in the "proxy_pass", "fastcgi_pass", "scgi_pass", and "uwsgi_pass" directives, where result of string evaluation isn't null-terminated. Found with MemorySanitizer. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2016-03-25Fixed socket inheritance on reload and binary upgrade.Roman Arutyunyan2-0/+20
On nginx reload or binary upgrade, an attempt is made to inherit listen sockets from the previous configuration. Previously, no check for socket type was made and the inherited socket could have the wrong type. On binary upgrade, socket type was not detected at all. Wrong socket type could lead to errors on that socket due to different logic and unsupported syscalls. For example, a UDP socket, inherited as TCP, lead to the following error after arrival of a datagram: "accept() failed (102: Operation not supported on socket)".
2016-03-23Win32: fixed build after 384154fc634f.Dmitry Volyntsev1-3/+2
2016-03-23Resolver: added support for SRV records.Dmitry Volyntsev2-26/+991
2016-03-23Resolver: do not enable resolve timer if provided timeout is zero.Dmitry Volyntsev1-20/+24
2016-03-23Resolver: introduced valid field in resolver responses.Dmitry Volyntsev2-0/+8
It hints the amount of time a response could be considered as valid.
2016-03-23Core: introduced the NGX_DEBUG_PALLOC macro.Valentin Bartenev1-0/+4
It allows to turn off accumulation of small pool allocations into a big preallocated chunk of memory. This is useful for debugging memory access with sanitizer, since such accumulation can cover buffer overruns from being detected.
2016-03-23Core: use ngx_palloc_small() to allocate ngx_pool_large_t.Valentin Bartenev1-2/+2
This structure cannot be allocated as a large block anyway, otherwise that will result in infinite recursion, since each large allocation requires to allocate another ngx_pool_large_t. The room for the structure is guaranteed by the NGX_MIN_POOL_SIZE constant.
2016-03-23Core: introduced the ngx_palloc_small() function.Valentin Bartenev1-33/+26
It deduplicates some code for allocations from memory pool. No functional changes.
2016-03-23Core: moved logging before freeing large blocks of pool.Valentin Bartenev1-9/+10
This fixes use-after-free memory access with enabled debug log when pool->log is allocated as a large block.
2016-03-18Fix build with -Wmissing-prototypes.Piotr Sikora1-2/+2
Broken in 5eb4d7541107 (1.9.6), fix somehow missed in 3600bbfb43e3. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2016-03-18Threads: offloading of temp files writing to thread pools.Maxim Dounin2-0/+10
The ngx_thread_write_chain_to_file() function introduced, which uses ngx_file_t thread_handler, thread_ctx and thread_task fields. The task context structure (ngx_thread_file_ctx_t) is the same for both reading and writing, and can be safely shared as long as operations are serialized. The task->handler field is now always set (and not only when task is allocated), as the same task can be used with different handlers. The thread_write flag is introduced in the ngx_temp_file_t structure to explicitly enable use of ngx_thread_write_chain_to_file() in ngx_write_chain_to_temp_file() when supported by caller. In collaboration with Valentin Bartenev.
2016-03-18Threads: task pointer stored in ngx_file_t.Maxim Dounin2-3/+9
This simplifies the interface of the ngx_thread_read() function. Additionally, most of the thread operations now explicitly set file->thread_task, file->thread_handler and file->thread_ctx, to facilitate use of thread operations in other places. (Potential problems remain with sendfile in threads though - it uses file->thread_handler as set in ngx_output_chain(), and it should not be overwritten to an incompatible one.) In collaboration with Valentin Bartenev.
2016-01-20Stream: UDP proxy.Roman Arutyunyan2-10/+86
2016-03-14Fixed compilation with -Wmissing-prototypes.Sergey Kandaurov2-2/+2
2016-03-03Copy filter: fixed sendfile aio handlers to set ctx->aio.Maxim Dounin1-1/+0
Sendfile handlers (aio preload and thread handler) are called within ctx->output_filter() in ngx_output_chain(), and hence ctx->aio cannot be set directly in ngx_output_chain(). Meanwhile, it must be set to make sure loop within ngx_output_chain() will be properly terminated. There are no known cases that trigger the problem, though in theory something like aio + sub filter (something that needs body in memory, and can also free some memory buffers) + sendfile can result in "task already active" and "second aio post" alerts. The fix is to set ctx->aio in ngx_http_copy_aio_sendfile_preload() and ngx_http_copy_thread_handler(). For consistency, ctx->aio is no longer set explicitly in ngx_output_chain_copy_buf(), as it's now done in ngx_http_copy_thread_handler().
2016-02-25Dynamic modules: removed unnecessary initialization.Ruslan Ermilov1-1/+0
It became unnecessary after 85dea406e18f.
2016-02-25Version bump.Ruslan Ermilov1-2/+2
2016-02-18Core: added support for more than 64 CPUs in worker_cpu_affinity.Vladimir Homutov2-27/+50
2016-02-15Core: improved logging on invalid NGINX variable (ticket #900).Maxim Dounin1-0/+6
2016-02-11Dynamic modules: fixed a version mismatch message (ticket #898).Ruslan Ermilov1-1/+1
Based on a patch by Takashi Takizawa.
2016-02-09Core: ngx_module_t compatibility with C++.Piotr Sikora1-1/+1
Changes to NGX_MODULE_V1 and ngx_module_t in 85dea406e18f (1.9.11) broke all modules written in C++, because ISO C++11 does not allow conversion from string literal to char *. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2016-02-10Version bump.Maxim Dounin1-2/+2
2016-02-04Dynamic modules.Maxim Dounin5-10/+653
The auto/module script is extended to understand ngx_module_link=DYNAMIC. When set, it links the module as a shared object rather than statically into nginx binary. The module can later be loaded using the "load_module" directive. New auto/module parameter ngx_module_order allows to define module loading order in complex cases. By default the order is set based on ngx_module_type. 3rd party modules can be compiled dynamically using the --add-dynamic-module configure option, which will preset ngx_module_link to "DYNAMIC" before calling the module config script. Win32 support is rudimentary, and only works when using MinGW gcc (which is able to handle exports/imports automatically). In collaboration with Ruslan Ermilov.
2016-02-04Dynamic modules: dlopen() support.Maxim Dounin1-0/+1
2016-02-04Dynamic modules: changed ngx_modules to cycle->modules.Maxim Dounin4-21/+27
2016-02-04Dynamic modules: moved module-related stuff to separate files.Maxim Dounin6-63/+145
2015-12-17Resolver: style.Ruslan Ermilov1-9/+8
Use the original query name in error and debug messages when processing PTR responses.
2015-12-17Resolver: improved PTR response processing.Ruslan Ermilov1-28/+74
The previous code only parsed the first answer, without checking its type, and required a compressed RR name. The new code checks the RR type, supports responses with multiple answers, and doesn't require the RR name to be compressed. This has a side effect in limited support of CNAME. If a response includes both CNAME and PTR RRs, like when recursion is enabled on the server, PTR RR is handled. Full CNAME support in PTR response is not implemented in this change.
2015-12-17Resolver: style.Ruslan Ermilov1-13/+13
Renamed argument in ngx_resolver_process_a() for consistency.
2016-02-02Resolver: free TCP buffers on resolver cleanup.Roman Arutyunyan1-0/+10
2016-02-02Resolver: fixed possible resource leak introduced in 5a16d40c63de.Ruslan Ermilov1-0/+2
Found by Coverity (CID 1351175).
2016-01-28Resolver: TCP support.Roman Arutyunyan2-51/+549
Resend DNS query over TCP once UDP response came truncated.
2016-01-28Resolver: per-request DNS server balancer.Roman Arutyunyan2-5/+17
Previously, a global server balancer was used to assign the next DNS server to send a query to. That could lead to a non-uniform distribution of servers per request. A request could be assigned to the same dead server several times in a row and wait longer for a valid server or even time out without being processed. Now each query is sent to all servers sequentially in a circle until a response is received or timeout expires. Initial server for each request is still globally balanced.