summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2018-11-06nginx-1.14.1-RELEASErelease-1.14.1Maxim Dounin1-0/+40
2018-11-06gRPC: limited allocations due to ping and settings frames.Maxim Dounin1-0/+15
2018-11-06HTTP/2: limit the number of idle state switches.Ruslan Ermilov2-3/+11
An attack that continuously switches HTTP/2 connection between idle and active states can result in excessive CPU usage. This is because when a connection switches to the idle state, all of its memory pool caches are freed. This change limits the maximum allowed number of idle state switches to 10 * http2_max_requests (i.e., 10000 by default). This limits possible CPU usage in one connection, and also imposes a limit on the maximum lifetime of a connection. Initially reported by Gal Goldshtein from F5 Networks.
2018-11-06HTTP/2: flood detection.Ruslan Ermilov2-1/+12
Fixed uncontrolled memory growth in case peer is flooding us with some frames (e.g., SETTINGS and PING) and doesn't read data. Fix is to limit the number of allocated control frames.
2018-11-06Mp4: fixed reading 64-bit atoms.Roman Arutyunyan1-0/+7
Previously there was no validation for the size of a 64-bit atom in an mp4 file. This could lead to a CPU hog when the size is 0, or various other problems due to integer underflow when calculating atom data size, including segmentation fault or worker process memory disclosure.
2018-08-28Updated OpenSSL used for win32 builds.Maxim Dounin1-1/+1
2018-11-06Version bump.Maxim Dounin1-2/+2
2018-04-17release-1.14.0 tagMaxim Dounin1-0/+1
2018-04-17nginx-1.14.0-RELEASErelease-1.14.0Maxim Dounin1-0/+14
2018-04-17Stable branch.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.
2018-03-17gRPC: special handling of the TE request header.Maxim Dounin3-2/+72
According to the gRPC protocol specification, the "TE" header is used to detect incompatible proxies, and at least grpc-c server rejects requests without "TE: trailers". To preserve the logic, we have to pass "TE: trailers" to the backend if and only if the original request contains "trailers" in the "TE" header. Note that no other TE values are allowed in HTTP/2, so we have to remove anything else.
2018-03-17The gRPC proxy module.Maxim Dounin3-0/+4584
The module allows passing requests to upstream gRPC servers. The module is built by default as long as HTTP/2 support is compiled in. Example configuration: grpc_pass 127.0.0.1:9000; Alternatively, the "grpc://" scheme can be used: grpc_pass grpc://127.0.0.1:9000; Keepalive support is available via the upstream keepalive module. Note that keepalive connections won't currently work with grpc-go as it fails to handle SETTINGS_HEADER_TABLE_SIZE. To use with SSL: grpc_pass grpcs://127.0.0.1:9000; SSL connections use ALPN "h2" when available. At least grpc-go works fine without ALPN, so if ALPN is not available we just establish a connection without it. Tested with grpc-c++ and grpc-go.
2018-03-17Upstream: u->conf->preserve_output flag.Maxim Dounin2-2/+5
The flag can be used to continue sending request body even after we've got a response from the backend. In particular, this is needed for gRPC proxying of bidirectional streaming RPCs, and also to send control frames in other forms of RPCs.
2018-03-17Upstream: u->request_body_blocked flag.Maxim Dounin2-2/+20
The flag indicates whether last ngx_output_chain() returned NGX_AGAIN or not. If the flag is set, we arm the u->conf->send_timeout timer. The flag complements c->write->ready test, and allows to stop sending the request body in an output filter due to protocol-specific flow control.
2018-03-17Upstream: trailers support, u->conf->pass_trailers flag.Maxim Dounin2-0/+98
Basic trailer headers support allows one to access response trailers via the $upstream_trailer_* variables. Additionally, the u->conf->pass_trailers flag was introduced. When the flag is set, trailer headers from the upstream response are passed to the client. Like normal headers, trailer headers will be hidden if present in u->conf->hide_headers_hash.
2018-03-17HTTP/2: externalized various constants and interfaces.Maxim Dounin6-91/+130
2018-03-12Style.Roman Arutyunyan1-3/+3
2018-03-12Stream ssl_preread: $ssl_preread_alpn_protocols variable.Roman Arutyunyan1-6/+122
The variable keeps a comma-separated list of protocol names from ALPN TLS extension defined by RFC 7301.
2018-03-07Improved code readablity.Ruslan Ermilov2-4/+12
No functional changes.
2018-03-05HTTP/2: unknown frames now logged at info level.Maxim Dounin1-2/+2
2018-03-05Style.Maxim Dounin1-1/+2
2018-03-01Access log: support for disabling escaping (ticket #1450).Vladimir Homutov2-16/+120
Based on patches by Johannes Baiter <johannes.baiter@bsb-muenchen.de> and Calin Don.