From a64a707828533b12c7774755a1f3c700a4b82aaa Mon Sep 17 00:00:00 2001 From: filispeen <72784386+filispeen@users.noreply.github.com> Date: Sat, 8 Aug 2026 06:12:00 -0700 Subject: [PATCH] Update coro-websocket.lua Removed "?" from exclusion and added guard invalid url/host and default empty pathname to "/" --- deps/coro-websocket.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deps/coro-websocket.lua b/deps/coro-websocket.lua index 8841617..a3ea52a 100644 --- a/deps/coro-websocket.lua +++ b/deps/coro-websocket.lua @@ -19,7 +19,10 @@ local websocketCodec = require('websocket-codec') local net = require('coro-net') local function parseUrl(url) - local protocol, host, port, pathname = string.match(url, "^(wss?)://([^:/]+):?(%d*)(/?[^#?]*)") + local protocol, host, port, pathname = string.match(url, "^(wss?)://([^:/]+):?(%d*)(/?[^#]*)") + if not protocol or not host or host == "" then + return nil, "Invalid URL" + end local tls if protocol == "ws" then port = tonumber(port) or 80 @@ -30,6 +33,9 @@ local function parseUrl(url) else return nil, "Sorry, only ws:// or wss:// protocols supported" end + if pathname == "" then + pathname = "/" + end return { host = host, port = port,