CLEANUP: htx: Remove unsued hdrs_bytes field from the HTX start-line

Thanks to the htx_xfer_blks() refactoring, it is now possible to remove
hdrs_bytes field from the start-line because no function rely on it anymore.
This commit is contained in:
Christopher Faulet 2021-04-22 09:50:14 +02:00
parent c92ec0ba71
commit 2b78f0bfc4
5 changed files with 0 additions and 24 deletions

View File

@ -187,10 +187,6 @@ struct htx_sl {
/* XXX 2 bytes unused */
int32_t hdrs_bytes; /* Bytes held by all headers, as seen by the mux
* during parsing, from this start-line to the
* corresponding EOH. -1 if unknown */
unsigned int len[3]; /* length of different parts of the start-line */
char l[VAR_ARRAY];
};

View File

@ -446,7 +446,6 @@ static inline struct htx_sl *htx_add_stline(struct htx *htx, enum htx_blk_type t
blk->info += size;
sl = htx_get_blk_ptr(htx, blk);
sl->hdrs_bytes = -1;
sl->flags = flags;
HTX_SL_P1_LEN(sl) = p1.len;

View File

@ -152,7 +152,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
struct htx_sl *sl;
struct ist meth, uri, vsn;
unsigned int flags;
size_t used;
/* <h1sl> is always defined for a request */
meth = h1sl->rq.m;
@ -178,7 +177,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
h1m->curr_len = h1m->body_len = 0;
}
used = htx_used_space(htx);
flags = h1m_htx_sl_flags(h1m);
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, uri, vsn);
if (!sl || !htx_add_all_headers(htx, hdrs))
@ -194,8 +192,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
if (uri.len > 4 && (uri.ptr[0] | 0x20) == 'h')
sl->flags |= ((uri.ptr[4] == ':') ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS);
}
/* Set bytes used in the HTX message for the headers now */
sl->hdrs_bytes = htx_used_space(htx) - used;
/* If body length cannot be determined, set htx->extra to
* ULLONG_MAX. This value is impossible in other cases.
@ -222,7 +218,6 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
struct htx_sl *sl;
struct ist vsn, status, reason;
unsigned int flags;
size_t used;
uint16_t code = 0;
if (h1sl) {
@ -285,16 +280,12 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
h1m->flags |= H1_MF_XFER_LEN;
}
used = htx_used_space(htx);
flags = h1m_htx_sl_flags(h1m);
sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, vsn, status, reason);
if (!sl || !htx_add_all_headers(htx, hdrs))
goto error;
sl->info.res.status = code;
/* Set bytes used in the HTX message for the headers now */
sl->hdrs_bytes = htx_used_space(htx) - used;
/* If body length cannot be determined, set htx->extra to
* ULLONG_MAX. This value is impossible in other cases.
*/

View File

@ -369,7 +369,6 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
int phdr;
int ret;
int i;
uint32_t used = htx_used_space(htx);
struct htx_sl *sl = NULL;
unsigned int sl_flags = 0;
const char *ctl;
@ -554,9 +553,6 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
if (!htx_add_endof(htx, HTX_BLK_EOH))
goto fail;
/* Set bytes used in the HTX message for the headers now */
sl->hdrs_bytes = htx_used_space(htx) - used;
ret = 1;
return ret;
@ -670,7 +666,6 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
int phdr;
int ret;
int i;
uint32_t used = htx_used_space(htx);
struct htx_sl *sl = NULL;
unsigned int sl_flags = 0;
const char *ctl;
@ -801,9 +796,6 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
if (!htx_add_endof(htx, HTX_BLK_EOH))
goto fail;
/* Set bytes used in the HTX message for the headers now */
sl->hdrs_bytes = htx_used_space(htx) - used;
ret = 1;
return ret;

View File

@ -808,7 +808,6 @@ struct htx_sl *htx_replace_stline(struct htx *htx, struct htx_blk *blk, const st
sl = htx_get_blk_ptr(htx, blk);
tmp.info = sl->info;
tmp.flags = sl->flags;
tmp.hdrs_bytes = sl->hdrs_bytes;
sz = htx_get_blksz(blk);
delta = sizeof(*sl) + p1.len + p2.len + p3.len - sz;
@ -829,7 +828,6 @@ struct htx_sl *htx_replace_stline(struct htx *htx, struct htx_blk *blk, const st
sl = htx_get_blk_ptr(htx, blk);
sl->info = tmp.info;
sl->flags = tmp.flags;
sl->hdrs_bytes = tmp.hdrs_bytes;
HTX_SL_P1_LEN(sl) = p1.len;
HTX_SL_P2_LEN(sl) = p2.len;