Procházet zdrojové kódy

Do not call discard_unread_request_data when must_close is true

Chris Han před 5 roky
rodič
revize
b4f84c1809
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      src/civetweb.c

+ 6 - 2
src/civetweb.c

@@ -14039,7 +14039,9 @@ handle_request(struct mg_connection *conn)
 			/* callback already processed the request. Store the
 			/* callback already processed the request. Store the
 			   return value as a status code for the access log. */
 			   return value as a status code for the access log. */
 			conn->status_code = i;
 			conn->status_code = i;
-			discard_unread_request_data(conn);
+			if (!conn->must_close) {
+				discard_unread_request_data(conn);
+			}
 			return;
 			return;
 		} else if (i == 0) {
 		} else if (i == 0) {
 			/* civetweb should process the request */
 			/* civetweb should process the request */
@@ -14236,7 +14238,9 @@ handle_request(struct mg_connection *conn)
 				 * then return value as status code for the log and discard
 				 * then return value as status code for the log and discard
 				 * all data from the client not used by the callback. */
 				 * all data from the client not used by the callback. */
 				conn->status_code = i;
 				conn->status_code = i;
-				discard_unread_request_data(conn);
+				if (!conn->must_close) {
+					discard_unread_request_data(conn);
+				}
 			} else {
 			} else {
 				/* The handler did NOT handle the request. */
 				/* The handler did NOT handle the request. */
 				/* Some proper reactions would be:
 				/* Some proper reactions would be: