mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-12 16:59:48 +00:00
MINOR: mux-h1: Allow partial data consumption during outgoing data processing
In h1_process_output(), instead of waiting to have enough data to send to consume a full block of data, we are now able consume partially these blocks.
This commit is contained in:
parent
aa75b3d2d5
commit
b2e841681a
26
src/mux_h1.c
26
src/mux_h1.c
@ -1337,15 +1337,21 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
|
||||
tmp->size = b_room(&h1c->obuf);
|
||||
|
||||
blk = htx_get_head_blk(chn_htx);
|
||||
while (!(h1s->flags & errflag) && blk) {
|
||||
while (count && !(h1s->flags & errflag) && blk) {
|
||||
struct htx_sl *sl;
|
||||
struct ist n, v;
|
||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
||||
uint32_t sz = htx_get_blksz(blk);
|
||||
uint32_t vlen;
|
||||
|
||||
if (total + sz > count)
|
||||
goto copy;
|
||||
vlen = sz;
|
||||
if (vlen > count) {
|
||||
if (type != HTX_BLK_DATA && type != HTX_BLK_TLR)
|
||||
goto copy;
|
||||
vlen = count;
|
||||
}
|
||||
|
||||
switch (htx_get_blk_type(blk)) {
|
||||
switch (type) {
|
||||
case HTX_BLK_UNUSED:
|
||||
break;
|
||||
|
||||
@ -1426,6 +1432,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
|
||||
|
||||
case HTX_BLK_DATA:
|
||||
v = htx_get_blk_value(chn_htx, blk);
|
||||
v.len = vlen;
|
||||
if (!htx_data_to_h1(v, tmp, !!(h1m->flags & H1_MF_CHNK)))
|
||||
goto copy;
|
||||
break;
|
||||
@ -1444,6 +1451,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
|
||||
h1s->flags |= H1S_F_HAVE_EOD;
|
||||
}
|
||||
v = htx_get_blk_value(chn_htx, blk);
|
||||
v.len = vlen;
|
||||
if (!htx_trailer_to_h1(v, tmp))
|
||||
goto copy;
|
||||
h1s->flags |= H1S_F_HAVE_TLR;
|
||||
@ -1475,8 +1483,14 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
|
||||
h1m->flags |= errflag;
|
||||
break;
|
||||
}
|
||||
total += sz;
|
||||
blk = htx_remove_blk(chn_htx, blk);
|
||||
total += vlen;
|
||||
count -= vlen;
|
||||
if (sz == vlen)
|
||||
blk = htx_remove_blk(chn_htx, blk);
|
||||
else {
|
||||
htx_cut_data_blk(chn_htx, blk, vlen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
copy:
|
||||
|
Loading…
Reference in New Issue
Block a user