diff --git a/src/ngx_http_lua_socket_tcp.c b/src/ngx_http_lua_socket_tcp.c index 13b5156039..08c02ae043 100644 --- a/src/ngx_http_lua_socket_tcp.c +++ b/src/ngx_http_lua_socket_tcp.c @@ -2035,7 +2035,7 @@ ngx_http_lua_ffi_socket_tcp_sslhandshake(ngx_http_request_t *r, ngx_http_lua_ssl_handshake_handler(c); - if (rc == NGX_ERROR) { + if (rc == NGX_ERROR || u->error_ret != NULL) { *errmsg = u->error_ret; return NGX_ERROR; }