shithub: moonfish

Download patch

ref: dbfde4e45c264fd5552ba577804da9e07c3699f8
parent: cc97481984f72c57f3b730d6a5d06c0257b0ccd8
author: zamfofex <zamfofex@twdb.moe>
date: Mon Oct 9 14:39:25 EDT 2023

handle improper HTTP/1.1 response to HTTP/1.0 request

--- a/tools/lichess.c
+++ b/tools/lichess.c
@@ -318,6 +318,7 @@
 static int moonfish_response(br_ssl_engine_context *ctx, br_sslio_context *io_ctx, char *argv0)
 {
 	static char success[] = "HTTP/1.0 2";
+	static char success1[] = "HTTP/1.1 2";
 	
 	char line[sizeof success];
 	char prev, cur;
@@ -329,7 +330,9 @@
 		exit(1);
 	}
 	
-	if (strcmp(line, success)) return 1;
+	if (strncmp(line, success, sizeof line - 1))
+	if (strncmp(line, success1, sizeof line - 1))
+		return 1;
 	
 	prev = 0;
 	for (;;)
--