MINOR: mux-h1: Set hdrs_bytes on the SL when an HTX message is produced

This commit is contained in:
Christopher Faulet 2019-05-15 15:54:39 +02:00 committed by Willy Tarreau
parent 33543e73a2
commit a39d8ad086

View File

@ -956,9 +956,11 @@ static void h1_handle_1xx_response(struct h1s *h1s, struct h1m *h1m)
static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *htx, static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *htx,
struct buffer *buf, size_t *ofs, size_t max) struct buffer *buf, size_t *ofs, size_t max)
{ {
struct htx_sl *sl;
struct http_hdr hdrs[MAX_HTTP_HDR]; struct http_hdr hdrs[MAX_HTTP_HDR];
union h1_sl h1sl; union h1_sl h1sl;
unsigned int flags = HTX_SL_F_NONE; unsigned int flags = HTX_SL_F_NONE;
size_t used;
int ret = 0; int ret = 0;
if (!max || !b_data(buf)) if (!max || !b_data(buf))
@ -1065,9 +1067,8 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h
flags |= HTX_SL_F_BODYLESS; flags |= HTX_SL_F_BODYLESS;
} }
used = htx_used_space(htx);
if (!(h1m->flags & H1_MF_RESP)) { if (!(h1m->flags & H1_MF_RESP)) {
struct htx_sl *sl;
if (h1_eval_htx_req_size(h1m, &h1sl, hdrs) > max) if (h1_eval_htx_req_size(h1m, &h1sl, hdrs) > max)
goto error; goto error;
@ -1077,8 +1078,6 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h
sl->info.req.meth = h1s->meth; sl->info.req.meth = h1s->meth;
} }
else { else {
struct htx_sl *sl;
if (h1_eval_htx_res_size(h1m, &h1sl, hdrs) > max) if (h1_eval_htx_res_size(h1m, &h1sl, hdrs) > max)
goto error; goto error;
@ -1089,6 +1088,10 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h
sl->info.res.status = h1s->status; sl->info.res.status = h1s->status;
} }
/* Set bytes used in the HTX mesage for the headers now */
sl->hdrs_bytes = htx_used_space(htx) - used;
if (h1m->state == H1_MSG_DONE) { if (h1m->state == H1_MSG_DONE) {
if (!htx_add_endof(htx, HTX_BLK_EOM)) if (!htx_add_endof(htx, HTX_BLK_EOM))
goto error; goto error;