@@ -32,7 +32,7 @@ new file mode 100644
32
32
index 0000000..89454ad
33
33
--- /dev/null
34
34
+++ lib/resty/core/socket/tcp.lua
35
- @@ -0,0 +1,277 @@
35
+ @@ -0,0 +1,284 @@
36
36
+ -- Copyright (C) by OpenResty Inc.
37
37
+
38
38
+
@@ -141,6 +141,15 @@ index 0000000..89454ad
141
141
+ end
142
142
+
143
143
+
144
+ + local function report_handshake_error(errmsg, openssl_error_code)
145
+ + if openssl_error_code[0] ~= 0 then
146
+ + return nil, openssl_error_code[0] .. ": " .. ffi_str(errmsg[0])
147
+ + end
148
+ +
149
+ + return nil, ffi_str(errmsg[0])
150
+ + end
151
+ +
152
+ +
144
153
+ local function tlshandshake(self, options)
145
154
+ if not options then
146
155
+ clear_tab(cached_options)
@@ -241,7 +250,9 @@ index 0000000..89454ad
241
250
+ rc = ngx_lua_ffi_socket_tcp_get_tlshandshake_result(r, u,
242
251
+ session_ptr, errmsg, openssl_error_code)
243
252
+
244
- + assert(rc == FFI_OK)
253
+ + if rc == FFI_ERROR then
254
+ + return report_handshake_error(errmsg, openssl_error_code)
255
+ + end
245
256
+
246
257
+ if session_ptr[0] == nil then
247
258
+ return nil
@@ -258,11 +269,7 @@ index 0000000..89454ad
258
269
+ session_ptr, errmsg, openssl_error_code)
259
270
+
260
271
+ if rc == FFI_ERROR then
261
- + if openssl_error_code[0] ~= 0 then
262
- + return nil, openssl_error_code[0] .. ": " .. ffi_str(errmsg[0])
263
- + end
264
- +
265
- + return nil, ffi_str(errmsg[0])
272
+ + return report_handshake_error(errmsg, openssl_error_code)
266
273
+ end
267
274
+ end
268
275
+ end
0 commit comments