MINOR: quic: add HTX EOM on request end

Set the HTX EOM flag on RX the app layer. This is required to notify
about the end of the request for the stream analyzers, else the request
channel never goes to MSG_DONE state.
This commit is contained in:
Amaury Denoyelle 2021-11-30 11:23:29 +01:00
parent fecfa0d822
commit db44338473
6 changed files with 13 additions and 4 deletions

View File

@ -85,7 +85,7 @@ struct qcs {
struct qcc_app_ops {
int (*init)(struct qcc *qcc);
int (*attach_ruqs)(struct qcs *qcs, void *ctx);
int (*decode_qcs)(struct qcs *qcs, void *ctx);
int (*decode_qcs)(struct qcs *qcs, int fin, void *ctx);
size_t (*snd_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags);
int (*finalize)(void *ctx);
};

View File

@ -149,6 +149,7 @@ struct quic_stream {
struct buffer *buf;
struct eb64_node offset;
uint64_t len;
int fin;
const unsigned char *data;
};

View File

@ -96,7 +96,7 @@ static inline size_t h3_decode_frm_header(uint64_t *ftype, uint64_t *flen,
/* Decode <qcs> remotely initiated bidi-stream.
* Returns <0 on error else 0.
*/
static int h3_decode_qcs(struct qcs *qcs, void *ctx)
static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
{
struct buffer *rxbuf = &qcs->rx.buf;
struct h3 *h3 = ctx;
@ -220,6 +220,9 @@ static int h3_decode_qcs(struct qcs *qcs, void *ctx)
b_del(rxbuf, flen);
}
if (fin && !b_data(rxbuf))
htx->flags |= HTX_FL_EOM;
return 0;
fail:

View File

@ -9,7 +9,7 @@
#include <haproxy/mux_quic-t.h>
#include <haproxy/stream.h>
static int hq_interop_decode_qcs(struct qcs *qcs, void *ctx)
static int hq_interop_decode_qcs(struct qcs *qcs, int fin, void *ctx)
{
struct buffer *rxbuf = &qcs->rx.buf;
struct htx *htx;
@ -54,6 +54,9 @@ static int hq_interop_decode_qcs(struct qcs *qcs, void *ctx)
b_del(rxbuf, b_data(rxbuf));
b_free(&htx_buf);
if (fin)
htx->flags |= HTX_FL_EOM;
return 0;
}

View File

@ -427,6 +427,8 @@ static int quic_parse_stream_frame(struct quic_frame *frm, struct quic_conn *qc,
else if (!quic_dec_int(&stream->len, buf, end) || end - *buf < stream->len)
return 0;
stream->fin = (frm->type & QUIC_STREAM_FRAME_TYPE_FIN_BIT);
stream->data = *buf;
*buf += stream->len;

View File

@ -2076,7 +2076,7 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
goto store_frm;
ret = qc_strm_cpy(&strm->rx.buf, strm_frm);
if (ret && qc->qcc->app_ops->decode_qcs(strm, qc->qcc->ctx) < 0) {
if (ret && qc->qcc->app_ops->decode_qcs(strm, strm_frm->fin, qc->qcc->ctx) < 0) {
TRACE_PROTO("Decoding error", QUIC_EV_CONN_PSTRM);
return 0;
}