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.
This commit is contained in:
Maxim Dounin 2016-10-10 18:44:17 +03:00
parent 844c78556b
commit 8fd8c32ccf
9 changed files with 26 additions and 33 deletions

View File

@ -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

View File

@ -25,6 +25,8 @@ 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);

View File

@ -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"

View File

@ -27,13 +27,10 @@ typedef void (*ngx_event_free_peer_pt)(ngx_peer_connection_t *pc, void *data,
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

View File

@ -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

View File

@ -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;
};

View File

@ -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;

View File

@ -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

View File

@ -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