Skip to content

Commit c2638c8

Browse files
committed
MINOR: hq_interop: do not rely on stream layer for HTX stline encoding
HTTP/0.9 is a simple protocol. The response only contains the body without any status line nor header. An HTX start line must be built when transcoding the message for haproxy stream layer on the first invocation of rcv_buf() callback. Previously, this condition was detected by using an access to the stream object. However, it's possible to rely only on the QCS by checking the value from <rx.offset> field. This is a better solution which completely remove the superfluous dependency between hq-interop and the stream layer.
1 parent 0a98fdb commit c2638c8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/hq_interop.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
115115
struct htx *htx;
116116
struct htx_sl *sl;
117117
struct buffer *htx_buf;
118-
const struct stream *strm = __sc_strm(qcs->sd->sc);
119118
const unsigned int flags = HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN;
120119
size_t to_copy = b_data(b);
121120
size_t htx_sent = 0;
@@ -125,7 +124,7 @@ static ssize_t hq_interop_rcv_buf_res(struct qcs *qcs, struct buffer *b, int fin
125124
BUG_ON(!htx_buf);
126125
htx = htx_from_buf(htx_buf);
127126

128-
if (htx_is_empty(htx) && !strm->scb->bytes_in) {
127+
if (htx_is_empty(htx) && !qcs->rx.offset) {
129128
/* First data transfer, add HTX response start-line first. */
130129
sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags,
131130
ist("HTTP/1.0"), ist("200"), ist(""));

0 commit comments

Comments
 (0)