summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2018-06-05nginx-1.15.0-RELEASErelease-1.15.0Maxim Dounin1-0/+131
2018-06-04Stream: udp streams.Roman Arutyunyan7-50/+354
Previously, only one client packet could be processed in a udp stream session even though multiple response packets were supported. Now multiple packets coming from the same client address and port are delivered to the same stream session. If it's required to maintain a single stream of data, nginx should be configured in a way that all packets from a client are delivered to the same worker. On Linux and DragonFly BSD the "reuseport" parameter should be specified for this. Other systems do not currently provide appropriate mechanisms. For these systems a single stream of udp packets is only guaranteed in single-worker configurations. The proxy_response directive now specifies how many packets are expected in response to a single client packet.
2018-06-01Events: moved ngx_recvmsg() to new file src/event/ngx_event_udp.c.Roman Arutyunyan4-354/+384
2018-06-01Events: get remote addresses before creating udp connection.Roman Arutyunyan1-71/+82
Previously, ngx_event_recvmsg() got remote socket addresses after creating the connection object. In preparation to handling multiple UDP packets in a single session, this code was moved up.
2018-06-01Events: fixed handling zero-length client address.Roman Arutyunyan1-0/+12
On Linux recvmsg() syscall may return a zero-length client address when receiving a datagram from an unbound unix datagram socket. It is usually assumed that socket address has at least the sa_family member. Zero-length socket address caused buffer over-read in functions which receive socket address, for example ngx_sock_ntop(). Typically the over-read resulted in unexpected socket family followed by session close. Now a fake socket address is allocated instead of a zero-length client address.
2018-06-04Leave chain in ngx_chain_add_copy() in consistent state on errors.Sergey Kandaurov1-0/+1
2018-05-30Limit req: improved handling of negative times.Maxim Dounin1-4/+25
Negative times can appear since workers only update time on an event loop iteration start. If a worker was blocked for a long time during an event loop iteration, it is possible that another worker already updated the time stored in the node. As such, time since last update of the node (ms) will be negative. Previous code used ngx_abs(ms) in the calculations. That is, negative times were effectively treated as positive ones. As a result, it was not possible to maintain high request rates, where the same node can be updated multiple times from during an event loop iteration. In particular, this affected setups with many SSL handshakes, see http://mailman.nginx.org/pipermail/nginx/2018-May/056291.html. Fix is to only update the last update time stored in the node if the new time is larger than previously stored one. If a future time is stored in the node, we preserve this time as is. To prevent breaking things on platforms without monotonic time available if system time is updated backwards, a safety limit of 60 seconds is used. If the time stored in the node is more than 60 seconds in the future, we assume that the time was changed backwards and update lr->last to the current time.
2018-05-29Core: fixed comment about ngx_current_msec after 81fae70d6cb8.Ruslan Ermilov1-2/+2
The value is no longer guaranteed to be based on milliseconds elapsed since Epoch.
2018-05-29Win32: fixed comment in ngx_gettimeofday() calculations.Ruslan Ermilov1-1/+1
2018-05-23Removed glibc crypt_r() bug workaround (ticket #1469).Maxim Dounin1-4/+0
The bug in question was fixed in glibc 2.3.2 and is no longer expected to manifest itself on real servers. On the other hand, the workaround causes compilation problems on various systems. Previously, we've already fixed the code to compile with musl libc (fd6fd02f6a4d), and now it is broken on Fedora 28 where glibc's crypt library was replaced by libxcrypt. So the workaround was removed.
2018-05-14Syslog: install cleanup handler only once.Vladimir Homutov2-17/+16
If a socket was re-opened due to an error (02c2352d5b01 and fa0e093b64d7), additional cleanup handler was installed each time.
2018-05-23Resolver: close UDP socket on error or incomplete send.Ruslan Ermilov1-2/+9
2018-05-23Resolver: style.Ruslan Ermilov1-2/+2
2018-05-21Core: silenced getsockopt(TCP_FASTOPEN) messages on FreeBSD.Maxim Dounin1-1/+3
FreeBSD returns EINVAL when getsockopt(TCP_FASTOPEN) is called on a unix domain socket, resulting in "getsockopt(TCP_FASTOPEN) ... failed" messages during binary upgrade when unix domain listen sockets are present in the configuration. Added EINVAL to the list of ignored error codes.
2018-04-24Configure: fixed clang version detection (closes #1539).Ruslan Ermilov1-1/+2
While 325b3042edd6 fixed it on MINIX, it broke it on systems that output the word "version" on several lines with "cc -v". The fix is to only consider "clang version" or "LLVM version" as clang version, but this time only using sed(1).
2018-05-08Syslog: re-open syslog udp socket on send error (ticket #1477).Vladimir Homutov1-5/+1
Previously, only unix domain sockets were reopened to tolerate cases when local syslog server was restarted. It makes sense to treat other cases (for example, local IP address changes) similarly.
2018-05-07Silenced -Wcast-function-type warnings (closes #1546).Sergey Kandaurov7-19/+31
Cast to intermediate "void *" to lose compiler knowledge about the original type and pass the warning. This is not a real fix but rather a workaround. Found by gcc8.
2018-04-25SSL: deprecated the "ssl" directive.Ruslan Ermilov2-2/+12
2018-04-24SSL: detect "listen ... ssl" without certificates (ticket #178).Maxim Dounin11-93/+123
In mail and stream modules, no certificate provided is a fatal condition, much like with the "ssl" and "starttls" directives. In http, "listen ... ssl" can be used in a non-default server without certificates as long as there is a certificate in the default one, so missing certificate is only fatal for default servers.
2018-04-24Mail: fixed error message about missing ssl_certificate_key.Maxim Dounin1-2/+2
In 51e1f047d15d, the "ssl" directive name was incorrectly hardcoded in the error message shown when there are some SSL keys defined, but not for all certificates. Right approach is to use the "mode" variable, which can be either "ssl" or "starttls".
2018-04-18Cache: fixed cache valid slot to reject incorrect statuses.Maxim Dounin1-1/+2
Previously, result of ngx_atoi() was assigned to an ngx_uint_t variable, and errors reported by ngx_atoi() became positive, so the following check in "status < 100" failed to catch them. This resulted in the configurations like "proxy_cache_valid 2xx 30s" being accepted as correct, while they in fact do nothing. Changing type to ngx_int_t fixes this, and such configurations are now properly rejected.
2018-04-18Version bump.Maxim Dounin1-2/+2
2018-04-10release-1.13.12 tagMaxim Dounin1-0/+1
2018-04-10nginx-1.13.12-RELEASErelease-1.13.12Maxim Dounin1-0/+16
2018-04-05Upstream: fixed u->conf->preserve_output (ticket #1519).Maxim Dounin1-6/+12
Previously, ngx_http_upstream_process_header() might be called after we've finished reading response headers and switched to a different read event handler, leading to errors with gRPC proxying. Additionally, the u->conf->read_timeout timer might be re-armed during reading response headers (while this is expected to be a single timeout on reading the whole response header).
2018-04-05Version bump.Maxim Dounin1-2/+2
2018-04-03release-1.13.11 tagMaxim Dounin1-0/+1
2018-04-03nginx-1.13.11-RELEASErelease-1.13.11Maxim Dounin1-0/+36
2018-04-03Updated OpenSSL and PCRE used for win32 builds.Maxim Dounin1-2/+2
2018-04-03Upstream: fixed ngx_http_upstream_test_next() conditions.Maxim Dounin1-2/+18
Previously, ngx_http_upstream_test_next() used an outdated condition on whether it will be possible to switch to a different server or not. It did not take into account restrictions on non-idempotent requests, requests with non-buffered request body, and the next upstream timeout. For such requests, switching to the next upstream server was rejected later in ngx_http_upstream_next(), resulting in nginx own error page being returned instead of the original upstream response.
2018-04-02Core: fixed build, broken by 63e91f263a49.Vladimir Homutov1-16/+16
Both Solaris and Windows define "s_addr" as a macro.
2018-04-02Core: revised the PROXY protocol v2 code.Ruslan Ermilov1-85/+69
- use normal prefixes for types and macros - removed some macros and types - revised debug messages - removed useless check of ngx_sock_ntop() returning 0 - removed special processing of AF_UNSPEC
2018-03-27Core: style.Vladimir Homutov1-15/+14
2018-03-22Core: added processing of version 2 of the PROXY protocol.Vladimir Homutov1-0/+192
The protocol used on inbound connection is auto-detected and corresponding parser is used to extract passed addresses. TLV parameters are ignored. The maximum supported size of PROXY protocol header is 107 bytes (similar to version 1).
2018-03-22Stream: set action before each recv/send while proxying.Roman Arutyunyan1-2/+11
Now it's clear from log error message if the error occurred on client or upstream side.
2018-03-22gRPC: fixed possible sign extension of error and setting_value.Maxim Dounin1-3/+3
All cases are harmless and should not happen on valid values, though can result in bad values being shown incorrectly in logs. Found by Coverity (CID 1430311, 1430312, 1430313).
2018-03-22Improved code readability (closes #1512).Ruslan Ermilov1-2/+2
2018-03-22Configure: restored "no-threads" in OpenSSL builds.Maxim Dounin1-1/+1
This was previously used, but was incorrectly removed in 83d54192e97b while removing old threads remnants. Instead of using it conditionally when threads are not used, we now set in unconditionally, as even with thread pools enabled we never call OpenSSL functions in threads. This fixes resulting binary when using --with-openssl with OpenSSL 1.1.0+ and without -lpthread linked (notably on FreeBSD without PCRE).
2018-03-22Configure: fixed static compilation with OpenSSL 1.1.1.Maxim Dounin3-7/+16
OpenSSL now uses pthread_atfork(), and this requires -lpthread on Linux to compile. Introduced NGX_LIBPTHREAD to add it as appropriate, similar to existing NGX_LIBDL.
2018-03-22Version bump.Maxim Dounin1-2/+2
2018-03-20release-1.13.10 tagMaxim Dounin1-0/+1
2018-03-20nginx-1.13.10-RELEASErelease-1.13.10Maxim Dounin1-0/+84
2018-03-20gRPC: fixed missing state save in frame header parsing.Sergey Kandaurov1-0/+1
Previously, frame state wasn't saved if HEADERS frame payload that begins with header fragment was not received at once.
2018-03-19HTTP/2: improved frame info debugging.Ruslan Ermilov2-5/+8
2018-03-19gRPC: fixed parsing response headers split on CONTINUATION frames.Sergey Kandaurov1-2/+2
2018-03-19Fixed checking ngx_tcp_push() and ngx_tcp_nopush() return values.Ruslan Ermilov3-3/+3
No functional changes.
2018-03-19Upstream: fixed comments after 13f8dec720b5.Ruslan Ermilov3-6/+2
The fields "uri", "location", and "url" from ngx_http_upstream_conf_t moved to ngx_http_proxy_loc_conf_t and ngx_http_proxy_vars_t, reflect this change in create_loc_conf comments.
2018-03-19Configure: added gRPC module help message.Sergey Kandaurov1-0/+1
2018-03-18Contrib: vim syntax, update core and 3rd party module directives.Gena Makhomed1-14/+44
2018-03-17gRPC: special handling of "trailer only" responses.Maxim Dounin2-10/+16
The gRPC protocol makes a distinction between HEADERS frame with the END_STREAM flag set, and a HEADERS frame followed by an empty DATA frame with the END_STREAM flag. The latter is not permitted, and results in errors not being propagated through nginx. Instead, gRPC clients complain that "server closed the stream without sending trailers" (seen in grpc-go) or "13: Received RST_STREAM with error code 2" (seen in grpc-c). To fix this, nginx now returns HEADERS with the END_STREAM flag if the response length is known to be 0, and we are not expecting any trailer headers to be added. And the response length is explicitly set to 0 in the gRPC proxy if we see initial HEADERS frame with the END_STREAM flag set.