MINOR: channel/htx: Add function to forward headers of an HTX message

The function channel_htx_fwd_headers() should now be used by HTX analyzers to
forward all headers of an HTX message, from the start-line to the corresponding
EOH. It takes care to update the star-line position.
This commit is contained in:
Christopher Faulet 2019-05-23 10:01:34 +02:00 committed by Willy Tarreau
parent b75b5eaf26
commit b2f4e83a28

View File

@ -910,6 +910,26 @@ static inline void channel_slow_realign(struct channel *chn, char *swap)
return b_slow_realign(&chn->buf, swap, co_data(chn));
}
/* Forward all headers of an HTX message, starting from the SL to the EOH. This
* function also updates the start-line position.
*/
static inline void channel_htx_fwd_headers(struct channel *chn, struct htx *htx)
{
int32_t pos;
size_t data = 0;
for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
struct htx_blk *blk = htx_get_blk(htx, pos);
data += htx_get_blksz(blk);
if (htx_get_blk_type(blk) == HTX_BLK_EOH) {
htx->sl_pos = htx_get_next(htx, pos);
break;
}
}
c_adv(chn, data);
}
/*
* Advance the channel buffer's read pointer by <len> bytes. This is useful
* when data have been read directly from the buffer. It is illegal to call