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:
Amaury Denoyelle 2022-02-14 15:49:53 +01:00
parent a04724af29
commit 95b93a3a93

View File

@ -116,6 +116,7 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
size_t hlen;
uint64_t ftype, flen;
struct buffer b;
char last_stream_frame = 0;
/* Work on a copy of <rxbuf> */
b = h3_b_dup(rxbuf);
@ -129,6 +130,8 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
break;
b_del(rxbuf, hlen);
last_stream_frame = (fin && flen == b_data(rxbuf));
switch (ftype) {
case H3_FT_DATA:
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"));
if (!sl)
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);
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_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->ctx = qcs;
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);
}
if (htx) {
if (fin && !b_data(rxbuf))
htx->flags |= HTX_FL_EOM;
}
return 0;
fail: