]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: quic: simplify length calculation for STREAM/CRYPTO frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 12 Feb 2025 09:55:51 +0000 (10:55 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 12 Feb 2025 10:51:09 +0000 (11:51 +0100)
commit731340afbdbc6e2aacac57f8bb73de79fd372ef1
treeae65576fa6cf38e85f0e6604cceb78d88d3f2070
parente6a223542ae87880b3e8261daffbe362730f9e55
MINOR: quic: simplify length calculation for STREAM/CRYPTO frames

STREAM and CRYPTO frames have a similar encoding format. In particular,
both of them have a variable-length integer Length field just before the
frame payload.

It is complex to determine the optimal Length value before copying the
payload data in the remaining buffer space. As such, helper functions
were implemented to calculate this. However, CRYPTO and STREAM frames
encoding implementation were not completely aligned, which renders the
code harder to follow.

The purpose of this commit is to simplify CRYPTO and STREAM frames
encoding. First, a new helper quic_int_cap_length() is defined which is
useful to determine the optimal buffer room available if prefixed by a
variable-length integer as Length field. Then, processing of both CRYPTO
and STREAM frames is now nearly identical, based on this new helper
function. Functions max_available_room() and max_stream_data_size() are
now unused and are removed.
include/haproxy/quic_enc.h
src/quic_tx.c