mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-26 23:50:36 +00:00
MINOR: h1: add the restart offsets into struct h1m
Currently the only user of struct h1m is the h2 mux when it has to parse an H1 message coming from the channel. Unfortunately this is not enough to efficiently parse HTTP/1 messages like those coming from the network as we don't want to restart from scratch at every byte received. This patch reintroduces the "next" offset into the H1 message so that any H1 parser can use it to restart when called with a state that is not the initial state.
This commit is contained in:
parent
801250e07d
commit
b3b0152b6f
@ -309,6 +309,7 @@ static inline int h1_parse_chunk_size(const struct buffer *buf, int start, int s
|
||||
static inline struct h1m *h1m_init(struct h1m *h1m)
|
||||
{
|
||||
h1m->state = H1_MSG_RQBEFORE;
|
||||
h1m->next = 0;
|
||||
h1m->status = 0;
|
||||
h1m->flags = 0;
|
||||
h1m->curr_len = 0;
|
||||
|
@ -158,6 +158,7 @@ struct h1m {
|
||||
uint32_t flags; // H1 message flags (H1_MF_*)
|
||||
uint64_t curr_len; // content-length or last chunk length
|
||||
uint64_t body_len; // total known size of the body length
|
||||
uint32_t next; // next byte to parse, relative to buffer's head
|
||||
int err_pos; // position in the byte stream of the first error (H1 or H2)
|
||||
int err_state; // state where the first error was met (H1 or H2)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user