Skip to content

Commit 16612cb

Browse files
bugfix: fix the compatibility issues.
1 parent 4f120c1 commit 16612cb

File tree

5 files changed

+34
-226
lines changed

5 files changed

+34
-226
lines changed

src/ngx_http_lua_module.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@
3131
#include "ngx_http_lua_ssl_certby.h"
3232
#include "ngx_http_lua_ssl_session_storeby.h"
3333
#include "ngx_http_lua_ssl_session_fetchby.h"
34-
35-
#ifdef HAVE_PROXY_SSL_PATCH
3634
#include "ngx_http_lua_proxy_ssl_verifyby.h"
37-
#endif
3835

3936
#include "ngx_http_lua_headers.h"
4037
#include "ngx_http_lua_headers_out.h"
4138
#if !(NGX_WIN32)
4239
#include "ngx_http_lua_pipe.h"
4340
#endif
4441

42+
#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER > 0x101010afL
43+
#define HAVE_SSL_KEY_LOG 1
44+
#endif
45+
4546

4647
static void *ngx_http_lua_create_main_conf(ngx_conf_t *cf);
4748
static char *ngx_http_lua_init_main_conf(ngx_conf_t *cf, void *conf);
@@ -59,11 +60,13 @@ static ngx_int_t ngx_http_lua_merge_ssl(ngx_conf_t *cf,
5960
ngx_http_lua_loc_conf_t *conf, ngx_http_lua_loc_conf_t *prev);
6061
static ngx_int_t ngx_http_lua_set_ssl(ngx_conf_t *cf,
6162
ngx_http_lua_loc_conf_t *llcf);
63+
#ifdef HAVE_SSL_KEY_LOG
6264
static void key_log_callback(const ngx_ssl_conn_t *ssl_conn,
6365
const char *line);
6466
static void ngx_http_lua_ssl_cleanup_key_log(void *data);
6567
static ngx_int_t ngx_http_lua_ssl_key_log(ngx_conf_t *cf, ngx_ssl_t *ssl,
6668
ngx_str_t *file);
69+
#endif
6770
#if (nginx_version >= 1019004)
6871
static char *ngx_http_lua_ssl_conf_command_check(ngx_conf_t *cf, void *post,
6972
void *data);
@@ -665,7 +668,7 @@ static ngx_command_t ngx_http_lua_cmds[] = {
665668
0,
666669
(void *) ngx_http_lua_ssl_sess_fetch_handler_file },
667670

668-
#ifdef HAVE_PROXY_SSL_PATCH
671+
#if HAVE_LUA_PROXY_SSL_VERIFY
669672
/* same context as proxy_pass directive */
670673
{ ngx_string("proxy_ssl_verify_by_lua_block"),
671674
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
@@ -1611,7 +1614,7 @@ ngx_http_lua_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
16111614
NULL);
16121615
#endif
16131616

1614-
#ifdef HAVE_PROXY_SSL_PATCH
1617+
#if HAVE_LUA_PROXY_SSL_VERIFY
16151618
if (conf->proxy_ssl_verify_src.len == 0) {
16161619
conf->proxy_ssl_verify_src = prev->proxy_ssl_verify_src;
16171620
conf->proxy_ssl_verify_handler = prev->proxy_ssl_verify_handler;
@@ -1795,11 +1798,13 @@ ngx_http_lua_set_ssl(ngx_conf_t *cf, ngx_http_lua_loc_conf_t *llcf)
17951798
return NGX_ERROR;
17961799
}
17971800

1801+
#ifdef HAVE_SSL_KEY_LOG
17981802
if (ngx_http_lua_ssl_key_log(cf, llcf->ssl, &llcf->ssl_key_log)
17991803
!= NGX_OK)
18001804
{
18011805
return NGX_ERROR;
18021806
}
1807+
#endif
18031808

18041809
#if (nginx_version >= 1019004)
18051810
if (ngx_ssl_conf_commands(cf, llcf->ssl, llcf->ssl_conf_commands)
@@ -1813,6 +1818,7 @@ ngx_http_lua_set_ssl(ngx_conf_t *cf, ngx_http_lua_loc_conf_t *llcf)
18131818
}
18141819

18151820

1821+
#ifdef HAVE_SSL_KEY_LOG
18161822
static void
18171823
key_log_callback(const ngx_ssl_conn_t *ssl_conn, const char *line)
18181824
{
@@ -1906,6 +1912,7 @@ ngx_http_lua_ssl_key_log(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *file)
19061912

19071913
return NGX_OK;
19081914
}
1915+
#endif
19091916

19101917

19111918
#if (nginx_version >= 1019004)

0 commit comments

Comments
 (0)