summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-03-31SSL: reasonable version for LibreSSL.Maxim Dounin2-3/+9
LibreSSL defines OPENSSL_VERSION_NUMBER to 0x20000000L, but uses an old API derived from OpenSSL at the time LibreSSL forked. As a result, every version check we use to test for new API elements in newer OpenSSL versions requires an explicit check for LibreSSL. To reduce clutter, redefine OPENSSL_VERSION_NUMBER to 0x1000107fL if LibreSSL is used. The same is done by FreeBSD port of LibreSSL.
2016-03-31Removed the prototype mysql module.Ruslan Ermilov6-770/+2
2016-03-31Fixed ngx_os_signal_process() prototype.Ruslan Ermilov5-8/+8
2016-03-31Fixed ngx_pid_t formatting in ngx_sprintf() and logging.Sergey Kandaurov3-8/+8
2016-03-31Fixed format specifiers in ngx_sprintf().Sergey Kandaurov2-3/+3
2016-03-31Fixed logging.Sergey Kandaurov39-66/+67
2016-03-31Events: fixed logging.Sergey Kandaurov2-12/+19
2016-03-31Fixed logging with variable field width.Sergey Kandaurov6-10/+11
2016-03-31Fixed logging in close error handling.Sergey Kandaurov2-2/+2
2016-03-30Events: fixed test building with eventport on OS X.Ruslan Ermilov1-1/+1
Broken in d17f0584006f (1.9.13).
2016-03-30Style.Ruslan Ermilov43-215/+215
2016-03-30Version bump.Ruslan Ermilov1-2/+2
2016-03-29Win32: replaced NGX_EXDEV with more appropriate error code.Maxim Dounin1-5/+1
Correct error code for NGX_EXDEV on Windows is ERROR_NOT_SAME_DEVICE, "The system cannot move the file to a different disk drive". Previously used ERROR_WRONG_DISK is about wrong diskette in the drive and is not appropriate. There is no real difference though, as MoveFile() is able to copy files between disk drives, and will fail with ERROR_ACCESS_DENIED when asked to copy directories. The ERROR_NOT_SAME_DEVICE error is only used by MoveFileEx() when called without the MOVEFILE_COPY_ALLOWED flag.
2016-03-29Win32: additional error code NGX_EEXIST_FILE (ticket #910).Maxim Dounin3-3/+10
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-03-28Upstream: proxy_next_upstream non_idempotent.Maxim Dounin6-1/+12
By default, requests with non-idempotent methods (POST, LOCK, PATCH) are no longer retried in case of errors if a request was already sent to a backend. Previous behaviour can be restored by using "proxy_next_upstream ... non_idempotent".
2016-03-28Upstream: cached connections now tested against next_upstream.Maxim Dounin1-49/+42
Much like normal connections, cached connections are now tested against u->conf->next_upstream, and u->state->status is now always set. This allows to disable additional tries even with upstream keepalive by using "proxy_next_upstream off".
2016-03-28Fixed --test-build-*.Ruslan Ermilov3-4/+5
Fixes various aspects of --test-build-devpoll, --test-build-eventport, and --test-build-epoll. In particular, if --test-build-devpoll was used on Linux, then "devpoll" event method would be preferred over "epoll". Also, wrong definitions of event macros were chosen.
2016-03-28Sub filter: fixed allocation alignment.Roman Arutyunyan1-4/+4
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-18Stream: additional logging for UDP.Vladimir Homutov2-5/+10
2016-03-23Win32: fixed build after 384154fc634f.Dmitry Volyntsev1-3/+2
2016-03-23Stream: detect port absence in proxy_pass with IP literal.Roman Arutyunyan1-1/+1
This is a clone of http commit 26c127bab5ef.
2016-03-23Resolver: added support for SRV records.Dmitry Volyntsev3-27/+992
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-22Backed out server_tokens changes.Maxim Dounin5-163/+45
Backed out changesets: cf3e75cfa951, 6b72414dfb4f, 602dc42035fe, e5076b96fd01.
2016-03-23Cache: fixed slots accounting error introduced in c9d680b00744.Dmitry Volyntsev1-2/+2
2016-03-22Reconsidered server_tokens with an empty value.Ruslan Ermilov3-20/+11
An empty value will be treated as "off".
2016-03-21HTTP/2: improved debugging of sending control frames.Valentin Bartenev1-2/+13
2016-03-21Events: fixed test building with devpoll and eventport on Linux.Sergey Kandaurov2-1/+3
Avoid POLLREMOVE and itimerspec redefinition.
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-18Cache: added watermark to reduce IO load when keys_zone is full.Dmitry Volyntsev2-5/+34
When a keys_zone is full then each next request to the cache is penalized. That is, the cache has to evict older files to get a slot from the keys_zone synchronously. The patch introduces new behavior in this scenario. Manager will try to maintain available free slots in the keys_zone by cleaning old files in the background.
2016-03-18Cache: report error if slab allocator fails during cache loading.Dmitry Volyntsev2-0/+8
2016-03-18Threads: writing via threads pools in event pipe.Maxim Dounin5-21/+214
The "aio_write" directive is introduced, which enables use of aio for writing. Currently it is meaningful only with "aio threads". Note that aio operations can be done by both event pipe and output chain, so proper mapping between r->aio and p->aio is provided when calling ngx_event_pipe() and in output filter. In collaboration with Valentin Bartenev.
2016-03-18Threads: offloading of temp files writing to thread pools.Maxim Dounin4-14/+164
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 Dounin5-11/+18
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-03-18Fixed timeouts with threaded sendfile() and subrequests.Maxim Dounin2-10/+14
If a write event happens after sendfile() but before we've got the sendfile results in the main thread, this write event will be ignored. And if no more events will happen, the connection will hang. Removing the events works in the simple cases, but not always, as in some cases events are added back by an unrelated code. E.g., the upstream module adds write event in the ngx_http_upstream_init() to track client aborts. Fix is to use wev->complete instead. It is now set to 0 before a sendfile() task is posted, and it is set to 1 once a write event happens. If on completion of the sendfile() task wev->complete is 1, we know that an event happened while we were executing sendfile(), and the socket is still ready for writing even if sendfile() did not sent all the data or returned EAGAIN.
2016-03-16Style.Ruslan Ermilov1-4/+4
2016-03-15Truncation detection in sendfilev() on Solaris.Maxim Dounin1-0/+23
While sendfilev() is documented to return -1 with EINVAL set if the file was truncated, at least Solaris 11 silently returns 0, and this results in CPU hog. Added a test to complain appropriately if 0 is returned.
2016-03-15Truncation detection in sendfile() on Linux.Maxim Dounin1-0/+26
This addresses connection hangs as observed in ticket #504, and CPU hogs with "aio threads; sendfile on" as reported in the mailing list, see http://mailman.nginx.org/pipermail/nginx-ru/2016-March/057638.html. The alert is identical to one used on FreeBSD.
2016-01-20Stream: UDP proxy.Roman Arutyunyan20-105/+726
2016-03-15Stream: post first read events from client and upstream.Roman Arutyunyan1-12/+10
The main proxy function ngx_stream_proxy_process() can terminate the stream session. The code, following it, should check its return code to make sure the session still exists. This happens in client and upstream initialization functions. Swapping ngx_stream_proxy_process() call with the code, that follows it, leaves the same problem vice versa. In future ngx_stream_proxy_process() will call ngx_stream_proxy_next_upstream() making it too complicated to know if stream session still exists after this call. Now ngx_stream_proxy_process() is called from posted event handlers in both places with no code following it. The posted event is automatically removed once session is terminated.
2016-03-15Win32: fixed build after cf3e75cfa951.Ruslan Ermilov1-0/+4
2016-03-15Win32: fixed build after cf3e75cfa951.Ruslan Ermilov1-0/+4
2016-03-15Added variables support to server_tokens.Ruslan Ermilov5-47/+166
It can now be set to "off" conditionally, e.g. using the map directive. An empty value will disable the emission of the Server: header and the signature in error messages generated by nginx. Any other value is treated as "on", meaning that full nginx version is emitted in the Server: header and error messages generated by nginx.