mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-01 09:00:51 +00:00
MINOR: muxes/htx: Ignore pseudo header during message formatting
When an HTX message is formatted to an H1 or H2 message, pseudo-headers (with header names starting by a colon (':')) are now ignored. In fact, for now, only H2 messages have such headers, and the H2 mux already skips them when it creates the HTX message. But in the futur, it may be useful to keep these headers in the HTX message to help the message analysis or to do some processing during the HTTP formatting. It would also be a good idea to have scopes for pseudo-headers (:h1-, :h2-, :fcgi-...) to limit their usage to a specific mux.
This commit is contained in:
parent
cc3124cf44
commit
86d144c74b
@ -1270,6 +1270,10 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
|
||||
n = htx_get_blk_name(chn_htx, blk);
|
||||
v = htx_get_blk_value(chn_htx, blk);
|
||||
|
||||
/* Skip all pseudo-headers */
|
||||
if (*(n.ptr) == ':')
|
||||
goto skip_hdr;
|
||||
|
||||
if (isteqi(n, ist("transfer-encoding")))
|
||||
h1_parse_xfer_enc_header(h1m, v);
|
||||
else if (isteqi(n, ist("content-length"))) {
|
||||
|
12
src/mux_h2.c
12
src/mux_h2.c
@ -4525,6 +4525,10 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, struct htx *htx)
|
||||
isteq(list[hdr].n, ist("transfer-encoding")))
|
||||
continue;
|
||||
|
||||
/* Skip all pseudo-headers */
|
||||
if (*(list[hdr].n.ptr) == ':')
|
||||
continue;
|
||||
|
||||
if (isteq(list[hdr].n, ist("")))
|
||||
break; // end
|
||||
|
||||
@ -4793,6 +4797,10 @@ static size_t h2s_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
|
||||
isteq(list[hdr].n, ist("transfer-encoding")))
|
||||
continue;
|
||||
|
||||
/* Skip all pseudo-headers */
|
||||
if (*(list[hdr].n.ptr) == ':')
|
||||
continue;
|
||||
|
||||
if (isteq(list[hdr].n, ist("")))
|
||||
break; // end
|
||||
|
||||
@ -5263,6 +5271,10 @@ static size_t h2s_make_trailers(struct h2s *h2s, struct htx *htx)
|
||||
isteq(list[idx].n, ist("transfer-encoding")))
|
||||
continue;
|
||||
|
||||
/* Skip all pseudo-headers */
|
||||
if (*(list[idx].n.ptr) == ':')
|
||||
continue;
|
||||
|
||||
if (!hpack_encode_header(&outbuf, list[idx].n, list[idx].v)) {
|
||||
/* output full */
|
||||
if (b_space_wraps(mbuf))
|
||||
|
Loading…
Reference in New Issue
Block a user