check if Upgrade/upgrade header is complete

This commit is contained in:
orignal
2026-10-03 12:32:28 -04:00
parent 793431aed3
commit 76fc49a886
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -353,7 +353,7 @@ namespace proxy
/* close connection, if not Connection: (U|u)pgrade (for websocket) */
auto h = req.GetHeader ("Connection");
auto x = h.find("pgrade");
if (!(x != std::string::npos && std::tolower(h[x - 1]) == 'u'))
if (x == std::string::npos || !x || std::tolower(h[x - 1]) != 'u')
req.UpdateHeader("Connection", "close");
}