Skip to content

Commit 4eeddcd

Browse files
committed
setclientcert return err
1 parent a916376 commit 4eeddcd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/resty/core/socket.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,24 +150,27 @@ local function setclientcert(cosocket, cert, pkey)
150150
if not cert and not pkey then
151151
cosocket.client_cert = nil
152152
cosocket.client_pkey = nil
153-
return
153+
return true
154154
end
155155

156156
if not cert or not pkey then
157-
error("client certificate must be supplied with corresponding " ..
158-
"private key", 2)
157+
return nil,
158+
"client certificate must be supplied with corresponding " ..
159+
"private key"
159160
end
160161

161162
if type(cert) ~= "cdata" then
162-
error("bad client cert type", 2)
163+
return nil, "bad client cert type"
163164
end
164165

165166
if type(pkey) ~= "cdata" then
166-
error("bad client pkey type", 2)
167+
return nil, "bad client pkey type"
167168
end
168169

169170
cosocket.client_cert = cert
170171
cosocket.client_pkey = pkey
172+
173+
return true
171174
end
172175

173176

0 commit comments

Comments
 (0)