]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
server/sws: if asked to close connection, skip the websocket handling
authorDaniel Stenberg <daniel@haxx.se>
Mon, 12 Dec 2022 15:45:53 +0000 (16:45 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 13 Dec 2022 14:13:09 +0000 (15:13 +0100)
tests/server/sws.c

index bcc4d40dcec6e286b0fc855c394b897804a779c3..e4ef0ae4ae430f92f39897d64d334c5b1666377f 100644 (file)
@@ -881,12 +881,12 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
     req->offset = 0;
 
     /* read websocket traffic */
-    do {
+    if(req->open)
+      do {
 
       got = sread(sock, reqbuf + req->offset, REQBUFSIZ - req->offset);
       if(got > 0)
         req->offset += got;
-      logmsg("Got: %d", (int)got);
 
       if((got == -1) && ((EAGAIN == errno) || (EWOULDBLOCK == errno))) {
         int rc;
@@ -894,6 +894,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
         fd_set output;
         struct timeval timeout = {1, 0}; /* 1000 ms */
 
+        logmsg("Got EAGAIN from sread");
         FD_ZERO(&input);
         FD_ZERO(&output);
         got = 0;
@@ -1917,6 +1918,9 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req,
     logmsg("=> persistent connection request ended, awaits new request\n");
     return 1;
   }
+  else {
+    logmsg("=> NOT a persistent connection, close close CLOSE\n");
+  }
 
   return -1;
 }