Skip to content

Commit 36b29bc

Browse files
committed
Use default port 443 for wss://
1 parent 44c703e commit 36b29bc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/resty/websocket/client.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ local encode_base64 = ngx.encode_base64
1818
local concat = table.concat
1919
local char = string.char
2020
local str_find = string.find
21+
local str_sub = string.sub
2122
local rand = math.random
2223
local rshift = bit.rshift
2324
local band = bit.band
@@ -91,7 +92,11 @@ function _M.connect(self, uri, opts)
9192
-- ngx.say("port: ", port)
9293

9394
if not port then
94-
port = 80
95+
if str_sub(uri, 1, 6) == 'wss://' then
96+
port = 443
97+
else
98+
port = 80
99+
end
95100
end
96101

97102
if path == "" then

0 commit comments

Comments
 (0)