summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index a1614ea..9673e28 100644
--- a/main.lua
+++ b/main.lua
@@ -22,14 +22,14 @@ function onstream(server, stream)
end
local path = head:get(":path")
- if not path:sub(1,6) == "/room/" or #path < 7 then
+ if not path:sub(1,6) == "/room/" or not path:sub(#path-2,#path) == "/ws" or #path < 10 then
local response = headers.new()
response:append(":status", "404")
stream:write_headers(response, false)
stream:write_chunk("please access /room/(roomname).", true)
return
end
- local room = path:sub(7,#path)
+ local room = path:sub(7,#path-3)
ws:accept()
logic.onsocket(ws,room)