Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/event
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-09-08 18:36:09 +0400
committerIgor Sysoev <igor@sysoev.ru>2005-09-08 18:36:09 +0400
commite573380f247f4840dd27b40e76c587196a84f106 (patch)
tree2bf9b16bbd3f9213fcb05fe3962938f24bf02677 /src/event
parent6f8cd96a9b0394589fbcfa75e9d26ef4f881d51b (diff)
nginx-0.1.45-RELEASE importrelease-0.1.45
*) Change: the "ssl_engine" directive was canceled in the ngx_http_ssl_module and now is introduced at global level. *) Bugfix: the responses with SSI subrequests did not transferred via SSL connection. *) Various bug fixes in the IMAP/POP3 proxy.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/modules/ngx_aio_module.c8
-rw-r--r--src/event/modules/ngx_devpoll_module.c8
-rw-r--r--src/event/modules/ngx_epoll_module.c8
-rw-r--r--src/event/modules/ngx_iocp_module.c8
-rw-r--r--src/event/modules/ngx_kqueue_module.c8
-rw-r--r--src/event/modules/ngx_poll_module.c8
-rw-r--r--src/event/modules/ngx_rtsig_module.c8
-rw-r--r--src/event/modules/ngx_select_module.c8
-rw-r--r--src/event/ngx_event.c16
-rw-r--r--src/event/ngx_event_connect.c21
-rw-r--r--src/event/ngx_event_openssl.c126
-rw-r--r--src/event/ngx_event_openssl.h8
12 files changed, 210 insertions, 25 deletions
diff --git a/src/event/modules/ngx_aio_module.c b/src/event/modules/ngx_aio_module.c
index 37d520a96..bf78a8e00 100644
--- a/src/event/modules/ngx_aio_module.c
+++ b/src/event/modules/ngx_aio_module.c
@@ -58,8 +58,14 @@ ngx_module_t ngx_aio_module = {
&ngx_aio_module_ctx, /* module context */
NULL, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c
index cab5af074..413b0def4 100644
--- a/src/event/modules/ngx_devpoll_module.c
+++ b/src/event/modules/ngx_devpoll_module.c
@@ -95,8 +95,14 @@ ngx_module_t ngx_devpoll_module = {
&ngx_devpoll_module_ctx, /* module context */
ngx_devpoll_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c
index 9847e0fe4..75a0b0f4b 100644
--- a/src/event/modules/ngx_epoll_module.c
+++ b/src/event/modules/ngx_epoll_module.c
@@ -125,8 +125,14 @@ ngx_module_t ngx_epoll_module = {
&ngx_epoll_module_ctx, /* module context */
ngx_epoll_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_iocp_module.c b/src/event/modules/ngx_iocp_module.c
index 1bb677c63..5c9e7e68f 100644
--- a/src/event/modules/ngx_iocp_module.c
+++ b/src/event/modules/ngx_iocp_module.c
@@ -73,8 +73,14 @@ ngx_module_t ngx_iocp_module = {
&ngx_iocp_module_ctx, /* module context */
ngx_iocp_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 713ea1a07..78ebbad95 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -98,8 +98,14 @@ ngx_module_t ngx_kqueue_module = {
&ngx_kqueue_module_ctx, /* module context */
ngx_kqueue_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c
index 97ac7ccc4..68d592cca 100644
--- a/src/event/modules/ngx_poll_module.c
+++ b/src/event/modules/ngx_poll_module.c
@@ -54,8 +54,14 @@ ngx_module_t ngx_poll_module = {
&ngx_poll_module_ctx, /* module context */
NULL, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_rtsig_module.c b/src/event/modules/ngx_rtsig_module.c
index 838b27d70..69792c67c 100644
--- a/src/event/modules/ngx_rtsig_module.c
+++ b/src/event/modules/ngx_rtsig_module.c
@@ -122,8 +122,14 @@ ngx_module_t ngx_rtsig_module = {
&ngx_rtsig_module_ctx, /* module context */
ngx_rtsig_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/modules/ngx_select_module.c b/src/event/modules/ngx_select_module.c
index 4cf88400c..7cb338182 100644
--- a/src/event/modules/ngx_select_module.c
+++ b/src/event/modules/ngx_select_module.c
@@ -67,8 +67,14 @@ ngx_module_t ngx_select_module = {
&ngx_select_module_ctx, /* module context */
NULL, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index 274be6c52..5557c340d 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -95,8 +95,14 @@ ngx_module_t ngx_events_module = {
&ngx_events_module_ctx, /* module context */
ngx_events_commands, /* module directives */
NGX_CORE_MODULE, /* module type */
+ NULL, /* init master */
NULL, /* init module */
- NULL /* init process */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
@@ -167,8 +173,14 @@ ngx_module_t ngx_event_core_module = {
&ngx_event_core_module_ctx, /* module context */
ngx_event_core_commands, /* module directives */
NGX_EVENT_MODULE, /* module type */
+ NULL, /* init master */
ngx_event_module_init, /* init module */
- ngx_event_process_init /* init process */
+ ngx_event_process_init, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
};
diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c
index 7cab38cb7..be1d9638a 100644
--- a/src/event/ngx_event_connect.c
+++ b/src/event/ngx_event_connect.c
@@ -17,7 +17,7 @@ ngx_int_t
ngx_event_connect_peer(ngx_peer_connection_t *pc)
{
int rc;
- ngx_uint_t instance;
+ ngx_uint_t instance, level;
u_int event;
time_t now;
ngx_err_t err;
@@ -283,20 +283,15 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc)
/* Winsock returns WSAEWOULDBLOCK (NGX_EAGAIN) */
if (err != NGX_EINPROGRESS && err != NGX_EAGAIN) {
- ngx_connection_error(c, err, "connect() failed");
-#if 0
-#undef sun
- {
- struct sockaddr_un *sun;
-
- sun = (struct sockaddr_un *) peer->sockaddr;
-
- ngx_log_error(NGX_LOG_ALERT, pc->log, 0,
- "\"%s\", f:%d, l:%uz",
- sun->sun_path, sun->sun_family, peer->socklen);
+ if (err == NGX_ECONNREFUSED || err == NGX_EHOSTUNREACH) {
+ level = NGX_LOG_ERR;
+ } else {
+ level = NGX_LOG_CRIT;
}
-#endif
+
+ ngx_log_error(level, c->log, err, "connect() to %V failed",
+ &peer->name);
return NGX_CONNECT_ERROR;
}
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 4c7deb336..b02926a74 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -8,12 +8,62 @@
#include <ngx_core.h>
#include <ngx_event.h>
-#include <openssl/engine.h>
+
+typedef struct {
+ ngx_str_t engine;
+} ngx_openssl_conf_t;
static ngx_int_t ngx_ssl_handle_recv(ngx_connection_t *c, int n);
static void ngx_ssl_write_handler(ngx_event_t *wev);
static void ngx_ssl_read_handler(ngx_event_t *rev);
+static void *ngx_openssl_create_conf(ngx_cycle_t *cycle);
+static char *ngx_openssl_init_conf(ngx_cycle_t *cycle, void *conf);
+
+#if !(NGX_SSL_ENGINE)
+static char *ngx_openssl_noengine(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
+#endif
+
+
+static ngx_command_t ngx_openssl_commands[] = {
+
+ { ngx_string("ssl_engine"),
+ NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+#if (NGX_SSL_ENGINE)
+ ngx_conf_set_str_slot,
+#else
+ ngx_openssl_noengine,
+#endif
+ 0,
+ offsetof(ngx_openssl_conf_t, engine),
+ NULL },
+
+ ngx_null_command
+};
+
+
+static ngx_core_module_t ngx_openssl_module_ctx = {
+ ngx_string("openssl"),
+ ngx_openssl_create_conf,
+ ngx_openssl_init_conf
+};
+
+
+ngx_module_t ngx_openssl_module = {
+ NGX_MODULE_V1,
+ &ngx_openssl_module_ctx, /* module context */
+ ngx_openssl_commands, /* module directives */
+ NGX_CORE_MODULE, /* module type */
+ NULL, /* init master */
+ NULL, /* init module */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
+};
ngx_int_t
@@ -21,7 +71,10 @@ ngx_ssl_init(ngx_log_t *log)
{
SSL_library_init();
SSL_load_error_strings();
+
+#if (NGX_SSL_ENGINE)
ENGINE_load_builtin_engines();
+#endif
return NGX_OK;
}
@@ -638,3 +691,74 @@ ngx_ssl_cleanup_ctx(void *data)
SSL_CTX_free(ctx);
}
+
+
+static void *
+ngx_openssl_create_conf(ngx_cycle_t *cycle)
+{
+ ngx_openssl_conf_t *oscf;
+
+ oscf = ngx_pcalloc(cycle->pool, sizeof(ngx_openssl_conf_t));
+ if (oscf == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ /*
+ * set by ngx_pcalloc():
+ *
+ * oscf->engine.len = 0;
+ * oscf->engine.data = NULL;
+ */
+
+ return oscf;
+}
+
+
+static char *
+ngx_openssl_init_conf(ngx_cycle_t *cycle, void *conf)
+{
+#if (NGX_SSL_ENGINE)
+ ngx_openssl_conf_t *oscf = conf;
+
+ ENGINE *engine;
+
+ if (oscf->engine.len == 0) {
+ return NGX_CONF_OK;
+ }
+
+ engine = ENGINE_by_id((const char *) oscf->engine.data);
+
+ if (engine == NULL) {
+ ngx_ssl_error(NGX_LOG_WARN, cycle->log, 0,
+ "ENGINE_by_id(\"%V\") failed", &oscf->engine);
+ return NGX_CONF_ERROR;
+ }
+
+ if (ENGINE_set_default(engine, ENGINE_METHOD_ALL) == 0) {
+ ngx_ssl_error(NGX_LOG_WARN, cycle->log, 0,
+ "ENGINE_set_default(\"%V\", ENGINE_METHOD_ALL) failed",
+ &oscf->engine);
+ return NGX_CONF_ERROR;
+ }
+
+ ENGINE_free(engine);
+
+#endif
+
+ return NGX_CONF_OK;
+}
+
+
+#if !(NGX_SSL_ENGINE)
+
+static char *
+ngx_openssl_noengine(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"ssl_engine\" is not supported: " NGX_SSL_NAME
+ " library does not support crypto accelerators");
+
+ return NGX_CONF_ERROR;
+}
+
+#endif
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
index 7fc6bc092..f298aeb10 100644
--- a/src/event/ngx_event_openssl.h
+++ b/src/event/ngx_event_openssl.h
@@ -14,6 +14,13 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
+#if OPENSSL_VERSION_NUMBER >= 0x00907000
+#include <openssl/engine.h>
+#define NGX_SSL_ENGINE 1
+#endif
+
+#define NGX_SSL_NAME "OpenSSL"
+
typedef struct {
SSL *ssl;
@@ -38,7 +45,6 @@ typedef SSL_CTX ngx_ssl_ctx_t;
#define NGX_SSL_BUFFER 1
-
#define NGX_SSL_BUFSIZE 16384