mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-27 14:41:28 +01:00
MINOR: h3/qmux: Set QC_SF_UNKNOWN_PL_LENGTH flag on QCS when headers are sent
QC_SF_UNKNOWN_PL_LENGTH flag is set on the qcs to know a payload of message has an unknown length and not send a RESET_STREAM on shutdown. This flag was based on the HTX extra field value. However, it is not necessary. When headers are processed, before sending them, it is possible to check the HTX start-line to know if the length of the payload is known or not. So let's do so and don't use anymore the HTX extra field for this purpose.
This commit is contained in:
parent
00b27a993f
commit
586511c278
18
src/h3.c
18
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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user