Fix Bug: http parser error

After realloc memory, forgot to correct the mark of the http_parser.

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-11-27 22:47:04 +08:00
parent 52b351f32e
commit a3a2d7bdcb
1 changed files with 4 additions and 1 deletions

View File

@ -227,8 +227,11 @@ static void connection_read_cb(struct ev_loop *loop, ev_io *w, int revents)
handshake_done:
#endif
if (uh_buf_available(buf) < UH_BUFFER_SIZE)
if (uh_buf_available(buf) < UH_BUFFER_SIZE) {
int off = con->parser.mark - buf->base;
uh_buf_grow(buf, UH_BUFFER_SIZE);
con->parser.mark = buf->base + off;
}
base = buf->base + buf->len;