mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
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:
parent
c92ec0ba71
commit
2b78f0bfc4
@ -187,10 +187,6 @@ struct htx_sl {
|
|||||||
|
|
||||||
/* XXX 2 bytes unused */
|
/* 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 */
|
unsigned int len[3]; /* length of different parts of the start-line */
|
||||||
char l[VAR_ARRAY];
|
char l[VAR_ARRAY];
|
||||||
};
|
};
|
||||||
|
@ -446,7 +446,6 @@ static inline struct htx_sl *htx_add_stline(struct htx *htx, enum htx_blk_type t
|
|||||||
blk->info += size;
|
blk->info += size;
|
||||||
|
|
||||||
sl = htx_get_blk_ptr(htx, blk);
|
sl = htx_get_blk_ptr(htx, blk);
|
||||||
sl->hdrs_bytes = -1;
|
|
||||||
sl->flags = flags;
|
sl->flags = flags;
|
||||||
|
|
||||||
HTX_SL_P1_LEN(sl) = p1.len;
|
HTX_SL_P1_LEN(sl) = p1.len;
|
||||||
|
@ -152,7 +152,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
|
|||||||
struct htx_sl *sl;
|
struct htx_sl *sl;
|
||||||
struct ist meth, uri, vsn;
|
struct ist meth, uri, vsn;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
size_t used;
|
|
||||||
|
|
||||||
/* <h1sl> is always defined for a request */
|
/* <h1sl> is always defined for a request */
|
||||||
meth = h1sl->rq.m;
|
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;
|
h1m->curr_len = h1m->body_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
used = htx_used_space(htx);
|
|
||||||
flags = h1m_htx_sl_flags(h1m);
|
flags = h1m_htx_sl_flags(h1m);
|
||||||
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, uri, vsn);
|
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, uri, vsn);
|
||||||
if (!sl || !htx_add_all_headers(htx, hdrs))
|
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')
|
if (uri.len > 4 && (uri.ptr[0] | 0x20) == 'h')
|
||||||
sl->flags |= ((uri.ptr[4] == ':') ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS);
|
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
|
/* If body length cannot be determined, set htx->extra to
|
||||||
* ULLONG_MAX. This value is impossible in other cases.
|
* 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 htx_sl *sl;
|
||||||
struct ist vsn, status, reason;
|
struct ist vsn, status, reason;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
size_t used;
|
|
||||||
uint16_t code = 0;
|
uint16_t code = 0;
|
||||||
|
|
||||||
if (h1sl) {
|
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;
|
h1m->flags |= H1_MF_XFER_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
used = htx_used_space(htx);
|
|
||||||
flags = h1m_htx_sl_flags(h1m);
|
flags = h1m_htx_sl_flags(h1m);
|
||||||
sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, vsn, status, reason);
|
sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, vsn, status, reason);
|
||||||
if (!sl || !htx_add_all_headers(htx, hdrs))
|
if (!sl || !htx_add_all_headers(htx, hdrs))
|
||||||
goto error;
|
goto error;
|
||||||
sl->info.res.status = code;
|
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
|
/* If body length cannot be determined, set htx->extra to
|
||||||
* ULLONG_MAX. This value is impossible in other cases.
|
* ULLONG_MAX. This value is impossible in other cases.
|
||||||
*/
|
*/
|
||||||
|
8
src/h2.c
8
src/h2.c
@ -369,7 +369,6 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
|
|||||||
int phdr;
|
int phdr;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
uint32_t used = htx_used_space(htx);
|
|
||||||
struct htx_sl *sl = NULL;
|
struct htx_sl *sl = NULL;
|
||||||
unsigned int sl_flags = 0;
|
unsigned int sl_flags = 0;
|
||||||
const char *ctl;
|
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))
|
if (!htx_add_endof(htx, HTX_BLK_EOH))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Set bytes used in the HTX message for the headers now */
|
|
||||||
sl->hdrs_bytes = htx_used_space(htx) - used;
|
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -670,7 +666,6 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
|
|||||||
int phdr;
|
int phdr;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
uint32_t used = htx_used_space(htx);
|
|
||||||
struct htx_sl *sl = NULL;
|
struct htx_sl *sl = NULL;
|
||||||
unsigned int sl_flags = 0;
|
unsigned int sl_flags = 0;
|
||||||
const char *ctl;
|
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))
|
if (!htx_add_endof(htx, HTX_BLK_EOH))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Set bytes used in the HTX message for the headers now */
|
|
||||||
sl->hdrs_bytes = htx_used_space(htx) - used;
|
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -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);
|
sl = htx_get_blk_ptr(htx, blk);
|
||||||
tmp.info = sl->info;
|
tmp.info = sl->info;
|
||||||
tmp.flags = sl->flags;
|
tmp.flags = sl->flags;
|
||||||
tmp.hdrs_bytes = sl->hdrs_bytes;
|
|
||||||
|
|
||||||
sz = htx_get_blksz(blk);
|
sz = htx_get_blksz(blk);
|
||||||
delta = sizeof(*sl) + p1.len + p2.len + p3.len - sz;
|
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 = htx_get_blk_ptr(htx, blk);
|
||||||
sl->info = tmp.info;
|
sl->info = tmp.info;
|
||||||
sl->flags = tmp.flags;
|
sl->flags = tmp.flags;
|
||||||
sl->hdrs_bytes = tmp.hdrs_bytes;
|
|
||||||
|
|
||||||
HTX_SL_P1_LEN(sl) = p1.len;
|
HTX_SL_P1_LEN(sl) = p1.len;
|
||||||
HTX_SL_P2_LEN(sl) = p2.len;
|
HTX_SL_P2_LEN(sl) = p2.len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user