Skip to content

Commit

Permalink
fix(patch) patch old stable
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Nov 2, 2022
1 parent efe6684 commit 25a7c1e
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 66 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
diff --git a/nginx-1.19.3/src/stream/ngx_stream_proxy_module.c b/nginx-1.19.3/src/stream/ngx_stream_proxy_module.c
index a0c1cb0..cead588 100644
--- a/nginx-1.19.3/src/stream/ngx_stream_proxy_module.c
+++ b/nginx-1.19.3/src/stream/ngx_stream_proxy_module.c
@@ -8,6 +8,9 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_stream.h>
+#if (NGX_STREAM_LUA_KONG)
+#include <ngx_stream_lua_kong_module.h>
+#endif


typedef struct {
@@ -799,8 +802,18 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)

#if (NGX_STREAM_SSL)

+#if (NGX_STREAM_LUA_KONG)
+
+ if (pc->type == SOCK_STREAM && pscf->ssl
+ && !ngx_stream_lua_kong_get_proxy_ssl_disable(s))
+ {
+
+#else
+
if (pc->type == SOCK_STREAM && pscf->ssl) {

+#endif
+
if (u->proxy_protocol) {
if (ngx_stream_proxy_send_proxy_protocol(s) != NGX_OK) {
return;
@@ -1052,7 +1065,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
return;
}

+#if (NGX_STREAM_LUA_KONG)
+ if (pscf->ssl_server_name || ngx_stream_lua_kong_get_upstream_ssl_verify(s, pscf->ssl_verify)) {
+#else
if (pscf->ssl_server_name || pscf->ssl_verify) {
+#endif
if (ngx_stream_proxy_ssl_name(s) != NGX_OK) {
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
return;
@@ -1068,6 +1085,10 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
}
}

+#if (NGX_STREAM_LUA_KONG)
+ ngx_stream_lua_kong_set_upstream_ssl(s, pc);
+#endif
+
s->connection->log->action = "SSL handshaking to upstream";

rc = ngx_ssl_handshake(pc);
@@ -1100,7 +1121,11 @@ ngx_stream_proxy_ssl_handshake(ngx_connection_t *pc)

if (pc->ssl->handshaked) {

+#if (NGX_STREAM_LUA_KONG)
+ if (ngx_stream_lua_kong_get_upstream_ssl_verify(s, pscf->ssl_verify)) {
+#else
if (pscf->ssl_verify) {
+#endif
rc = SSL_get_verify_result(pc->ssl->connection);

if (rc != X509_V_OK) {

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
diff --git a/nginx-1.19.9/src/stream/ngx_stream_proxy_module.c b/nginx-1.19.9/src/stream/ngx_stream_proxy_module.c
index b3d8a43..2881474 100644
--- a/nginx-1.19.9/src/stream/ngx_stream_proxy_module.c
+++ b/nginx-1.19.9/src/stream/ngx_stream_proxy_module.c
@@ -8,6 +8,9 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_stream.h>
+#if (NGX_STREAM_LUA_KONG)
+#include <ngx_stream_lua_kong_module.h>
+#endif


typedef struct {
@@ -812,8 +815,18 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)

#if (NGX_STREAM_SSL)

+#if (NGX_STREAM_LUA_KONG)
+
+ if (pc->type == SOCK_STREAM && pscf->ssl
+ && !ngx_stream_lua_kong_get_proxy_ssl_disable(s))
+ {
+
+#else
+
if (pc->type == SOCK_STREAM && pscf->ssl) {

+#endif
+
if (u->proxy_protocol) {
if (ngx_stream_proxy_send_proxy_protocol(s) != NGX_OK) {
return;
@@ -1076,7 +1089,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
return;
}

+#if (NGX_STREAM_LUA_KONG)
+ if (pscf->ssl_server_name || ngx_stream_lua_kong_get_upstream_ssl_verify(s, pscf->ssl_verify)) {
+#else
if (pscf->ssl_server_name || pscf->ssl_verify) {
+#endif
if (ngx_stream_proxy_ssl_name(s) != NGX_OK) {
ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
return;
@@ -1092,6 +1109,10 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
}
}

+#if (NGX_STREAM_LUA_KONG)
+ ngx_stream_lua_kong_set_upstream_ssl(s, pc);
+#endif
+
s->connection->log->action = "SSL handshaking to upstream";

rc = ngx_ssl_handshake(pc);
@@ -1124,7 +1145,11 @@ ngx_stream_proxy_ssl_handshake(ngx_connection_t *pc)

if (pc->ssl->handshaked) {

+#if (NGX_STREAM_LUA_KONG)
+ if (ngx_stream_lua_kong_get_upstream_ssl_verify(s, pscf->ssl_verify)) {
+#else
if (pscf->ssl_verify) {
+#endif
rc = SSL_get_verify_result(pc->ssl->connection);

if (rc != X509_V_OK) {

0 comments on commit 25a7c1e

Please sign in to comment.