From 6149427448d744c5a0c1ad320bc1837301cc2cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 8 Jun 2021 16:53:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8E=E9=80=9F=E7=89=B9=E5=88=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server.c b/server.c index cc58a1c..8ec6cc1 100644 --- a/server.c +++ b/server.c @@ -284,7 +284,15 @@ static void execute_cgi(int client, const char *path, const char *method, const } if(data) free(data); #else - len = splice(cgi_output[0], NULL, client, NULL, cnt, SPLICE_F_GIFT); + while(len < cnt) { + int delta = splice(cgi_output[0], NULL, client, NULL, cnt - len, SPLICE_F_GIFT); + if(delta < 0) { + cannot_execute(client); + break; + } + len += delta; + } + #endif printf("cgi send %d bytes\n", len); }