Skip to content

Commit 4c88b02

Browse files
committed
feat: return ssl_session upon successful SSL connection
1 parent c2608fc commit 4c88b02

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/resty/http.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ end
165165
do
166166
local aio_connect = require "resty.http_connect"
167167
-- Function signatures to support:
168-
-- ok, err = httpc:connect(options_table)
168+
-- ok, err, ssl_session = httpc:connect(options_table)
169169
-- ok, err = httpc:connect(host, port, options_table?)
170170
-- ok, err = httpc:connect("unix:/path/to/unix.sock", options_table?)
171171
function _M.connect(self, options, ...)

lib/resty/http_connect.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ local function connect(self, options)
215215
end
216216
end
217217

218+
local ssl_session
218219
-- Now do the ssl handshake
219220
if ssl and sock:getreusedtimes() == 0 then
220-
local ssl_session
221221
ssl_session, err = sock:sslhandshake(ssl_reused_session, ssl_server_name, ssl_verify, ssl_send_status_req)
222222
if not ssl_session then
223223
self:close()
@@ -233,7 +233,7 @@ local function connect(self, options)
233233
self.http_proxy_auth = request_scheme ~= "https" and proxy_authorization or nil
234234
self.path_prefix = path_prefix
235235

236-
return true
236+
return true, nil, ssl_session
237237
end
238238

239239
return connect

0 commit comments

Comments
 (0)