summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
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.
2016-01-28Resolver: renamed UDP-specific structures, fields and variables.Roman Arutyunyan2-63/+63
They will be used for TCP connections as well.
2016-01-28Resolver: removed unused field from ngx_resolver_ctx_t.Roman Arutyunyan1-3/+1
2016-01-28Version bump.Roman Arutyunyan1-2/+2
2016-01-26Resolver: limited CNAME recursion.Ruslan Ermilov1-6/+22
Previously, the recursion was only limited for cached responses.
2016-01-26Resolver: fixed use-after-free memory accesses with CNAME.Roman Arutyunyan2-39/+35
When several requests were waiting for a response, then after getting a CNAME response only the last request's context had the name updated. Contexts of other requests had the wrong name. This name was used by ngx_resolve_name_done() to find the node to remove the request context from. When the name was wrong, the request could not be properly cancelled, its context was freed but stayed linked to the node's waiting list. This happened e.g. when the first request was aborted or timed out before the resolving completed. When it completed, this triggered a use-after-free memory access by calling ctx->handler of already freed request context. The bug manifests itself by "could not cancel <name> resolving" alerts in error_log. When a request was responded with a CNAME, the request context kept the pointer to the original node's rn->u.cname. If the original node expired before the resolving timed out or completed with an error, this would trigger a use-after-free memory access via ctx->name in ctx->handler(). The fix is to keep ctx->name unmodified. The name from context is no longer used by ngx_resolve_name_done(). Instead, we now keep the pointer to resolver node to which this request is linked. Keeping the original name intact also improves logging.
2016-01-26Resolver: changed the ngx_resolver_create_*_query() arguments.Roman Arutyunyan1-30/+27
No functional changes. This is needed by the following change.
2016-01-26Resolver: fixed CNAME processing for several requests.Ruslan Ermilov1-6/+15
When several requests were waiting for a response, then after getting a CNAME response only the last request was properly processed, while others were left waiting.
2016-01-26Resolver: fixed crashes in timeout handler.Ruslan Ermilov2-25/+42
If one or more requests were waiting for a response, then after getting a CNAME response, the timeout event on the first request remained active, pointing to the wrong node with an empty rn->waiting list, and that could cause either null pointer dereference or use-after-free memory access if this timeout expired. If several requests were waiting for a response, and the first request terminated (e.g., due to client closing a connection), other requests were left without a timeout and could potentially wait indefinitely. This is fixed by introducing per-request independent timeouts. This change also reverts 954867a2f0a6 and 5004210e8c78.
2016-01-26Resolver: fixed possible segmentation fault on DNS format error.Roman Arutyunyan1-1/+1
2016-01-11Core: worker_cpu_affinity auto.Maxim Dounin2-2/+42
If enabled, workers are bound to available CPUs, each worker to once CPU in order. If there are more workers than available CPUs, remaining are bound in a loop, starting again from the first available CPU. The optional mask parameter defines which CPUs are available for automatic binding. In collaboration with Vladimir Homutov.
2015-12-17Version bump.Maxim Dounin1-2/+2
2015-12-09Version bump.Ruslan Ermilov1-2/+2
2015-12-03Style: NGX_PTR_SIZE replaced with sizeof(void *).Maxim Dounin1-1/+1
The NGX_PTR_SIZE macro is only needed in preprocessor directives where it's not possible to use sizeof().
2015-11-23Core: enabled "include" inside http upstreams (ticket #635).Ruslan Ermilov1-1/+1
The directive already works inside stream upstream blocks.
2015-11-17Version bump.Valentin Bartenev1-2/+2
2015-10-30Fixed ngx_parse_time() out of bounds access (ticket #821).Maxim Dounin1-1/+1
The code failed to ensure that "s" is within the buffer passed for parsing when checking for "ms", and this resulted in unexpected errors when parsing non-null-terminated strings with trailing "m". The bug manifested itself when the expires directive was used with variables. Found by Roman Arutyunyan.
2015-10-26Syslog: added "nohostname" option.Vladimir Homutov2-1/+10
The option disables sending hostname in the syslog message header. This is useful with syslog daemons that do not expect it (tickets #677 and #783).
2015-10-27Version bump.Valentin Bartenev1-2/+2
2015-10-23Core: read/write locks are also required by the Stream module.Piotr Sikora1-1/+1
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2015-10-17Win32: fixed build with MinGW and MinGW-w64 gcc.Kouhei Sutou1-1/+1
This change fixes the "comparison between signed and unsigned integer expressions" warning, introduced in 5e6142609e48 (1.9.4).
2015-10-19Style: unneeded casts of cf->args->elts removed.Maxim Dounin1-2/+2
2015-07-12Extract out version info function.Kurtis Nusbaum1-58/+65
The code for displaying version info and configuration info seemed to be cluttering up the main function. I was finding it hard to read main. This extracts out all of the logic for displaying version and configuration info into its own function, thus making main easier to read.
2015-09-24Version bump.Maxim Dounin1-2/+2
2015-09-11The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev1-1/+1
The SPDY support is removed, as it's incompatible with the new module.
2015-09-11Core: fixed segfault with null in wildcard hash names.Maxim Dounin1-0/+4
A configuration like server { server_name .foo^@; } server { server_name .foo; } resulted in a segmentation fault during construction of server names hash. Reported by Markus Linnala. Found with afl-fuzz.
2015-08-23Version bump.Valentin Bartenev1-2/+2
2015-08-13Core: fixed potential division by zero when initializing hash.Sergey Kandaurov1-0/+8
Found by Clang Static Analyzer.
2015-08-13Core: fixed style in the error message.Sergey Kandaurov1-1/+1
2015-08-11Core: idle connections now closed only once on exiting.Valentin Bartenev2-0/+21
Iterating through all connections takes a lot of CPU time, especially with large number of worker connections configured. As a result nginx processes used to consume CPU time during graceful shutdown. To mitigate this we now only do a full scan for idle connections when shutdown signal is received. Transitions of connections to idle ones are now expected to be avoided if the ngx_exiting flag is set. The upstream keepalive module was modified to follow this.
2015-08-11Fixed typo in the error message.Andrei Belov1-1/+1
2015-07-23Workaround for "configuration file test failed" under OpenVZ.Gena Makhomed1-4/+22
If nginx was used under OpenVZ and a container with nginx was suspended and resumed, configuration tests started to fail because of EADDRINUSE returned from listen() instead of bind(): # nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use) nginx: configuration file /etc/nginx/nginx.conf test failed With this change EADDRINUSE errors returned by listen() are handled similarly to errors returned by bind(), and configuration tests work fine in the same environment: # nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful More details about OpenVZ suspend/resume bug: https://bugzilla.openvz.org/show_bug.cgi?id=2470
2015-07-15Version bump.Maxim Dounin1-2/+2
2015-06-17Resolver: canceled resend timer on empty resend queues.Sergey Kandaurov1-0/+20
This is specifically useful on graceful shutdown.
2015-06-16Version bump.Vladimir Homutov1-2/+2
2015-05-14Core: store and dump processed configuration.Vladimir Homutov5-4/+88
If the -T option is passed, additionally to configuration test, configuration files are output to stdout. In the debug mode, configuration files are kept in memory and can be accessed using a debugger.
2015-06-16Core: added support for writing to stdout.Vladimir Homutov1-0/+7
2015-06-16Core: renamed ngx_proxy_protocol_parse to ngx_proxy_protocol_read.Roman Arutyunyan2-2/+2
The new name is consistent with the ngx_proxy_protocol_write function.
2015-06-16Stream: client-side PROXY protocol.Roman Arutyunyan2-0/+51
The new directive "proxy_protocol" toggles sending out PROXY protocol header to upstream once connection is established.
2015-06-11Moved ngx_http_parse_time() to core, renamed accordingly.Maxim Dounin3-0/+299
The function is now called ngx_parse_http_time(), and can be used by any code to parse HTTP-style date and time. In particular, it will be used for OCSP stapling. For compatibility, a macro to map ngx_http_parse_time() to the new name provided for a while.