MINOR: h3: extend function for QUIC varint encoding
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 17 Jan 2023 14:21:16 +0000 (15:21 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 19 Jan 2023 14:09:01 +0000 (15:09 +0100)
commit7d78eff88928fd5fa4a7b49cc280470673dc6e16
tree639068feb54716b2a4847ab1bcb02a852c83551a
parent8ad2669175f9a727009a45e6f7738e7dc62606fc
MINOR: h3: extend function for QUIC varint encoding

Slighty adjust b_quic_enc_int(). This function is used to encode an
integer as a QUIC varint in a struct buffer.

A new parameter is added to the function API to specify the width of the
encoded integer. By default, 0 should be use to ensure that the minimum
space is used. Other valid values are 1, 2, 4 or 8. An error is reported
if the width is not large enough.

This new parameter will be useful when buffer space is reserved prior to
encode an unknown integer value. The maximum size of 8 bytes will be
reserved and some data can be put after. When finally encoding the
integer, the width can be requested to be 8 bytes.

With this new parameter, a small refactoring of the function has been
conducted to remove some useless internal variables.

This should be backported up to 2.7. It will be mostly useful to
implement H3 trailers encoding.
include/haproxy/quic_enc.h
src/h3.c