mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
MINOR: channel/htx: Add functions to forward a part or all HTX payload
The functions channel_htx_fwd_payload() and channel_htx_fwd_all() should now be used to forward, respectively, a part of the HTX payload or all of it. These functions forward data and update the first block position.
This commit is contained in:
parent
8fa60e4613
commit
dab5ab551d
@ -912,7 +912,7 @@ static inline void channel_slow_realign(struct channel *chn, char *swap)
|
|||||||
|
|
||||||
|
|
||||||
/* Forward all headers of an HTX message, starting from the SL to the EOH. This
|
/* Forward all headers of an HTX message, starting from the SL to the EOH. This
|
||||||
* function also updates the start-line position.
|
* function also updates the first block position.
|
||||||
*/
|
*/
|
||||||
static inline void channel_htx_fwd_headers(struct channel *chn, struct htx *htx)
|
static inline void channel_htx_fwd_headers(struct channel *chn, struct htx *htx)
|
||||||
{
|
{
|
||||||
@ -930,6 +930,33 @@ static inline void channel_htx_fwd_headers(struct channel *chn, struct htx *htx)
|
|||||||
c_adv(chn, data);
|
c_adv(chn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forward <data> bytes of payload of an HTX message. This function also updates
|
||||||
|
* the first block position.
|
||||||
|
*/
|
||||||
|
static inline void channel_htx_fwd_payload(struct channel *chn, struct htx *htx, size_t data)
|
||||||
|
{
|
||||||
|
int32_t pos;
|
||||||
|
|
||||||
|
c_adv(chn, data);
|
||||||
|
for (pos = htx_get_first(htx); pos != -1; pos = htx_get_next(htx, pos)) {
|
||||||
|
uint32_t sz = htx_get_blksz(htx_get_blk(htx, pos));
|
||||||
|
|
||||||
|
if (data < sz)
|
||||||
|
break;
|
||||||
|
data -= sz;
|
||||||
|
}
|
||||||
|
htx->first = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forward all data of an HTX message. This function also updates the first
|
||||||
|
* block position.
|
||||||
|
*/
|
||||||
|
static inline void channel_htx_fwd_all(struct channel *chn, struct htx *htx)
|
||||||
|
{
|
||||||
|
htx->first = -1;
|
||||||
|
c_adv(chn, htx->data - co_data(chn));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Advance the channel buffer's read pointer by <len> bytes. This is useful
|
* 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
|
* when data have been read directly from the buffer. It is illegal to call
|
||||||
|
Loading…
Reference in New Issue
Block a user