MINOR: muxes/h1-htx: Realign input buffer using b_slow_realign_ofs()

Input buffers have never output data. So, use b_slow_realign_ofs() function
instead of b_slow_realign(). It is a slighly simpler function. And in the H1
mux, it allows a realign by setting the input buffer head to permit
zero-copies.
This commit is contained in:
Christopher Faulet 2021-02-04 11:01:51 +01:00
parent 4fc51a73e6
commit 00d7cde551
3 changed files with 5 additions and 5 deletions

View File

@ -319,7 +319,7 @@ size_t h1_parse_msg_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx *dsthtx,
/* Realing input buffer if necessary */
if (b_head(srcbuf) + b_data(srcbuf) > b_wrap(srcbuf))
b_slow_realign(srcbuf, trash.area, 0);
b_slow_realign_ofs(srcbuf, trash.area, 0);
if (!h1sl) {
/* If there no start-line, be sure to only parse the headers */
@ -857,7 +857,7 @@ size_t h1_parse_msg_tlrs(struct h1m *h1m, struct htx *dsthtx,
/* Realing input buffer if necessary */
if (b_peek(srcbuf, ofs) > b_tail(srcbuf))
b_slow_realign(srcbuf, trash.area, 0);
b_slow_realign_ofs(srcbuf, trash.area, 0);
tlr_h1m.flags = (H1_MF_NO_PHDR|H1_MF_HDRS_ONLY);
ret = h1_headers_to_hdr_list(b_peek(srcbuf, ofs), b_tail(srcbuf),

View File

@ -1623,7 +1623,7 @@ static int fcgi_conn_handle_values_result(struct fcgi_conn *fconn)
* at this stage because it should be the first record received
* from the FCGI application.
*/
b_slow_realign(dbuf, trash.area, 0);
b_slow_realign_ofs(dbuf, trash.area, 0);
}
inbuf = b_make(b_head(dbuf), b_data(dbuf), 0, fconn->drl);
@ -2488,7 +2488,7 @@ static int fcgi_strm_handle_end_request(struct fcgi_conn *fconn, struct fcgi_str
* at this stage because it should be the first record received
* from the FCGI application.
*/
b_slow_realign(dbuf, trash.area, 0);
b_slow_realign_ofs(dbuf, trash.area, 0);
}
inbuf = b_make(b_head(dbuf), b_data(dbuf), 0, fconn->drl);

View File

@ -2519,7 +2519,7 @@ static int h1_recv(struct h1c *h1c)
* it's probably cheaper than doing 2 recv() calls.
*/
if (b_data(&h1c->ibuf) > 0 && b_data(&h1c->ibuf) < 128)
b_slow_realign(&h1c->ibuf, trash.area, 0);
b_slow_realign_ofs(&h1c->ibuf, trash.area, sizeof(struct htx));
/* avoid useless reads after first responses */
if (!h1c->h1s ||