mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
MINOR: h3: adjust path request encoding
Previously, HTTP/3 backend request :path was hardcoded to value '/'. Change this so that we can now encode any path as requested by the client. Path is extracted from the HTX URI. Also, qpack_encode_path() is extended to support literal field line with name ref.
This commit is contained in:
parent
235e818fa1
commit
96183abfbd
2
src/h3.c
2
src/h3.c
@ -1794,7 +1794,7 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx)
|
||||
if (qpack_encode_scheme(&headers_buf, scheme))
|
||||
goto err;
|
||||
|
||||
if (qpack_encode_path(&headers_buf, ist('/')))
|
||||
if (qpack_encode_path(&headers_buf, uri))
|
||||
goto err;
|
||||
|
||||
/* :authority */
|
||||
|
@ -206,6 +206,8 @@ int qpack_encode_scheme(struct buffer *out, const struct ist scheme)
|
||||
/* Returns 0 on success else non-zero. */
|
||||
int qpack_encode_path(struct buffer *out, const struct ist path)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (unlikely(isteq(path, ist("/")))) {
|
||||
if (!b_room(out))
|
||||
return 1;
|
||||
@ -214,8 +216,15 @@ int qpack_encode_path(struct buffer *out, const struct ist path)
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
/* TODO */
|
||||
ABORT_NOW();
|
||||
sz = 1 + qpack_get_prefix_int_size(istlen(path), 7) + istlen(path);
|
||||
if (b_room(out) < sz)
|
||||
return 1;
|
||||
|
||||
qpack_encode_prefix_integer(out, 1, 4, 0x50);
|
||||
qpack_encode_prefix_integer(out, istlen(path), 7, 0);
|
||||
for (size_t i = 0; i < istlen(path); ++i)
|
||||
b_putchr(out, istptr(path)[i]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user