From a3a2d7bdcb65ca019bb1633aa5b88ca5d0b972df Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Mon, 27 Nov 2017 22:47:04 +0800 Subject: [PATCH] Fix Bug: http parser error After realloc memory, forgot to correct the mark of the http_parser. Signed-off-by: Jianhui Zhao --- src/uhttp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uhttp.c b/src/uhttp.c index d1b8a44..8a5c745 100755 --- a/src/uhttp.c +++ b/src/uhttp.c @@ -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;