diff --git a/src/h3.c b/src/h3.c index ea512a404..616110b72 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1626,7 +1626,7 @@ static int h3_close(struct qcs *qcs, enum qcc_app_ops_close_side side) * control stream is closed at any point, this MUST be treated * as a connection error of type H3_CLOSED_CRITICAL_STREAM. */ - if (qcs == h3c->ctrl_strm) { + if (qcs == h3c->ctrl_strm || h3s->type == H3S_T_CTRL) { TRACE_ERROR("closure detected on control stream", H3_EV_H3S_END, qcs->qcc, qcs); qcc_emit_cc_app(qcs->qcc, H3_CLOSED_CRITICAL_STREAM, 1); return 1; diff --git a/src/mux_quic.c b/src/mux_quic.c index cae22df1f..98737367e 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1155,6 +1155,13 @@ int qcc_recv_reset_stream(struct qcc *qcc, uint64_t id, uint64_t err, uint64_t f TRACE_PROTO("receiving RESET_STREAM", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs); qcs_idle_open(qcs); + if (qcc->app_ops->close) { + if (qcc->app_ops->close(qcs, QCC_APP_OPS_CLOSE_SIDE_RD)) { + TRACE_ERROR("closure rejected by app layer", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs); + goto out; + } + } + if (qcs->rx.offset_max > final_size || ((qcs->flags & QC_SF_SIZE_KNOWN) && qcs->rx.offset_max != final_size)) { TRACE_ERROR("final size error on RESET_STREAM", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);