Skip to content

Commit

Permalink
Modules compatibility: compatibility with NGX_HTTP_SSL.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mdounin committed Oct 10, 2016
1 parent 844c785 commit 8fd8c32
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/core/ngx_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 15 additions & 13 deletions src/core/ngx_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/core/ngx_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 1 addition & 4 deletions src/event/ngx_event_connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/event/ngx_event_openssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/http/ngx_http_core_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 1 addition & 3 deletions src/http/ngx_http_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/http/ngx_http_upstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/http/ngx_http_upstream_round_robin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8fd8c32

Please sign in to comment.