Skip to content

Commit 77f82d6

Browse files
authored
bugfix: added missing SSL feature macro (#211)
Sync from openresty/meta-lua-nginx-module#83
1 parent f94afe2 commit 77f82d6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/ngx_stream_lua_ctx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ ngx_stream_lua_ffi_get_ctx_ref(ngx_stream_lua_request_t *r, int *in_ssl_phase,
8282
int *ssl_ctx_ref)
8383
{
8484
ngx_stream_lua_ctx_t *ctx;
85+
#if (NGX_STREAM_SSL)
8586
ngx_stream_lua_ssl_ctx_t *ssl_ctx;
87+
#endif
8688

8789
ctx = ngx_stream_lua_get_module_ctx(r, ngx_stream_lua_module);
8890
if (ctx == NULL) {
@@ -96,13 +98,15 @@ ngx_stream_lua_ffi_get_ctx_ref(ngx_stream_lua_request_t *r, int *in_ssl_phase,
9698
*in_ssl_phase = ctx->context & NGX_STREAM_LUA_CONTEXT_SSL_CERT;
9799
*ssl_ctx_ref = LUA_NOREF;
98100

101+
#if (NGX_STREAM_SSL)
99102
if (r->connection->ssl != NULL) {
100103
ssl_ctx = ngx_stream_lua_ssl_get_ctx(r->connection->ssl->connection);
101104

102105
if (ssl_ctx != NULL) {
103106
*ssl_ctx_ref = ssl_ctx->ctx_ref;
104107
}
105108
}
109+
#endif
106110

107111
return LUA_NOREF;
108112
}
@@ -112,15 +116,18 @@ int
112116
ngx_stream_lua_ffi_set_ctx_ref(ngx_stream_lua_request_t *r, int ref)
113117
{
114118
ngx_pool_t *pool;
115-
ngx_connection_t *c;
116119
ngx_stream_lua_ctx_t *ctx;
120+
#if (NGX_STREAM_SSL)
121+
ngx_connection_t *c;
117122
ngx_stream_lua_ssl_ctx_t *ssl_ctx;
123+
#endif
118124

119125
ctx = ngx_stream_lua_get_module_ctx(r, ngx_stream_lua_module);
120126
if (ctx == NULL) {
121127
return NGX_STREAM_LUA_FFI_NO_REQ_CTX;
122128
}
123129

130+
#if (NGX_STREAM_SSL)
124131
if (ctx->context & NGX_STREAM_LUA_CONTEXT_SSL_CERT) {
125132
ssl_ctx = ngx_stream_lua_ssl_get_ctx(r->connection->ssl->connection);
126133
if (ssl_ctx == NULL) {
@@ -135,6 +142,10 @@ ngx_stream_lua_ffi_set_ctx_ref(ngx_stream_lua_request_t *r, int ref)
135142
pool = r->pool;
136143
}
137144

145+
#else
146+
pool = r->pool;
147+
#endif
148+
138149
ctx->ctx_ref = ref;
139150

140151
if (ngx_stream_lua_ngx_ctx_add_cleanup(r, pool, ref) != NGX_OK) {

0 commit comments

Comments
 (0)