From 0b09df97ac904b1d187563efa16d3efb85350573 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Wed, 5 Dec 2012 23:07:20 +0000 Subject: [PATCH] On new connection, clear off receiving buffer --- mongoose.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mongoose.c b/mongoose.c index 21a9aba6..4ac6bac4 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4637,6 +4637,9 @@ static void process_new_connection(struct mg_connection *conn) { keep_alive_enabled = !strcmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes"); + // Important: on new connection, reset the receiving buffer. Credit goes + // to crule42. + conn->data_len = 0; do { reset_per_request_attributes(conn); conn->request_len = read_request(NULL, conn, conn->buf, conn->buf_size,