summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-07-13HTTP/3: renamed ngx_http_v3.c to ngx_http_v3_encode.c.Roman Arutyunyan1-0/+0
The file contains only encoding functions.
2020-07-13HTTP/3: encode frame ids with ngx_http_v3_encode_varlen_int().Roman Arutyunyan1-4/+8
Even though typically frame ids fit into a single byte, calling ngx_http_v3_encode_varlen_int() adds to the code clarity.
2020-07-23HTTP/3: generate Location response header for absolute redirects.Roman Arutyunyan1-2/+81
2020-07-13HTTP/3: header encoding functions.Roman Arutyunyan3-90/+226
2020-07-22QUIC: fixed bulding perl module by reducing header pollution.Sergey Kandaurov4-2/+5
The ngx_http_perl_module module doesn't have a notion of including additional search paths through --with-cc-opt, which results in compile error incomplete type 'enum ssl_encryption_level_t' when building nginx without QUIC support. The enum is visible from quic event headers and eventually pollutes ngx_core.h. The fix is to limit including headers to compile units that are real consumers.
2020-07-22SSL: fixed compilation without QUIC after 0d2b2664b41c.Roman Arutyunyan1-0/+2
2020-07-22HTTP/3: do not call shutdown() for QUIC streams.Roman Arutyunyan1-5/+7
Previously, this triggered an alert "shutdown() failed" in error log.
2020-07-21QUIC: eliminated connection handler argument in ngx_quic_run().Roman Arutyunyan4-14/+8
Now c->listening->handler() is called instead.
2020-07-21QUIC: added "quic" listen parameter in Stream.Roman Arutyunyan9-11/+442
Also, introduced ngx_stream_quic_module.
2020-07-21QUIC: added "quic" listen parameter.Roman Arutyunyan17-394/+578
The parameter allows processing HTTP/0.9-2 over QUIC. Also, introduced ngx_http_quic_module and moved QUIC settings there
2020-07-18QUIC: do not verify the selected ALPN protocol.Roman Arutyunyan2-8/+1
The right protocol is selected by the HTTP code. In the QUIC code only verify that some protocol was selected and trigger an error otherwise.
2020-07-18QUIC: fixed stream read event log.Roman Arutyunyan1-2/+2
Previously, the main connection log was there. Now it's the stream connection log.
2020-07-20Fixed format specifiers.Sergey Kandaurov4-45/+44
2020-07-16QUIC: added anti-amplification limit.Vladimir Homutov1-0/+25
According to quic-transport draft 29, section 21.12.1.1: Prior to validation, endpoints are limited in what they are able to send. During the handshake, a server cannot send more than three times the data it receives; clients that initiate new connections or migrate to a new network path are limited.
2020-07-16QUIC: added limit of queued data.Vladimir Homutov3-15/+32
The ngx_quic_queue_frame() functions puts a frame into send queue and schedules a push timer to actually send data. The patch adds tracking for data amount in the queue and sends data immediately if amount of data exceeds limit.
2020-07-16QUIC: implemented probe timeout (PTO) calculation.Vladimir Homutov2-9/+60
2020-07-13QUIC: reworked retransmission mechanism.Vladimir Homutov2-63/+75
Instead of timer-based retransmissions with constant packet lifetime, this patch implements ack-based loss detection and probe timeout for the cases, when no ack is received, according to the quic-recovery draft 29.
2020-07-15QUIC: reworked ngx_quic_send_frames() function.Vladimir Homutov1-44/+29
Instead of returning NGX_DONE/NGX_OK, the function now itself moves passed frames range into sent queue and sets PTO timer if required.
2020-07-13QUIC: renaming.Vladimir Homutov1-18/+16
The c->quic->retransmit timer is now called "pto". The ngx_quic_retransmit() function is renamed to "ngx_quic_detect_lost()". This is a preparation for the following patches.
2020-07-13QUIC: caching c->quic in the ngx_quic_handle_ack_frame() function.Vladimir Homutov1-10/+13
To minimize difference with the following changes.
2020-07-10QUIC: delay field of an ACK frame is now calculated.Vladimir Homutov3-2/+28
2020-07-16QUIC: added rtt estimation.Vladimir Homutov2-9/+96
According to the quic-recovery 29, Section 5: Estimating the Round-Trip Time. Currently, integer arithmetics is used, which loses sub-millisecond accuracy.
2020-07-13Merged with the default branch.Sergey Kandaurov28-86/+618
2020-07-09Slice filter: clear original Accept-Ranges.Roman Arutyunyan1-0/+5
The slice filter allows ranges for the response by setting the r->allow_ranges flag, which enables the range filter. If the range was not requested, the range filter adds an Accept-Ranges header to the response to signal the support for ranges. Previously, if an Accept-Ranges header was already present in the first slice response, client received two copies of this header. Now, the slice filter removes the Accept-Ranges header from the response prior to setting the r->allow_ranges flag.
2020-07-09Version bump.Roman Arutyunyan1-2/+2
2020-07-06gRPC: generate error when response size is wrong.Maxim Dounin1-1/+38
As long as the "Content-Length" header is given, we now make sure it exactly matches the size of the response. If it doesn't, the response is considered malformed and must not be forwarded (https://tools.ietf.org/html/rfc7540#section-8.1.2.6). While it is not really possible to "not forward" the response which is already being forwarded, we generate an error instead, which is the closest equivalent. Previous behaviour was to pass everything to the client, but this seems to be suboptimal and causes issues (ticket #1695). Also this directly contradicts HTTP/2 specification requirements. Note that the new behaviour for the gRPC proxy is more strict than that applied in other variants of proxying. This is intentional, as HTTP/2 specification requires us to do so, while in other types of proxying malformed responses from backends are well known and historically tolerated.
2020-07-06FastCGI: protection from responses with wrong length.Maxim Dounin3-15/+109
Previous behaviour was to pass everything to the client, but this seems to be suboptimal and causes issues (ticket #1695). Fix is to drop extra data instead, as it naturally happens in most clients. Additionally, we now also issue a warning if the response is too short, and make sure the fact it is truncated is propagated to the client. The u->error flag is introduced to make it possible to propagate the error to the client in case of unbuffered proxying. For responses to HEAD requests there is an exception: we do allow both responses without body and responses with body matching the Content-Length header.
2020-07-06Upstream: drop extra data sent by upstream.Maxim Dounin5-5/+116
Previous behaviour was to pass everything to the client, but this seems to be suboptimal and causes issues (ticket #1695). Fix is to drop extra data instead, as it naturally happens in most clients. This change covers generic buffered and unbuffered filters as used in the scgi and uwsgi modules. Appropriate input filter init handlers are provided by the scgi and uwsgi modules to set corresponding lengths. Note that for responses to HEAD requests there is an exception: we do allow any response length. This is because responses to HEAD requests might be actual full responses, and it is up to nginx to remove the response body. If caching is enabled, only full responses matching the Content-Length header will be cached (see b779728b180c).
2020-07-06Proxy: style.Maxim Dounin1-2/+2
2020-07-06Proxy: detection of data after final chunk.Maxim Dounin1-1/+30
Previously, additional data after final chunk was either ignored (in the same buffer, or during unbuffered proxying) or sent to the client (in the next buffer already if it was already read from the socket). Now additional data are properly detected and ignored in all cases. Additionally, a warning is now logged and keepalive is disabled in the connection.
2020-07-06Proxy: drop extra data sent by upstream.Maxim Dounin1-9/+43
Previous behaviour was to pass everything to the client, but this seems to be suboptimal and causes issues (ticket #1695). Fix is to drop extra data instead, as it naturally happens in most clients.
2020-07-06Memcached: protect from too long responses.Maxim Dounin1-3/+6
If a memcached response was followed by a correct trailer, and then the NUL character followed by some extra data - this was accepted by the trailer checking code. This in turn resulted in ctx->rest underflow and caused negative size buffer on the next reading from the upstream, followed by the "negative size buf in writer" alert. Fix is to always check for too long responses, so a correct trailer cannot be followed by extra data.
2020-07-03HTTP/2: lingering close after GOAWAY.Ruslan Ermilov2-6/+124
After sending the GOAWAY frame, a connection is now closed using the lingering close mechanism. This allows for the reliable delivery of the GOAWAY frames, while also fixing connection resets observed when http2_max_requests is reached (ticket #1250), or with graceful shutdown (ticket #1544), when some additional data from the client is received on a fully closed connection. For HTTP/2, the settings lingering_close, lingering_timeout, and lingering_time are taken from the "server" level.
2020-07-02HTTP/3: simplified handling return codes from parse functions.Roman Arutyunyan1-30/+4
2020-07-03HTTP/3: put ngx_http_v3_parse_varlen_int() return code in variable.Roman Arutyunyan1-16/+26
This makes calling this function similar to other parse functions.
2020-07-03HTTP/3: simplifed handling ngx_http_v3_parse_literal() return code.Roman Arutyunyan1-56/+21
2020-07-03HTTP/3: limited prefixed integer size by 62 bits.Roman Arutyunyan1-38/+66
2020-07-03HTTP/3: fixed overflow in prefixed integer parser.Roman Arutyunyan1-1/+1
Previously, the expression (ch & 0x7f) was promoted to a signed integer. Depending on the platform, the size of this integer could be less than 8 bytes, leading to overflow when handling the higher bits of the result. Also, sign bit of this integer could be replicated when adding to the 64-bit st->value.
2020-07-02HTTP/3: fixed prefix in decoding Section Acknowledgement.Sergey Kandaurov1-1/+1
2020-06-30HTTP/3: set r->headers_in.chunked flag after parsing headers.Roman Arutyunyan1-1/+6
Previously it was set when creating the request object. The side-effect was trying to discard the request body in case of header parse error.
2020-07-02HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.Roman Arutyunyan7-136/+220
Previously errors led only to closing streams. To simplify closing QUIC connection from a QUIC stream context, new macro ngx_http_v3_finalize_connection() is introduced. It calls ngx_quic_finalize_connection() for the parent connection.
2020-06-30HTTP/3: error code definitions for HTTP/3 and QPACK.Roman Arutyunyan1-0/+23
2020-07-02QUIC: Introduced ngx_quic_finalize_connection().Roman Arutyunyan4-48/+91
The function finalizes QUIC connection with an application protocol error code and sends a CONNECTION_CLOSE frame with type=0x1d. Also, renamed NGX_QUIC_FT_CONNECTION_CLOSE2 to NGX_QUIC_FT_CONNECTION_CLOSE_APP.
2020-07-02HTTP/3: downgraded literal size error level to NGX_LOG_INFO.Roman Arutyunyan1-1/+1
Now it's similar to HTTP/2.
2020-07-02HTTP/3: refactored dynamic table implementation.Roman Arutyunyan7-166/+584
Previously dynamic table was not functional because of zero limit on its size set by default. Now the following changes enable it: - new directives to set SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS - send settings with SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS to the client - send Insert Count Increment to the client - send Header Acknowledgement to the client - evict old dynamic table entries on overflow - decode Required Insert Count from client - block stream if Required Insert Count is not reached
2020-07-02HTTP/3: fixed prefixed integer encoding and decoding.Roman Arutyunyan3-16/+16
Previously bytes were ordered from MSB to LSB, but the right order is the reverse.
2020-06-29SSL: fixed unexpected certificate requests (ticket #2008).Maxim Dounin1-1/+2
Using SSL_CTX_set_verify(SSL_VERIFY_PEER) implies that OpenSSL will send a certificate request during an SSL handshake, leading to unexpected certificate requests from browsers as long as there are any client certificates installed. Given that ngx_ssl_trusted_certificate() is called unconditionally by the ngx_http_ssl_module, this affected all HTTPS servers. Broken by 699f6e55bbb4 (not released yet). Fix is to set verify callback in the ngx_ssl_trusted_certificate() function without changing the verify mode.
2020-06-29HTTP/3: http3_max_field_size directive to limit string size.Roman Arutyunyan3-1/+25
Client streams may send literal strings which are now limited in size by the new directive. The default value is 4096. The directive is similar to HTTP/2 directive http2_max_field_size.
2020-06-26HTTP/3: introduced ngx_http_v3_get_module_srv_conf() macro.Roman Arutyunyan1-0/+6
The macro helps to access a module's server configuration from a QUIC stream context.
2020-06-26HTTP/3: fixed dropping first non-pseudo header.Roman Arutyunyan1-11/+38