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.
diff --git a/include/proto/channel.h b/include/proto/channel.h
index b53e177..077b3ae 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -910,6 +910,26 @@
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