summaryrefslogtreecommitdiffhomepage
path: root/src/http/v3 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-05-28HTTP/3: fixed handling of zero-length literal field line.Sergey Kandaurov1-0/+3
Previously, st->value was passed with NULL data pointer to header handlers.
2024-05-28HTTP/3: fixed dynamic table overflow.Roman Arutyunyan1-1/+1
While inserting a new entry into the dynamic table, first the entry is added, and then older entries are evicted until table size is within capacity. After the first step, the number of entries may temporarily exceed the maximum calculated from capacity by one entry, which previously caused table overflow. The easiest way to trigger the issue is to keep adding entries with empty names and values until first eviction. The issue was introduced by 987bee4363d1.
2024-05-28HTTP/3: decoder stream pre-creation.Roman Arutyunyan3-9/+17
Previously a decoder stream was created on demand for sending Section Acknowledgement, Stream Cancellation and Insert Count Increment. If conditions for sending any of these instructions never happen, a decoder stream is not created at all. These conditions include client not using the dynamic table and no streams abandoned by server (RFC 9204, Section 2.2.2.2). However RFC 9204, Section 4.2 defines only one condition for not creating a decoder stream: An endpoint MAY avoid creating a decoder stream if its decoder sets the maximum capacity of the dynamic table to zero. The change enables pre-creation of the decoder stream at HTTP/3 session initialization if maximum dynamic table capacity is not zero. Note that this value is currently hardcoded to 4096 bytes and is not configurable, so the stream is now always created. Also, the change fixes a potential stack overflow when creating a decoder stream in ngx_http_v3_send_cancel_stream() while draining a request stream by ngx_drain_connections(). Creating a decoder stream involves calling ngx_get_connection(), which calls ngx_drain_connections(), which will drain the same request stream again. If client's MAX_STREAMS for uni stream is high enough, these recursive calls will continue until we run out of stack. Otherwise, decoder stream creation will fail at some point and the request stream connection will be drained. This may result in use-after-free, since this connection could still be referenced up the stack.
2023-11-14HTTP/3: added Huffman decoding error logging.Sergey Kandaurov1-0/+2
2023-09-14HTTP/3: postponed session creation to init() callback.Roman Arutyunyan3-9/+13
Now the session object is assigned to c->data while ngx_http_connection_t object is referenced by its http_connection field, similar to ngx_http_v2_connection_t and ngx_http_request_t. The change allows to eliminate v3_session field from ngx_http_connection_t. The field was under NGX_HTTP_V3 macro, which was a source of binary compatibility problems when nginx/module is build with/without HTTP/3 support. Postponing is essential since c->data should retain the reference to ngx_http_connection_t object throughout QUIC handshake, because SSL callbacks ngx_http_ssl_servername() and ngx_http_ssl_alpn_select() rely on this.
2023-09-13HTTP/3: moved variable initialization.Roman Arutyunyan1-1/+2
2023-09-13QUIC: "handshake_timeout" configuration parameter.Roman Arutyunyan2-9/+7
Previously QUIC did not have such parameter and handshake duration was controlled by HTTP/3. However that required creating and storing HTTP/3 session on first client datagram. Apparently there's no convenient way to store the session object until QUIC handshake is complete. In the followup patches session creation will be postponed to init() callback.
2023-07-12HTTP/3: fixed $body_bytes_sent.Sergey Kandaurov1-0/+1
2023-05-12HTTP/3: removed server push support.Roman Arutyunyan7-1082/+6
2023-05-11QUIC: style.Maxim Dounin2-3/+4
2023-05-11HTTP/3: removed "http3" parameter of "listen" directive.Roman Arutyunyan1-8/+6
The parameter has been deprecated since c851a2ed5ce8.
2023-05-11QUIC: removed "quic_mtu" directive.Roman Arutyunyan1-37/+0
The directive used to set the value of the "max_udp_payload_size" transport parameter. According to RFC 9000, Section 18.2, the value specifies the size of buffer for reading incoming datagrams: This limit does act as an additional constraint on datagram size in the same way as the path MTU, but it is a property of the endpoint and not the path; see Section 14. It is expected that this is the space an endpoint dedicates to holding incoming packets. Current QUIC implementation uses the maximum possible buffer size (65527) for reading datagrams.
2023-05-04HTTP/3: fixed ngx_http_v3_init_session() error handling.Sergey Kandaurov1-3/+0
A QUIC connection is not usable yet at this early stage of spin up.
2023-04-06HTTP/3: fixed CANCEL_PUSH handling.Sergey Kandaurov1-1/+1
2023-02-27HTTP/3: "quic" parameter of "listen" directive.Roman Arutyunyan5-70/+75
Now "listen" directve has a new "quic" parameter which enables QUIC protocol for the address. Further, to enable HTTP/3, a new directive "http3" is introduced. The hq-interop protocol is enabled by "http3_hq" as before. Now application protocol is chosen by ALPN. Previously used "http3" parameter of "listen" is deprecated.
2023-01-05HTTP/3: insert count block timeout.Roman Arutyunyan1-0/+6
Previously, there was no timeout for a request stream blocked on insert count, which could result in infinite wait. Now client_header_timeout is set when stream is first blocked.
2023-01-05HTTP/3: trigger 400 (Bad Request) on stream error while blocked.Roman Arutyunyan1-1/+1
Previously, stream was closed with NGX_HTTP_CLOSE. However, in a similar case when recv() returns eof or error, status 400 is triggered.
2023-01-10HTTP/3: fixed $connection_time.Sergey Kandaurov1-4/+1
Previously, start_time wasn't set for a new stream. The fix is to derive it from the parent connection. Also it's used to simplify tracking keepalive_time.
2023-01-03HTTP/3: handled insertion reference to a going to be evicted entry.Roman Arutyunyan1-21/+16
As per RFC 9204, section 3.2.2, a new entry can reference an entry in the dynamic table that will be evicted when adding this new entry into the dynamic table. Previously, such inserts resulted in use-after-free since the old entry was evicted before the insertion (ticket #2431). Now it's evicted after the insertion. This change fixes Insert with Name Reference and Duplicate encoder instructions.
2022-10-25HTTP/3: implement keepalive for hq.Roman Arutyunyan1-17/+30
Previously, keepalive timer was deleted in ngx_http_v3_wait_request_handler() and set in request cleanup handler. This worked for HTTP/3 connections, but not for hq connections. Now keepalive timer is deleted in ngx_http_v3_init_request_stream() and set in connection cleanup handler, which works both for HTTP/3 and hq.
2022-11-30QUIC: application init() callback.Roman Arutyunyan4-25/+43
It's called after handshake completion or prior to the first early data stream creation. The callback should initialize application-level data before creating streams. HTTP/3 callback implementation sets keepalive timer and sends SETTINGS. Also, this allows to limit max handshake time in ngx_http_v3_init_stream().
2022-08-22HTTP/3: renamed functions.Roman Arutyunyan2-4/+4
ngx_http_v3_init() is renamed ngx_http_v3_init_stream(). ngx_http_v3_reset_connection() is renamed to ngx_http_v3_reset_stream().
2022-11-30QUIC: removed cancelable flag from QUIC and HTTP/3 events.Roman Arutyunyan1-1/+0
All these events are created in context of a client connection and are deleted when the connection is closed. Setting ev->cancelable could trigger premature connection closure and a socket leak alert.
2022-10-19QUIC: idle mode for main connection.Roman Arutyunyan3-1/+38
Now main QUIC connection for HTTP/3 always has c->idle flag set. This allows the connection to receive worker shutdown notification. It is passed to application level via a new conf->shutdown() callback. The HTTP/3 shutdown callback sends GOAWAY to client and gracefully shuts down the QUIC connection.
2022-10-19HTTP/3: unified hq code with regular HTTP/3 code.Roman Arutyunyan4-100/+62
The change removes hq-specific request handler. Now hq requests are handled by the HTTP/3 request handler.
2022-11-29QUIC: reusable mode for main connection.Roman Arutyunyan1-2/+12
The connection is automatically switched to this mode by transport layer when there are no non-cancelable streams. Currently, cancelable streams are HTTP/3 encoder/decoder/control streams.
2022-11-25HTTP/3: fixed build without NGX_PCRE (broken by 0f5fc7a320db).Jiuzhou Cui1-0/+2
2022-11-22HTTP/3: fixed server_name regex captures (ticket #2407).Sergey Kandaurov1-0/+1
Previously, HTTP/3 stream connection didn't inherit the servername regex from the main QUIC connection saved when processing SNI and using regular expressions in server names. As a result, it didn't execute to set regex captures when choosing the virtual server while parsing HTTP/3 headers.
2022-08-03HTTP/3: skip empty request body buffers (ticket #2374).Roman Arutyunyan1-7/+9
When client DATA frame header and its content come in different QUIC packets, it may happen that only the header is processed by the first ngx_http_v3_request_body_filter() call. In this case an empty request body buffer is added to r->request_body->bufs, which is later reused in a subsequent ngx_http_v3_request_body_filter() call without being removed from the body chain. As a result, rb->request_body->bufs ends up with two copies of the same buffer. The fix is to avoid adding empty request body buffers to r->request_body->bufs.
2022-06-22Merged with the default branch.Sergey Kandaurov1-13/+11
2022-06-08HTTP/3: updated SETTINGS_MAX_FIELD_SECTION_SIZE name.Sergey Kandaurov2-3/+4
2022-05-26HTTP/3: require that field section base index is not negative.Roman Arutyunyan1-0/+6
RFC 9204 explicitly requires that.
2022-02-05QUIC: stream lingering.Roman Arutyunyan1-2/+0
Now ngx_quic_stream_t is decoupled from ngx_connection_t in a way that it can persist after connection is closed by application. During this period, server is expecting stream final size from client for correct flow control. Also, buffered output is sent to client as more flow control credit is granted.
2022-01-31HTTP/3: proper uni stream closure detection.Roman Arutyunyan1-5/+34
Previously, closure detection for server-initiated uni streams was not properly implemented. Instead, HTTP/3 code relied on QUIC code posting the read event and setting rev->error when it needed to close the stream. Then, regular uni stream read handler called c->recv() and received error, which closed the stream. This was an ad-hoc solution. If, for whatever reason, the read handler was called earlier, c->recv() would return 0, which would also close the stream. Now server-initiated uni streams have a separate read event handler for tracking stream closure. The handler calls c->recv(), which normally returns 0, but may return error in case of closure.
2022-01-27HTTP/3: delayed Insert Count Increment instruction.Roman Arutyunyan4-4/+60
Sending the instruction is delayed until the end of the current event cycle. Delaying the instruction is allowed by quic-qpack-21, section 2.2.2.3. The goal is to reduce the amount of data sent back to client by accumulating several inserts in one instruction and sometimes not sending the instruction at all, if Section Acknowledgement was sent just before it.
2022-01-31QUIC: allowed main QUIC connection for some operations.Roman Arutyunyan2-5/+8
Operations like ngx_quic_open_stream(), ngx_http_quic_get_connection(), ngx_http_v3_finalize_connection(), ngx_http_v3_shutdown_connection() used to receive a QUIC stream connection. Now they can receive the main QUIC connection as well. This is useful when calling them from a stream context.
2022-01-26HTTP/3: removed draft versions support in ALPN.Sergey Kandaurov1-3/+0
2022-01-18QUIC: the "quic_active_connection_id_limit" directive.Vladimir Homutov1-0/+12
The directive sets corresponding transport parameter and limits number of created client ids.
2021-12-30HTTP/3: improved processing of multiple Cookie field lines.Sergey Kandaurov2-14/+152
As per draft-ietf-quic-http, 4.1.1.2, and similar to HTTP/2 specification, they ought to be concatenated. This closely follows ngx_http_v2_module.
2021-12-29Style.Roman Arutyunyan1-1/+1
2021-12-24Merged with the default branch.Ruslan Ermilov2-6/+6
2021-12-07HTTP/3: avoid sending stream cancellation for pushed streams.Sergey Kandaurov1-1/+3
2021-12-07HTTP/3: renamed files.Roman Arutyunyan5-8/+8
ngx_http_v3_tables.h and ngx_http_v3_tables.c are renamed to ngx_http_v3_table.h and ngx_http_v3_table.c to better match HTTP/2 code. ngx_http_v3_streams.h and ngx_http_v3_streams.c are renamed to ngx_http_v3_uni.h and ngx_http_v3_uni.c to better match their content.
2021-12-06QUIC: simplified configuration.Vladimir Homutov4-202/+41
Directives that set transport parameters are removed from the configuration. Corresponding values are derived from the quic configuration or initialized to default. Whenever possible, quic configuration parameters are taken from higher-level protocol settings, i.e. HTTP/3.
2021-12-01HTTP/3: $http3 variable.Roman Arutyunyan1-7/+25
A new variable $http3 is added. The variable equals to "h3" for HTTP/3 connections, "hq" for hq connections and is an empty string otherwise. The variable $quic is eliminated. The new variable is similar to $http2 variable.
2021-12-04HTTP/3: http3_hq directive and NGX_HTTP_V3_HQ macro.Roman Arutyunyan3-11/+36
Listen quic parameter is no longer supported.
2021-12-06HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.Roman Arutyunyan3-8/+556
2021-12-02HTTP/3: adjusted ALPN macro names to align with 61abb35bb8cf.Sergey Kandaurov1-1/+1
2021-10-18HTTP/3: send Stream Cancellation instruction.Roman Arutyunyan1-0/+8
As per quic-qpack-21: When a stream is reset or reading is abandoned, the decoder emits a Stream Cancellation instruction. Previously the instruction was not sent. Now it's sent when closing QUIC stream connection if dynamic table capacity is non-zero and eof was not received from client. The latter condition means that a trailers section may still be on its way from client and the stream needs to be cancelled.
2021-10-18HTTP/3: allowed QUIC stream connection reuse.Roman Arutyunyan3-23/+142
A QUIC stream connection is treated as reusable until first bytes of request arrive, which is also when the request object is now allocated. A connection closed as a result of draining, is reset with the error code H3_REQUEST_REJECTED. Such behavior is allowed by quic-http-34: Once a request stream has been opened, the request MAY be cancelled by either endpoint. Clients cancel requests if the response is no longer of interest; servers cancel requests if they are unable to or choose not to respond. When the server cancels a request without performing any application processing, the request is considered "rejected." The server SHOULD abort its response stream with the error code H3_REQUEST_REJECTED. The client can treat requests rejected by the server as though they had never been sent at all, thereby allowing them to be retried later.