]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: h2: add a function to emit an HTTP/1 request from a headers list
authorWilly Tarreau <w@1wt.eu>
Tue, 21 Nov 2017 18:55:27 +0000 (19:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Nov 2017 20:13:33 +0000 (21:13 +0100)
commitf24ea8e45e0242cc6a05d3c6bcbc825fd4c7d8b7
tree26e09e228b65a46f4052855ddf63d7d58bbb8cef
parent8f650c369dbe1d6db3538c8fd16ace636c571fea
MEDIUM: h2: add a function to emit an HTTP/1 request from a headers list

The current H2 to H1 protocol conversion presents some issues which will
require to perform some processing on certain headers before writing them
so it's not possible to convert HPACK to H1 on the fly.

Here we introduce a function which performs half of what hpack_decode_header()
used to do, which is to take a list of headers on input and emit the
corresponding request in HTTP/1.1 format. The code is the same and functions
were renamed to be prefixed with "h2" instead of "hpack", though it ends
up being simpler as the various HPACK-specific cases could be fused into
a single one (ie: add header).

Moving this part here makes a lot of sense as now this code is specific to
what is documented in HTTP/2 RFC 7540 and will be able to deal with special
cases related to H2 to H1 conversion enumerated in section 8.1.

Various error codes which were previously assigned to HPACK were never
used (aside being negative) and were all replaced by -1 with a comment
indicating what error was detected. The code could be further factored
thanks to this but this commit focuses on compatibility first.

This code is not yet used but builds fine.
Makefile
include/common/h2.h
src/h2.c [new file with mode: 0644]