summaryrefslogtreecommitdiffhomepage
path: root/src/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-03-16Split transport and crypto parts into separate files.Vladimir Homutov1-0/+1
New files: src/event/ngx_event_quic_protection.h src/event/ngx_event_quic_protection.c The protection.h header provides interface to the crypto part of the QUIC: 2 functions to initialize corresponding secrets: ngx_quic_set_initial_secret() ngx_quic_set_encryption_secret() and 2 functions to deal with packet processing: ngx_quic_encrypt() ngx_quic_decrypt() Also, structures representing secrets are defined there. All functions require SSL connection and a pool, only crypto operations inside, no access to nginx connections or events. Currently pool->log is used for the logging (instead of original c->log).
2020-03-13Fixed sanitizer errors.Roman Arutyunyan1-6/+6
2020-03-16Version bump.Ruslan Ermilov1-2/+2
2020-03-12HTTP/QUIC interface reworked.Vladimir Homutov2-0/+2
- events handling moved into src/event/ngx_event_quic.c - http invokes once ngx_quic_run() and passes stream callback (diff to original http_request.c is now minimal) - streams are stored in rbtree using ID as a key - when a new stream is registered, appropriate callback is called - ngx_quic_stream_t type represents STREAM and stored in c->qs
2020-02-28Initial QUIC support in http.Sergey Kandaurov2-20/+23
2020-02-05Version bump.Sergey Kandaurov1-2/+2
2019-12-27Version bump.Maxim Dounin1-2/+2
2019-12-05Version bump.Maxim Dounin1-2/+2
2019-10-21Parsing server PROXY protocol address and port (ticket #1206).Roman Arutyunyan2-62/+128
New variables $proxy_protocol_server_addr and $proxy_protocol_server_port are added both to HTTP and Stream.
2019-10-21Core: moved PROXY protocol fields out of ngx_connection_t.Roman Arutyunyan4-21/+42
Now a new structure ngx_proxy_protocol_t holds these fields. This allows to add more PROXY protocol fields in the future without modifying the connection structure.
2019-10-24Version bump.Roman Arutyunyan1-2/+2
2019-09-30Core: removed dead code in ngx_rbtree_delete().Vladimir Homutov1-6/+1
The result of ngx_rbtree_min() is always a node with the left child equal to sentinel, thus the check is unnecessary.
2019-09-30Version bump.Vladimir Homutov1-2/+2
2019-09-10Resolver: fixed possible use-after-free while resolving PTR.Sergey Kandaurov1-1/+2
Previously, if a response to the PTR request was cached, and ngx_resolver_dup() failed to allocate memory for the resulting name, then the original node was freed but left in expire_queue. A subsequent address resolving would end up in a use-after-free memory access of the node either in ngx_resolver_expire() or ngx_resolver_process_ptr(), when accessing it through expire_queue. The fix is to leave the resolver node intact.
2019-08-16Version bump.Maxim Dounin1-2/+2
2019-07-31Version bump.Maxim Dounin1-2/+2
2019-07-19Core: fixed memory leak on error, missed in c3f60d618c17.Maxim Dounin1-0/+1
Found by Coverity (CID 1451664).
2019-07-18Core: fixed segfault with too large bucket sizes (ticket #1806).Maxim Dounin1-5/+25
To save memory hash code uses u_short to store resulting bucket sizes, so maximum bucket size is limited to 65536 minus ngx_cacheline_size (larger values will be aligned to 65536 which will overflow u_short). However, there were no checks to enforce this, and using larger bucket sizes resulted in overflows and segmentation faults. Appropriate safety checks to enforce this added to ngx_hash_init().
2019-07-09Version bump.Maxim Dounin1-2/+2
2019-05-27Version bump.Roman Arutyunyan1-2/+2
2020-08-14Version bump.Roman Arutyunyan1-2/+2
2019-04-09Core: enabled "include" in any context (ticket #1615).Vladimir Homutov1-1/+1
2019-04-24Version bump.Vladimir Homutov1-2/+2
2019-04-15Fixed incorrect length handling in ngx_utf8_length().Maxim Dounin1-1/+1
Previously, ngx_utf8_decode() was called from ngx_utf8_length() with incorrect length, potentially resulting in out-of-bounds read when handling invalid UTF-8 strings. In practice out-of-bounds reads are not possible though, as autoindex, the only user of ngx_utf8_length(), provides null-terminated strings, and ngx_utf8_decode() anyway returns an errors when it sees a null in the middle of an UTF-8 sequence. Reported by Yunbin Liu.
2019-04-15Version bump.Maxim Dounin1-2/+2
2019-03-26Version bump.Sergey Kandaurov1-2/+2
2019-03-06Listen port ranges.Roman Arutyunyan2-29/+119
A range is specified with a dash. For each port in a range a separate listen socket is created. Examples: listen 8080-9000; listen example.com:80-88;
2019-03-20Removed sorting of getaddrinfo() results.Roman Arutyunyan1-14/+5
Previously the ngx_inet_resolve_host() function sorted addresses in a way that IPv4 addresses came before IPv6 addresses. This was implemented in eaf95350d75c (1.3.10) along with the introduction of getaddrinfo() which could resolve host names to IPv6 addresses. Since the "listen" directive only used the first address, sorting allowed to preserve "listen" compatibility with the previous behavior and with the behavior of nginx built without IPv6 support. Now "listen" uses all resolved addresses which makes sorting pointless.
2019-03-15Multiple addresses in "listen".Roman Arutyunyan2-211/+130
Previously only one address was used by the listen directive handler even if host name resolved to multiple addresses. Now a separate listening socket is created for each address.
2019-03-03Version bump.Maxim Dounin1-2/+2
2019-02-12Slab: removed redundant page calculation (ticket #1721).Maxim Dounin1-2/+1
2018-12-25Use %s for errors returned from configuration parsing handlers.Ruslan Ermilov1-1/+1
2019-01-17Version bump.Vladimir Homutov1-2/+2
2018-12-24Win32: removed NGX_DIR_MASK concept.Maxim Dounin1-2/+2
Previous interface of ngx_open_dir() assumed that passed directory name has a room for NGX_DIR_MASK at the end (NGX_DIR_MASK_LEN bytes). While all direct users of ngx_dir_open() followed this interface, this also implied similar requirements for indirect uses - in particular, via ngx_walk_tree(). Currently none of ngx_walk_tree() uses provides appropriate space, and fixing this does not look like a right way to go. Instead, ngx_dir_open() interface was changed to not require any additional space and use appropriate allocations instead.
2018-12-11Resolver: report SRV resolve failure if all A resolves failed.Roman Arutyunyan1-1/+9
Previously, if an SRV record was successfully resolved, but all of its A records failed to resolve, NXDOMAIN was returned to the caller, which is considered a successful resolve rather than an error. This could result in losing the result of a previous successful resolve by the caller. Now NXDOMAIN is only returned if at least one A resolve completed with this code. Otherwise the error state of the first A resolve is returned.
2018-12-11Version bump.Roman Arutyunyan1-2/+2
2018-11-26Negative size buffers detection.Maxim Dounin1-4/+60
In the past, there were several security issues which resulted in worker process memory disclosure due to buffers with negative size. It looks reasonable to check for such buffers in various places, much like we already check for zero size buffers. While here, removed "#if 1 / #endif" around zero size buffer checks. It looks highly unlikely that we'll disable these checks anytime soon.
2018-11-15Core: ngx_explicit_memzero().Maxim Dounin2-0/+10
2018-11-15Core: free shared memory on cycle initialization failure.Ruslan Ermilov1-0/+64
2018-11-13Version bump.Vladimir Homutov1-2/+2
2018-10-03Version bump.Vladimir Homutov1-2/+2
2018-10-02Fixed off-by-one error in shared zone initialization.Ruslan Ermilov1-1/+2
On systems without atomic ops, not enough space was allocated for mutex's file name during shared zone initialization.
2018-09-27Version bump.Ruslan Ermilov1-2/+2
2018-08-30Version bump.Roman Arutyunyan1-2/+2
2018-08-09Skipping spaces in configuration files (ticket #1557).Maxim Dounin1-3/+4
Previously, a chunk of spaces larger than NGX_CONF_BUFFER (4096 bytes) resulted in the "too long parameter" error during parsing such a configuration. This was because the code only set start and start_line on non-whitespace characters, and hence adjacent whitespace characters were preserved when reading additional data from the configuration file. Fix is to always move start and start_line if the last character was a space.
2018-08-01Dav: changed ngx_copy_file() to preserve access and mtime.Maxim Dounin1-9/+13
This fixes wrong permissions and file time after cross-device MOVE in the DAV module (ticket #1577). Broken in 8101d9101ed8 (0.8.9) when cross-device copying was introduced in ngx_ext_rename_file(). With this change, ngx_copy_file() always calls ngx_set_file_time(), either with the time provided, or with the time from the original file. This is considered acceptable given that copying the file is costly anyway, and optimizing cases when we do not need to preserve time will require interface changes.
2018-08-01Dav: fixed ngx_copy_file() to truncate destination file.Maxim Dounin1-2/+1
Previously, ngx_open_file(NGX_FILE_CREATE_OR_OPEN) was used, resulting in destination file being partially rewritten if exists. Notably, this affected WebDAV COPY command (ticket #1576).
2018-07-24Version bump.Sergey Kandaurov1-2/+2
2018-07-12Events: moved sockets cloning to ngx_event_init_conf().Maxim Dounin2-6/+5
Previously, listenings sockets were not cloned if the worker_processes directive was specified after "listen ... reuseport". This also simplifies upcoming configuration check on the number of worker connections, as it needs to know the number of listening sockets before cloning.
2018-07-05Resolver: retry sending queries on errors (ticket #1511).Maxim Dounin1-2/+18
Errors when sending UDP datagrams can happen, e.g., when local IP address changes (see fa0e093b64d7), or an unavailable DNS server on the LAN can cause send() to fail with EHOSTDOWN on BSD systems. If this happens during initial query, retry sending immediately, to a different DNS server when possible. If this is not enough, allow normal resend to happen by ignoring the return code of the second ngx_resolver_send_query() call, much like we do in ngx_resolver_resend().