[nginx] Modules compatibility: compatibility with NGX_HTTP_SSL.
Maxim Dounin
mdounin at mdounin.ru
Mon Oct 10 16:51:50 UTC 2016
details: http://hg.nginx.org/nginx/rev/e38e9c50a40e
branches:
changeset: 6735:e38e9c50a40e
user: Maxim Dounin <mdounin at mdounin.ru>
date: Mon Oct 10 18:44:17 2016 +0300
description:
Modules compatibility: compatibility with NGX_HTTP_SSL.
With this change it is now possible to load modules compiled without
the "--with-http_ssl_module" configure option into nginx binary compiled
with it, and vice versa (if a module doesn't use ssl-specific functions),
assuming both use the "--with-compat" option.
diffstat:
src/core/ngx_connection.h | 2 +-
src/core/ngx_core.h | 28 +++++++++++++++-------------
src/core/ngx_module.h | 2 +-
src/event/ngx_event_connect.h | 5 +----
src/event/ngx_event_openssl.h | 8 ++++----
src/http/ngx_http_core_module.h | 4 ----
src/http/ngx_http_request.h | 4 +---
src/http/ngx_http_upstream.h | 4 ++--
src/http/ngx_http_upstream_round_robin.h | 2 +-
9 files changed, 26 insertions(+), 33 deletions(-)
diffs (196 lines):
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -147,7 +147,7 @@ struct ngx_connection_s {
ngx_str_t proxy_protocol_addr;
in_port_t proxy_protocol_port;
-#if (NGX_SSL)
+#if (NGX_SSL || NGX_COMPAT)
ngx_ssl_connection_t *ssl;
#endif
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -12,19 +12,21 @@
#include <ngx_config.h>
-typedef struct ngx_module_s ngx_module_t;
-typedef struct ngx_conf_s ngx_conf_t;
-typedef struct ngx_cycle_s ngx_cycle_t;
-typedef struct ngx_pool_s ngx_pool_t;
-typedef struct ngx_chain_s ngx_chain_t;
-typedef struct ngx_log_s ngx_log_t;
-typedef struct ngx_open_file_s ngx_open_file_t;
-typedef struct ngx_command_s ngx_command_t;
-typedef struct ngx_file_s ngx_file_t;
-typedef struct ngx_event_s ngx_event_t;
-typedef struct ngx_event_aio_s ngx_event_aio_t;
-typedef struct ngx_connection_s ngx_connection_t;
-typedef struct ngx_thread_task_s ngx_thread_task_t;
+typedef struct ngx_module_s ngx_module_t;
+typedef struct ngx_conf_s ngx_conf_t;
+typedef struct ngx_cycle_s ngx_cycle_t;
+typedef struct ngx_pool_s ngx_pool_t;
+typedef struct ngx_chain_s ngx_chain_t;
+typedef struct ngx_log_s ngx_log_t;
+typedef struct ngx_open_file_s ngx_open_file_t;
+typedef struct ngx_command_s ngx_command_t;
+typedef struct ngx_file_s ngx_file_t;
+typedef struct ngx_event_s ngx_event_t;
+typedef struct ngx_event_aio_s ngx_event_aio_t;
+typedef struct ngx_connection_s ngx_connection_t;
+typedef struct ngx_thread_task_s ngx_thread_task_t;
+typedef struct ngx_ssl_s ngx_ssl_t;
+typedef struct ngx_ssl_connection_s ngx_ssl_connection_t;
typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
diff --git a/src/core/ngx_module.h b/src/core/ngx_module.h
--- a/src/core/ngx_module.h
+++ b/src/core/ngx_module.h
@@ -139,7 +139,7 @@
#define NGX_MODULE_SIGNATURE_23 "0"
#endif
-#if (NGX_HTTP_SSL)
+#if (NGX_HTTP_SSL || NGX_COMPAT)
#define NGX_MODULE_SIGNATURE_24 "1"
#else
#define NGX_MODULE_SIGNATURE_24 "0"
diff --git a/src/event/ngx_event_connect.h b/src/event/ngx_event_connect.h
--- a/src/event/ngx_event_connect.h
+++ b/src/event/ngx_event_connect.h
@@ -27,13 +27,10 @@ typedef void (*ngx_event_free_peer_pt)(n
ngx_uint_t state);
typedef void (*ngx_event_notify_peer_pt)(ngx_peer_connection_t *pc,
void *data, ngx_uint_t type);
-#if (NGX_SSL)
-
typedef ngx_int_t (*ngx_event_set_peer_session_pt)(ngx_peer_connection_t *pc,
void *data);
typedef void (*ngx_event_save_peer_session_pt)(ngx_peer_connection_t *pc,
void *data);
-#endif
struct ngx_peer_connection_s {
@@ -51,7 +48,7 @@ struct ngx_peer_connection_s {
ngx_event_notify_peer_pt notify;
void *data;
-#if (NGX_SSL)
+#if (NGX_SSL || NGX_COMPAT)
ngx_event_set_peer_session_pt set_session;
ngx_event_save_peer_session_pt save_session;
#endif
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
--- a/src/event/ngx_event_openssl.h
+++ b/src/event/ngx_event_openssl.h
@@ -54,14 +54,14 @@
#define ngx_ssl_conn_t SSL
-typedef struct {
+struct ngx_ssl_s {
SSL_CTX *ctx;
ngx_log_t *log;
size_t buffer_size;
-} ngx_ssl_t;
+};
-typedef struct {
+struct ngx_ssl_connection_s {
ngx_ssl_conn_t *connection;
SSL_CTX *session_ctx;
@@ -80,7 +80,7 @@ typedef struct {
unsigned no_wait_shutdown:1;
unsigned no_send_shutdown:1;
unsigned handshake_buffer_set:1;
-} ngx_ssl_connection_t;
+};
#define NGX_SSL_NO_SCACHE -2
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -67,9 +67,7 @@ typedef struct {
unsigned default_server:1;
unsigned bind:1;
unsigned wildcard:1;
-#if (NGX_HTTP_SSL)
unsigned ssl:1;
-#endif
unsigned http2:1;
#if (NGX_HAVE_INET6)
unsigned ipv6only:1;
@@ -230,9 +228,7 @@ struct ngx_http_addr_conf_s {
ngx_http_virtual_names_t *virtual_names;
-#if (NGX_HTTP_SSL)
unsigned ssl:1;
-#endif
unsigned http2:1;
unsigned proxy_protocol:1;
};
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -300,7 +300,7 @@ typedef struct {
ngx_http_addr_conf_t *addr_conf;
ngx_http_conf_ctx_t *conf_ctx;
-#if (NGX_HTTP_SSL)
+#if (NGX_HTTP_SSL || NGX_COMPAT)
ngx_str_t *ssl_servername;
#if (NGX_PCRE)
ngx_http_regex_t *ssl_servername_regex;
@@ -313,9 +313,7 @@ typedef struct {
ngx_buf_t **free;
ngx_int_t nfree;
-#if (NGX_HTTP_SSL)
unsigned ssl:1;
-#endif
unsigned proxy_protocol:1;
} ngx_http_connection_t;
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -222,7 +222,7 @@ typedef struct {
unsigned intercept_404:1;
unsigned change_buffering:1;
-#if (NGX_HTTP_SSL)
+#if (NGX_HTTP_SSL || NGX_COMPAT)
ngx_ssl_t *ssl;
ngx_flag_t ssl_session_reuse;
@@ -367,7 +367,7 @@ struct ngx_http_upstream_s {
ngx_str_t schema;
ngx_str_t uri;
-#if (NGX_HTTP_SSL)
+#if (NGX_HTTP_SSL || NGX_COMPAT)
ngx_str_t ssl_name;
#endif
diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
--- a/src/http/ngx_http_upstream_round_robin.h
+++ b/src/http/ngx_http_upstream_round_robin.h
@@ -40,7 +40,7 @@ struct ngx_http_upstream_rr_peer_s {
ngx_uint_t down;
-#if (NGX_HTTP_SSL)
+#if (NGX_HTTP_SSL || NGX_COMPAT)
void *ssl_session;
int ssl_session_len;
#endif
More information about the nginx-devel
mailing list