Browse Source

Do not log if log_access returns not 0

bel2125 4 years ago
parent
commit
1e4ad93f14
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/civetweb.c

+ 7 - 1
src/civetweb.c

@@ -15333,7 +15333,13 @@ log_access(const struct mg_connection *conn)
 	            user_agent);
 
 	if (conn->phys_ctx->callbacks.log_access) {
-		conn->phys_ctx->callbacks.log_access(conn, buf);
+		if (conn->phys_ctx->callbacks.log_access(conn, buf)) {
+			/* do not log if callack returns non-zero */
+			if (fi.access.fp) {
+				mg_fclose(&fi.access);
+			}
+			return;
+		}
 	}
 
 	if (fi.access.fp) {