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.
diff --git a/src/h3.c b/src/h3.c
index 987dc05..6616db6 100644
--- a/src/h3.c
+++ b/src/h3.c
@@ -116,6 +116,7 @@
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 @@
break;
b_del(rxbuf, hlen);
+ last_stream_frame = (fin && flen == b_data(rxbuf));
+
switch (ftype) {
case H3_FT_DATA:
break;
@@ -175,7 +178,10 @@
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 @@
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 @@
b_del(rxbuf, flen);
}
- if (htx) {
- if (fin && !b_data(rxbuf))
- htx->flags |= HTX_FL_EOM;
- }
-
return 0;
fail: