Skip to content

Commit

Permalink
fix(websocket): fix panic
Browse files Browse the repository at this point in the history
Fixes: 34e336d

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Oct 24, 2023
1 parent 848f94c commit cae528d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions websocket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ end
local metatable = { __index = methods }

function M.upgrade(con, req, opts)
local mt = getmetatable(con)
local resp = mt.resp
local resp = con.resp

if req.major_version ~= 1 or req.minor_version ~= 1 then
return nil, 'bad http version'
Expand Down Expand Up @@ -356,7 +355,7 @@ function M.upgrade(con, req, opts)
opts.max_payload_len = opts.max_payload_len or 65535

return setmetatable({
sock = mt.sock,
sock = con.sock,
opts = opts
}, metatable)
end
Expand Down

0 comments on commit cae528d

Please sign in to comment.