diff --git a/src/http_htx.c b/src/http_htx.c index a8c87b766..21a5b57f4 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -183,6 +183,10 @@ int http_add_header(struct htx *htx, const struct ist n, const struct ist v) blk = pblk; } + + if (htx_get_blk_pos(htx, blk) != htx->front) + htx_defrag(htx, NULL); + return 1; } diff --git a/src/htx.c b/src/htx.c index de879260a..24e387eed 100644 --- a/src/htx.c +++ b/src/htx.c @@ -841,6 +841,10 @@ struct htx_blk *htx_add_data_before(struct htx *htx, const struct htx_blk *ref, break; blk = pblk; } + + if (htx_get_blk_pos(htx, blk) != htx->front) + htx_defrag(htx, NULL); + return blk; }