diff --git a/src/h3.c b/src/h3.c index fdad3b068..e0a1233d5 100644 --- a/src/h3.c +++ b/src/h3.c @@ -2123,6 +2123,15 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx) goto err_full; } + if (!(sl->flags & HTX_SL_F_XFER_LEN)) { + /* Extra care required for HTTP/1 responses without Content-Length nor + * chunked encoding. In this case, shutw callback will be use to signal + * the end of the message. QC_SF_UNKNOWN_PL_LENGTH is set to prevent a + * RESET_STREAM emission in this case. + */ + qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; + } + /* Encode every parsed headers, stop at empty one. */ for (hdr = 0; hdr < sizeof(list) / sizeof(list[0]); ++hdr) { if (isteq(list[hdr].n, ist(""))) @@ -2307,6 +2316,15 @@ static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx) goto err_full; } + if (!(sl->flags & HTX_SL_F_XFER_LEN)) { + /* Extra care required for HTTP/1 responses without Content-Length nor + * chunked encoding. In this case, shutw callback will be use to signal + * the end of the message. QC_SF_UNKNOWN_PL_LENGTH is set to prevent a + * RESET_STREAM emission in this case. + */ + qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; + } + for (hdr = 0; hdr < sizeof(list) / sizeof(list[0]); ++hdr) { if (isteq(list[hdr].n, ist(""))) break; diff --git a/src/qmux_http.c b/src/qmux_http.c index 9a310a397..552e16821 100644 --- a/src/qmux_http.c +++ b/src/qmux_http.c @@ -95,23 +95,10 @@ int qcs_http_handle_standalone_fin(struct qcs *qcs) size_t qcs_http_snd_buf(struct qcs *qcs, struct buffer *buf, size_t count, char *fin) { - struct htx *htx; size_t ret; TRACE_ENTER(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs); - - htx = htxbuf(buf); - - /* Extra care required for HTTP/1 responses without Content-Length nor - * chunked encoding. In this case, shutw callback will be use to signal - * the end of the message. QC_SF_UNKNOWN_PL_LENGTH is set to prevent a - * RESET_STREAM emission in this case. - */ - if (htx->extra && htx->extra == HTX_UNKOWN_PAYLOAD_LENGTH) - qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH; - ret = qcs->qcc->app_ops->snd_buf(qcs, buf, count, fin); - TRACE_LEAVE(QMUX_EV_STRM_SEND, qcs->qcc->conn, qcs); return ret;