mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Merge commit '5b87624e3befb8c22a711e933793f01bfc7b7695' into dev
This commit is contained in:
commit
a2b17f289a
3 changed files with 22 additions and 21 deletions
|
|
@ -29,7 +29,7 @@
|
|||
/* Public API for other Nginx modules */
|
||||
|
||||
|
||||
#define ngx_stream_lua_version 15
|
||||
#define ngx_stream_lua_version 16
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -5595,8 +5595,7 @@ ngx_stream_lua_socket_keepalive_close_handler(ngx_event_t *ev)
|
|||
ngx_stream_lua_socket_pool_t *spool;
|
||||
|
||||
int n;
|
||||
int err;
|
||||
char buf[1];
|
||||
unsigned char buf[1];
|
||||
ngx_connection_t *c;
|
||||
|
||||
c = ev->data;
|
||||
|
|
@ -5618,20 +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);
|
||||
err = ngx_socket_errno;
|
||||
#if (NGX_STREAM_SSL)
|
||||
/* ignore ssl protocol data like change cipher spec */
|
||||
if (n == 1 && c->ssl != NULL) {
|
||||
n = c->recv(c, (unsigned char *) buf, 1);
|
||||
if (n == NGX_AGAIN) {
|
||||
n = -1;
|
||||
err = NGX_EAGAIN;
|
||||
}
|
||||
}
|
||||
#endif /* NGX_STREAM_SSL */
|
||||
/* consume the possible ssl-layer data implicitly */
|
||||
n = c->recv(c, buf, 1);
|
||||
|
||||
if (n == -1 && err == NGX_EAGAIN) {
|
||||
if (n == NGX_AGAIN) {
|
||||
/* stale event */
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
|
|
|
|||
|
|
@ -32,18 +32,30 @@ ngx_stream_lua_ffi_var_get(ngx_stream_lua_request_t *r, u_char *name_data,
|
|||
ngx_uint_t hash;
|
||||
ngx_str_t name;
|
||||
|
||||
ngx_stream_variable_value_t *vv;
|
||||
ngx_stream_session_t *session;
|
||||
ngx_stream_lua_ctx_t *ctx;
|
||||
ngx_stream_lua_ssl_ctx_t *cctx;
|
||||
ngx_stream_variable_value_t *vv;
|
||||
|
||||
if (r == NULL) {
|
||||
*err = "no request object found";
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
session = r->session;
|
||||
if ((r)->connection->fd == (ngx_socket_t) -1) {
|
||||
*err = "API disabled in the current context";
|
||||
return NGX_ERROR;
|
||||
}
|
||||
ctx = ngx_stream_lua_get_module_ctx(r, ngx_stream_lua_module);
|
||||
if (ctx->context & (NGX_STREAM_LUA_CONTEXT_SSL_CERT
|
||||
| NGX_STREAM_LUA_CONTEXT_SSL_CLIENT_HELLO))
|
||||
{
|
||||
cctx = ngx_stream_lua_ssl_get_ctx(r->connection->ssl->connection);
|
||||
session = cctx->connection->data;
|
||||
|
||||
} else {
|
||||
*err = "API disabled in the current context";
|
||||
return NGX_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
hash = ngx_hash_strlow(lowcase_buf, name_data, name_len);
|
||||
|
||||
|
|
@ -52,7 +64,7 @@ ngx_stream_lua_ffi_var_get(ngx_stream_lua_request_t *r, u_char *name_data,
|
|||
|
||||
dd("variable name: %.*s", (int) name_len, lowcase_buf);
|
||||
|
||||
vv = ngx_stream_get_variable(r->session, &name, hash);
|
||||
vv = ngx_stream_get_variable(session, &name, hash);
|
||||
|
||||
if (vv == NULL || vv->not_found) {
|
||||
return NGX_DECLINED;
|
||||
|
|
|
|||
Loading…
Reference in a new issue