Websocket debug

This commit is contained in:
2020-12-01 20:12:27 +01:00
parent 018750b77d
commit da59085bcc

View File

@ -260,7 +260,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
} }
try { try {
bool noRedirect, redir, invalidMethod, etag, compress, websocket; bool noRedirect, redir, invalidMethod, etag, compress, wantsWebsocket, websocket = false;
URI path; URI path;
pid_t childpid; pid_t childpid;
FILE *file; FILE *file;
@ -424,7 +424,8 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
: ((req.getMethod() == "POST" || req.getMethod() == "PUT") ? -1 : 0); : ((req.getMethod() == "POST" || req.getMethod() == "PUT") ? -1 : 0);
socket->receive(pipes.stdin, len); socket->receive(pipes.stdin, len);
if (req.getMethod() != "GET") { wantsWebsocket = req.getMethod() == "GET" && req.getField("Connection") == "Upgrade";
if (!wantsWebsocket) {
// Close only if no Websocket upgrade is possible // Close only if no Websocket upgrade is possible
fclose(pipes.stdin); fclose(pipes.stdin);
} }