*/
int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *msgf, unsigned long long *body_len, int relaxed)
{
- struct htx_blk *tailblk = htx_get_tail_blk(htx);
+ uint32_t data_ofs = htx->data; /* used to rollback on error */
struct ist phdr_val[H2_PHDR_NUM_ENTRIES];
uint32_t fields; /* bit mask of H2_PHDR_FND_* */
uint32_t idx;
return ret;
fail:
- htx_truncate_blk(htx, tailblk);
+ /* Rollback the partial conversion. Note that a pointer on the tail
+ * block cannot be used for this because it encodes a block position
+ * and adding blocks may compact the block table, so rely on the
+ * amount of data that was present on entry instead.
+ */
+ htx_truncate(htx, data_ofs);
return -1;
}
*/
int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *msgf, unsigned long long *body_len, char *upgrade_protocol)
{
- struct htx_blk *tailblk = htx_get_tail_blk(htx);
+ uint32_t data_ofs = htx->data; /* used to rollback on error */
struct ist phdr_val[H2_PHDR_NUM_ENTRIES];
uint32_t fields; /* bit mask of H2_PHDR_FND_* */
uint32_t idx;
return ret;
fail:
- htx_truncate_blk(htx, tailblk);
+ /* Rollback the partial conversion. Note that a pointer on the tail
+ * block cannot be used for this because it encodes a block position
+ * and adding blocks may compact the block table, so rely on the
+ * amount of data that was present on entry instead.
+ */
+ htx_truncate(htx, data_ofs);
return -1;
}
*/
int h2_make_htx_trailers(struct http_hdr *list, struct htx *htx)
{
- struct htx_blk *tailblk = htx_get_tail_blk(htx);
+ uint32_t data_ofs = htx->data; /* used to rollback on error */
const char *ctl;
struct ist v;
uint32_t idx;
return 1;
fail:
- htx_truncate_blk(htx, tailblk);
+ /* Rollback the partial conversion. Note that a pointer on the tail
+ * block cannot be used for this because it encodes a block position
+ * and adding blocks may compact the block table, so rely on the
+ * amount of data that was present on entry instead.
+ */
+ htx_truncate(htx, data_ofs);
return -1;
}