소스 검색

On new connection, clear off receiving buffer

Sergey Lyubka 12 년 전
부모
커밋
0b09df97ac
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      mongoose.c

+ 3 - 0
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,