Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport -> release/3.9.x] fix(patches): add patches from upstream openresty #13952

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_socket_tcp.c b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_socket_tcp.c
index 037faef..0e6dcd0 100644
--- a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_socket_tcp.c
+++ b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_socket_tcp.c
@@ -5731,7 +5731,7 @@ ngx_http_lua_socket_keepalive_close_handler(ngx_event_t *ev)
ngx_http_lua_socket_pool_t *spool;

int n;
- char buf[1];
+ unsigned char buf[1];
ngx_connection_t *c;

c = ev->data;
@@ -5752,9 +5752,10 @@ ngx_http_lua_socket_keepalive_close_handler(ngx_event_t *ev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0,
"lua tcp socket keepalive close handler check stale events");

- n = recv(c->fd, buf, 1, MSG_PEEK);
+ /* consume the possible ssl-layer data implicitly */
+ n = c->recv(c, buf, 1);

- if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
+ if (n == NGX_AGAIN) {
/* stale event */

if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/bundle/ngx_stream_lua-0.0.14/src/ngx_stream_lua_socket_tcp.c b/bundle/ngx_stream_lua-0.0.14/src/ngx_stream_lua_socket_tcp.c
index 9d5472a..c5b33df 100644
--- a/bundle/ngx_stream_lua-0.0.14/src/ngx_stream_lua_socket_tcp.c
+++ b/bundle/ngx_stream_lua-0.0.14/src/ngx_stream_lua_socket_tcp.c
@@ -5595,7 +5595,7 @@ ngx_stream_lua_socket_keepalive_close_handler(ngx_event_t *ev)
ngx_stream_lua_socket_pool_t *spool;

int n;
- char buf[1];
+ unsigned char buf[1];
ngx_connection_t *c;

c = ev->data;
@@ -5617,9 +5617,10 @@ ngx_stream_lua_socket_keepalive_close_handler(ngx_event_t *ev)
"stream lua tcp socket keepalive close handler "
"check stale events");

- n = recv(c->fd, buf, 1, MSG_PEEK);
+ /* consume the possible ssl-layer data implicitly */
+ n = c->recv(c, buf, 1);

- if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
+ if (n == NGX_AGAIN) {
/* stale event */

if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
6 changes: 2 additions & 4 deletions spec/internal/ssl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ function SSL.wrap(sock, cfg)
if s then
local fd = sock:getfd()
C.SSL_set_fd(s, fd)
sock:setfd(SOCKET_INVALID)

local self = setmetatable({
ssl_ctx = ctx,
ctx = s,
fd = fd,
sock = sock,
}, ssl_mt)

return self, nil
Expand Down Expand Up @@ -259,9 +259,7 @@ function SSL:send(s)
end

function SSL:close()
if C.SSL_shutdown(self.ctx) ~= 1 then
return nil, format_error("SSL_shutdown")
end
self.sock:close()
return true
end

Expand Down
Loading