Skip to content

Commit

Permalink
Fix Bug: http parser error
Browse files Browse the repository at this point in the history
After realloc memory, forgot to correct the mark of the http_parser.

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
  • Loading branch information
Jianhui Zhao committed Nov 27, 2017
1 parent 52b351f commit a3a2d7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/uhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a3a2d7b

Please sign in to comment.