mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 16:17:09 +02:00
MINOR: mux-h2: Slightly improve request HEADERS frames sending
In h2s_bck_make_req_headers() function, in the loop on the HTX blocks, the most common blocks, the headers, are now handled in first, before the start-line. The same change was already performed on the response HEADERS frames. Thus the code is more consistent now.
This commit is contained in:
parent
564981369b
commit
c29b4bf946
26
src/mux_h2.c
26
src/mux_h2.c
@ -5179,19 +5179,7 @@ static size_t h2s_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
|
|||||||
if (type == HTX_BLK_EOH)
|
if (type == HTX_BLK_EOH)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (type == HTX_BLK_REQ_SL) {
|
if (type == HTX_BLK_HDR) {
|
||||||
BUG_ON(sl); /* Only one start-line expected */
|
|
||||||
sl = htx_get_blk_ptr(htx, blk);
|
|
||||||
meth = htx_sl_req_meth(sl);
|
|
||||||
uri = htx_sl_req_uri(sl);
|
|
||||||
if (sl->info.req.meth == HTTP_METH_HEAD)
|
|
||||||
h2s->flags |= H2_SF_BODYLESS_RESP;
|
|
||||||
if (unlikely(uri.len == 0)) {
|
|
||||||
TRACE_ERROR("no URI in HTX request", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (type == HTX_BLK_HDR) {
|
|
||||||
BUG_ON(!sl); /* The start-line mut be defined before any headers */
|
BUG_ON(!sl); /* The start-line mut be defined before any headers */
|
||||||
if (unlikely(hdr >= sizeof(list)/sizeof(list[0]) - 1)) {
|
if (unlikely(hdr >= sizeof(list)/sizeof(list[0]) - 1)) {
|
||||||
TRACE_ERROR("too many headers", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
TRACE_ERROR("too many headers", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
||||||
@ -5241,6 +5229,18 @@ static size_t h2s_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
|
|||||||
|
|
||||||
hdr++;
|
hdr++;
|
||||||
}
|
}
|
||||||
|
else if (type == HTX_BLK_REQ_SL) {
|
||||||
|
BUG_ON(sl); /* Only one start-line expected */
|
||||||
|
sl = htx_get_blk_ptr(htx, blk);
|
||||||
|
meth = htx_sl_req_meth(sl);
|
||||||
|
uri = htx_sl_req_uri(sl);
|
||||||
|
if (sl->info.req.meth == HTTP_METH_HEAD)
|
||||||
|
h2s->flags |= H2_SF_BODYLESS_RESP;
|
||||||
|
if (unlikely(uri.len == 0)) {
|
||||||
|
TRACE_ERROR("no URI in HTX request", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
TRACE_ERROR("will not encode unexpected htx block", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
TRACE_ERROR("will not encode unexpected htx block", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
Reference in New Issue
Block a user