فهرست منبع

Buffered next requests must not be reset

Related commit is 9d58de6615c12b84a111d8206fff93a85910f48c .
Fix issue #707
xtne6f 6 سال پیش
والد
کامیت
579ae663a8
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      src/civetweb.c

+ 5 - 1
src/civetweb.c

@@ -16097,7 +16097,6 @@ reset_per_request_attributes(struct mg_connection *conn)
 	conn->must_close = 0;
 	conn->must_close = 0;
 	conn->request_len = 0;
 	conn->request_len = 0;
 	conn->throttle = 0;
 	conn->throttle = 0;
-	conn->data_len = 0;
 	conn->chunk_remainder = 0;
 	conn->chunk_remainder = 0;
 	conn->accept_gzip = 0;
 	conn->accept_gzip = 0;
 
 
@@ -17145,6 +17144,9 @@ mg_get_response(struct mg_connection *conn,
 		return -1;
 		return -1;
 	}
 	}
 
 
+	/* Reset the previous responses */
+	conn->data_len = 0;
+
 	/* Implementation of API function for HTTP clients */
 	/* Implementation of API function for HTTP clients */
 	save_timeout = conn->dom_ctx->config[REQUEST_TIMEOUT];
 	save_timeout = conn->dom_ctx->config[REQUEST_TIMEOUT];
 
 
@@ -17208,6 +17210,8 @@ mg_download(const char *host,
 			            "%s",
 			            "%s",
 			            "Error sending request");
 			            "Error sending request");
 		} else {
 		} else {
+			/* make sure the buffer is clear */
+			conn->data_len = 0;
 			get_response(conn, ebuf, ebuf_len, &reqerr);
 			get_response(conn, ebuf, ebuf_len, &reqerr);
 
 
 #if defined(MG_LEGACY_INTERFACE)
 #if defined(MG_LEGACY_INTERFACE)