server/sws: if asked to close connection, skip the websocket handling

This commit is contained in:
Daniel Stenberg 2022-12-12 16:45:53 +01:00
parent 734c1f8909
commit b716511f0f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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;
}