]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
sws: log the exact closing reason better, to help debugging tests master
authorDaniel Stenberg <daniel@haxx.se>
Wed, 29 Jul 2026 14:32:40 +0000 (16:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 29 Jul 2026 21:59:00 +0000 (23:59 +0200)
Closes #22431

tests/server/sws.c

index e47ba7fc3d91e627b308ad91a7f10508b66ee09e..d68f60b5b803906fb9a4a4f01729c9669d0e8316 100644 (file)
@@ -887,10 +887,18 @@ static int sws_send_doc(curl_socket_t sock, struct sws_httprequest *req)
   /* If the word 'swsclose' is present anywhere in the reply chunk, the
      connection is closed after the data has been sent to the requesting
      client... */
-  if(strstr(buffer, "swsclose") || !count || req->close) {
+  if(strstr(buffer, "swsclose")) {
     persistent = FALSE;
     logmsg("connection close instruction \"swsclose\" found in response");
   }
+  else if(!count) {
+    persistent = FALSE;
+    logmsg("connection closed because of empty response");
+  }
+  else if(req->close) {
+    persistent = FALSE;
+    logmsg("connection closed because of close instruction in servercmd");
+  }
   if(strstr(buffer, "swsbounce")) {
     sws_prevbounce = TRUE;
     logmsg("enable \"swsbounce\" in the next request");