In stats_putchk(), the current chunk is added to the HTX message with
htx_add_data_atonce(), without checking the chunk is not empty. If the
chunk is empty when the function is called, a zero-sized DATA block is
added to the HTX message. For a chunked response, mux-h1 would emit a
zero-sized chunk, i.e. the last-chunk, prematurely ending the message
for the client and making it interpret any remaining data as a new
message (response splitting).
No way was found to make a stats dump produce an empty chunk, so this
is a latent bug, but the HTX API is not supposed to accept empty data
blocks and the consequence would be dramatic. So, let's simply skip the
add when the chunk is empty. It also avoids stats_putchk() to wrongly
report a full buffer once the HTX API starts to refuse empty data.
This may be backported if desired.
applet_fl_set(appctx, APPCTX_FL_OUTBLK_FULL);
return 0;
}
- if (!htx_add_data_atonce(htx, ist2(b_orig(chk), b_data(chk)))) {
+ if (b_data(chk) && !htx_add_data_atonce(htx, ist2(b_orig(chk), b_data(chk)))) {
applet_fl_set(appctx, APPCTX_FL_OUTBLK_FULL);
return 0;
}