summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-05-23QUIC: defined SSL API macros in a single place.Sergey Kandaurov1-0/+12
All definitions now set in ngx_event_quic.h, this includes moving NGX_QUIC_OPENSSL_COMPAT from autotests to compile time. Further, to improve code readability, a new NGX_QUIC_QUICTLS_API macro is used for QuicTLS that provides old BoringSSL QUIC API.
2023-09-13QUIC: "handshake_timeout" configuration parameter.Roman Arutyunyan1-1/+2
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-05-14Common tree insert function for QUIC and UDP connections.Roman Arutyunyan1-2/+0
Previously, ngx_udp_rbtree_insert_value() was used for plain UDP and ngx_quic_rbtree_insert_value() was used for QUIC. Because of this it was impossible to initialize connection tree in ngx_create_listening() since this function is not aware what kind of listening it creates. Now ngx_udp_rbtree_insert_value() is used for both QUIC and UDP. To make is possible, a generic key field is added to ngx_udp_connection_t. It keeps client address for UDP and connection ID for QUIC.
2023-05-11QUIC: removed "quic_mtu" directive.Roman Arutyunyan1-1/+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-01-10QUIC: automatically add and never delete stream events.Roman Arutyunyan1-2/+0
Previously, stream events were added and deleted by ngx_handle_read_event() and ngx_handle_write_event() in a way similar to level-triggered events. However, QUIC stream events are effectively edge-triggered and can stay active all time. Moreover, the events are now active since the moment a stream is created.
2022-11-30QUIC: application init() callback.Roman Arutyunyan1-0/+2
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-10-19QUIC: idle mode for main connection.Roman Arutyunyan1-0/+5
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-08-22QUIC: defer stream removal until all its data is acked.Roman Arutyunyan1-1/+3
Previously, stream was kept alive until all its data is sent. This resulted in disabling retransmission of final part of stream when QUIC connection was closed right after closing stream connection.
2022-11-29QUIC: reusable mode for main connection.Roman Arutyunyan1-0/+1
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-04-20QUIC: separate UDP framework for QUIC.Roman Arutyunyan1-0/+3
Previously, QUIC used the existing UDP framework, which was created for UDP in Stream. However the way QUIC connections are created and looked up is different from the way UDP connections in Stream are created and looked up. Now these two implementations are decoupled.
2022-02-17QUIC: fixed insertion at the end of buffer.Roman Arutyunyan1-1/+1
Previously, last buffer was tracked by keeping a pointer to the previous chain link "next" field. When the previous buffer was split and then removed, the pointer was no longer valid. Writing at this pointer resulted in broken data chains. Now last buffer is tracked by keeping a direct pointer to it.
2022-02-14QUIC: optimize insertion at the end of QUIC buffer.Roman Arutyunyan1-0/+2
2022-02-14QUIC: ngx_quic_buffer_t object.Roman Arutyunyan1-4/+10
The object is used instead of ngx_chain_t pointer for buffer operations like ngx_quic_write_chain() and ngx_quic_read_chain(). These functions are renamed to ngx_quic_write_buffer() and ngx_quic_read_buffer().
2022-02-05QUIC: stream lingering.Roman Arutyunyan1-1/+3
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-02-03QUIC: switch stream to DATA_RECVD state.Roman Arutyunyan1-0/+1
The switch happens when received byte counter reaches stream final size. Previously, this state was skipped. The stream went from SIZE_KNOWN to DATA_READ when all bytes were read by application. The change prevents STOP_SENDING frames from being sent when all data is received from client, but not yet fully read by application.
2022-01-31QUIC: style.Roman Arutyunyan1-35/+35
2022-01-31QUIC: introduced explicit stream states.Roman Arutyunyan1-0/+22
This allows to eliminate the usage of stream connection event flags for tracking stream state.
2022-01-26HTTP/3: removed draft versions support in ALPN.Sergey Kandaurov1-1/+0
2022-01-18QUIC: the "quic_active_connection_id_limit" directive.Vladimir Homutov1-0/+1
The directive sets corresponding transport parameter and limits number of created client ids.
2021-12-24QUIC: avoid excessive buffer allocations in stream output.Roman Arutyunyan1-0/+1
Previously, when a few bytes were send to a QUIC stream by the application, a 4K buffer was allocated for these bytes. Then a STREAM frame was created and that entire buffer was used as data for that frame. The frame with the buffer were in use up until the frame was acked by client. Meanwhile, when more bytes were send to the stream, more buffers were allocated and assigned as data to newer STREAM frames. In this scenario most buffer memory is unused. Now the unused part of the stream output buffer is available for further stream output while earlier parts of the buffer are waiting to be acked. This is achieved by splitting the output buffer.
2021-12-06QUIC: simplified configuration.Vladimir Homutov1-28/+8
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-11-11QUIC: reject streams which we could not create.Roman Arutyunyan1-0/+3
The reasons why a stream may not be created by server currently include hitting worker_connections limit and memory allocation error. Previously in these cases the entire QUIC connection was closed and all its streams were shut down. Now the new stream is rejected and existing streams continue working. To reject an HTTP/3 request stream, RESET_STREAM and STOP_SENDING with H3_REQUEST_REJECTED error code are sent to client. HTTP/3 uni streams and Stream streams are not rejected.
2021-11-03QUIC: connections with wrong ALPN protocols are now rejected.Vladimir Homutov1-1/+0
Previously, it was not enforced in the stream module. Now, since b9e02e9b2f1d it is possible to specify protocols. Since ALPN is always required, the 'require_alpn' setting is now obsolete.
2021-09-23QUIC: added shutdown support in stream proxy.Vladimir Homutov1-0/+1
2021-09-09QUIC: separate event handling functions.Roman Arutyunyan1-0/+2
The functions ngx_quic_handle_read_event() and ngx_quic_handle_write_event() are added. Previously this code was a part of ngx_handle_read_event() and ngx_handle_write_event(). The change simplifies ngx_handle_read_event() and ngx_handle_write_event() by moving QUIC-related code to a QUIC source file.
2021-08-04QUIC: client certificate validation with OCSP.Sergey Kandaurov1-0/+1
2021-07-20QUIC: the "quic_gso" directive.Vladimir Homutov1-0/+1
The directive enables usage of UDP segmentation offloading by quic. By default, gso is disabled since it is not always operational when detected (depends on interface configuration).
2021-06-07QUIC: stream flow control refactored.Roman Arutyunyan1-0/+1
- Function ngx_quic_control_flow() is introduced. This functions does both MAX_DATA and MAX_STREAM_DATA flow controls. The function is called from STREAM and RESET_STREAM frame handlers. Previously, flow control was only accounted for STREAM. Also, MAX_DATA flow control was not accounted at all. - Function ngx_quic_update_flow() is introduced. This function advances flow control windows and sends MAX_DATA/MAX_STREAM_DATA. The function is called from RESET_STREAM frame handler, stream cleanup handler and stream recv() handler.
2021-05-31HTTP/3: removed $http3 that served its purpose.Sergey Kandaurov1-4/+0
To specify final protocol version by hand: add_header Alt-Svc h3=":443";
2021-05-25QUIC: make sure stream data size is lower than final size.Roman Arutyunyan1-0/+1
As per quic-transport 34, FINAL_SIZE_ERROR is generated if an endpoint received a STREAM frame or a RESET_STREAM frame containing a final size that was lower than the size of stream data that was already received.
2021-05-25QUIC: refactored CRYPTO and STREAM buffer ordering.Roman Arutyunyan1-3/+2
Generic function ngx_quic_order_bufs() is introduced. This function creates and maintains a chain of buffers with holes. Holes are marked with b->sync flag. Several buffers and holes in this chain may share the same underlying memory buffer. When processing STREAM frames with this function, frame data is copied only once to the right place in the stream input chain. Previously data could be copied twice. First when buffering an out-of-order frame data, and then when filling stream buffer from ordered frame queue. Now there's only one data chain for both tasks.
2021-05-05QUIC: generic buffering for stream input.Roman Arutyunyan1-1/+2
Previously each stream had an input buffer. Now memory is allocated as bytes arrive. Generic buffering mechanism is used for this.
2021-04-19QUIC: renamed stream field from c to connection.Roman Arutyunyan1-1/+1
2021-04-13QUIC: normalize header inclusion.Sergey Kandaurov1-3/+2
Stop including QUIC headers with no user-serviceable parts inside. This allows to provide a much cleaner QUIC interface. To cope with that, ngx_quic_derive_key() is now explicitly exported for v3 and quic modules. Additionally, this completely hides the ngx_quic_keys_t internal type.
2021-04-13QUIC: ngx_quic_frames_stream_t made opaque.Sergey Kandaurov1-8/+2
2021-04-14QUIC: headers cleanup.Vladimir Homutov1-43/+1
The "ngx_event_quic.h" header file now contains only public definitions, used by modules. All internal definitions are moved into the "ngx_event_quic_connection.h" header file.
2021-04-02QUIC: simplified quic connection dispatching.Vladimir Homutov1-1/+2
Currently listener contains rbtree with multiple nodes for single QUIC connection: each corresponding to specific server id. Each udp node points to same ngx_connection_t, which points to QUIC connection via c->udp field. Thus when an event handler is called, it only gets ngx_connection_t with c->udp pointing to QUIC connection. This makes it hard to obtain actual node which was used to dispatch packet (it requires to repeat DCID lookup). Additionally, ngx_quic_connection_t->udp field is only needed to keep a pointer in c->udp. The node is not added into the tree and does not carry useful information.
2021-03-15QUIC: connection shutdown.Roman Arutyunyan1-0/+3
The function ngx_quic_shutdown_connection() waits until all non-cancelable streams are closed, and then closes the connection. In HTTP/3 cancelable streams are all unidirectional streams except push streams. The function is called from HTTP/3 when client reaches keepalive_requests.
2021-02-19Updated the list of supported drafts.Sergey Kandaurov1-1/+0
2021-02-17QUIC: added ability to reset a stream.Sergey Kandaurov1-0/+1
2021-02-08QUIC: the "quic_host_key" directive.Vladimir Homutov1-4/+7
The token generation in QUIC is reworked. Single host key is used to generate all required keys of needed sizes using HKDF. The "quic_stateless_reset_token_key" directive is removed. Instead, the "quic_host_key" directive is used, which reads key from file, or sets it to random bytes if not specified.
2021-01-29QUIC: stateless retry.Vladimir Homutov1-6/+6
Previously, quic connection object was created when Retry packet was sent. This is neither necessary nor convenient, and contradicts the idea of retry: protecting from bad clients and saving server resources. Now, the connection is not created, token is verified cryptographically instead of holding it in connection.
2020-12-25QUIC: moved all quic sources into src/event/quic.Vladimir Homutov1-0/+143