summaryrefslogtreecommitdiffhomepage
path: root/src/http (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2020-07-27QUIC: limited the number of server-initiated streams.Roman Arutyunyan1-13/+15
Also, ngx_quic_create_uni_stream() is replaced with ngx_quic_open_stream() which is capable of creating a bidi stream.
2020-07-22Xslt: disabled ranges.Roman Arutyunyan1-0/+1
Previously, the document generated by the xslt filter was always fully sent to client even if a range was requested and response status was 206 with appropriate Content-Range. The xslt module is unable to serve a range because of suspending the header filter chain. By the moment full response xml is buffered by the xslt filter, range header filter is not called yet, but the range body filter has already been called and did nothing. The fix is to disable ranges by resetting the r->allow_ranges flag much like the image filter that employs a similar technique.
2020-07-14HTTP/3: support $server_protocol variable.Roman Arutyunyan3-4/+6
Now it holds "HTTP/3.0". Previously it was empty.
2020-07-23Style: moved function declarations to match usual code style.Roman Arutyunyan1-11/+9
Plus a few other minor style changes.
2020-07-23HTTP/3: renamed server configuration variables from v3cf to h3scf.Roman Arutyunyan4-26/+26
Now they are similar to HTTP/2 where they are called h2scf.
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-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 Arutyunyan1-1/+1
Now c->listening->handler() is called instead.
2020-07-21QUIC: added "quic" listen parameter in Stream.Roman Arutyunyan1-0/+1
Also, introduced ngx_stream_quic_module.
2020-07-21QUIC: added "quic" listen parameter.Roman Arutyunyan12-379/+540
The parameter allows processing HTTP/0.9-2 over QUIC. Also, introduced ngx_http_quic_module and moved QUIC settings there
2020-07-20Fixed format specifiers.Sergey Kandaurov1-1/+1
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-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 Dounin4-5/+88
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-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-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
2020-06-25HTTP/3: do not emit a DATA frame header for header_only responses.Sergey Kandaurov1-1/+1
This resulted in the frame error due to the invalid DATA frame length.
2020-06-23Do not close QUIC sockets in ngx_close_listening_sockets().Sergey Kandaurov1-0/+4
This breaks graceful shutdown of QUIC connections in terms of quic-transport.
2020-06-15Fixed potential leak of temp pool.Eran Kornblau1-2/+2
In case ngx_hash_add_key() fails, need to goto failed instead of returning, so that temp_pool will be destoryed.
2020-06-22Cache: introduced min_free cache clearing.Maxim Dounin2-3/+41
Clearing cache based on free space left on a file system is expected to allow better disk utilization in some cases, notably when disk space might be also used for something other than nginx cache (including nginx own temporary files) and while loading cache (when cache size might be inaccurate for a while, effectively disabling max_size cache clearing). Based on a patch by Adam Bambuch.
2020-06-15Correctly flush request body to uwsgi with SSL.Quantum1-0/+1
The flush flag was not set when forwarding the request body to the uwsgi server. When using uwsgi_pass suwsgi://..., this causes the uwsgi server to wait indefinitely for the request body and eventually time out due to SSL buffering. This is essentially the same change as 4009:3183165283cc, which was made to ngx_http_proxy_module.c. This will fix the uwsgi bug https://github.com/unbit/uwsgi/issues/1490.
2020-06-02Decoupled validation of Host and :authority for HTTP/2 and HTTP/3.Roman Arutyunyan1-3/+11
Previously an error was triggered for HTTP/2 when host with port was passed by client.
2020-05-29Require ":authority" or "Host" in HTTP/3 and HTTP/2 requests.Roman Arutyunyan1-0/+25
Also, if both are present, require that they have the same value. These requirements are specified in HTTP/3 draft 28. Current implementation of HTTP/2 treats ":authority" and "Host" interchangeably. New checks only make sure at least one of these values is present in the request. A similar check existed earlier and was limited only to HTTP/1.1 in 38c0898b6df7.
2020-05-29Added propagation of the "wildcard" flag to c->listening.Vladimir Homutov1-0/+2
The flags was originally added by 8f038068f4bc, and is propagated correctly in the stream module. With QUIC introduction, http module now uses datagram sockets as well, thus the fix.
2020-05-29QUIC draft-28 transport parameters support.Sergey Kandaurov1-1/+3
Draft-27 and draft-28 support can now be enabled interchangeably, it's based on the compile-time macro NGX_QUIC_DRAFT_VERSION.
2020-05-29Renamed max_packet_size to max_udp_payload_size, from draft-28.Sergey Kandaurov1-14/+15
No functional changes.
2020-05-25HTTP/2: invalid connection preface logging (ticket #1981).Maxim Dounin1-6/+4
Previously, invalid connection preface errors were only logged at debug level, providing no visible feedback, in particular, when a plain text HTTP/2 listening socket is erroneously used for HTTP/1.x connections. Now these are explicitly logged at the info level, much like other client-related errors.
2020-05-22OCSP: certificate status cache.Roman Arutyunyan2-1/+94
When enabled, certificate status is stored in cache and is used to validate the certificate in future requests. New directive ssl_ocsp_cache is added to configure the cache.