mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-29 17:51:22 +02:00
MINOR: h3: set properly HTX EOM/BODYLESS on HEADERS parsing
Adjust the method to detect that a H3 HEADERS frame is the last one of the stream. If this is true, the flags EOM and BODYLESS must be set on the HTX message.
This commit is contained in:
parent
a04724af29
commit
95b93a3a93
16
src/h3.c
16
src/h3.c
@ -116,6 +116,7 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
|
|||||||
size_t hlen;
|
size_t hlen;
|
||||||
uint64_t ftype, flen;
|
uint64_t ftype, flen;
|
||||||
struct buffer b;
|
struct buffer b;
|
||||||
|
char last_stream_frame = 0;
|
||||||
|
|
||||||
/* Work on a copy of <rxbuf> */
|
/* Work on a copy of <rxbuf> */
|
||||||
b = h3_b_dup(rxbuf);
|
b = h3_b_dup(rxbuf);
|
||||||
@ -129,6 +130,8 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
b_del(rxbuf, hlen);
|
b_del(rxbuf, hlen);
|
||||||
|
last_stream_frame = (fin && flen == b_data(rxbuf));
|
||||||
|
|
||||||
switch (ftype) {
|
switch (ftype) {
|
||||||
case H3_FT_DATA:
|
case H3_FT_DATA:
|
||||||
break;
|
break;
|
||||||
@ -175,7 +178,10 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
|
|||||||
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, path, ist("HTTP/3.0"));
|
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, path, ist("HTTP/3.0"));
|
||||||
if (!sl)
|
if (!sl)
|
||||||
goto fail;
|
goto fail;
|
||||||
sl->flags |= HTX_SL_F_BODYLESS;
|
|
||||||
|
if (last_stream_frame)
|
||||||
|
sl->flags |= HTX_SL_F_BODYLESS;
|
||||||
|
|
||||||
sl->info.req.meth = find_http_meth(meth.ptr, meth.len);
|
sl->info.req.meth = find_http_meth(meth.ptr, meth.len);
|
||||||
BUG_ON(sl->info.req.meth == HTTP_METH_OTHER);
|
BUG_ON(sl->info.req.meth == HTTP_METH_OTHER);
|
||||||
|
|
||||||
@ -197,6 +203,9 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
|
|||||||
htx_add_endof(htx, HTX_BLK_EOH);
|
htx_add_endof(htx, HTX_BLK_EOH);
|
||||||
htx_to_buf(htx, &htx_buf);
|
htx_to_buf(htx, &htx_buf);
|
||||||
|
|
||||||
|
if (last_stream_frame)
|
||||||
|
htx->flags |= HTX_FL_EOM;
|
||||||
|
|
||||||
cs = cs_new(qcs->qcc->conn, qcs->qcc->conn->target);
|
cs = cs_new(qcs->qcc->conn, qcs->qcc->conn->target);
|
||||||
cs->ctx = qcs;
|
cs->ctx = qcs;
|
||||||
stream_create_from_cs(cs, &htx_buf);
|
stream_create_from_cs(cs, &htx_buf);
|
||||||
@ -220,11 +229,6 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
|
|||||||
b_del(rxbuf, flen);
|
b_del(rxbuf, flen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (htx) {
|
|
||||||
if (fin && !b_data(rxbuf))
|
|
||||||
htx->flags |= HTX_FL_EOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user