changeset 541:b09ee85d0ac8 release-0.1.45

nginx-0.1.45-RELEASE import *) 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.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 08 Sep 2005 14:36:09 +0000
parents 983c48ab79bb
children 3a7cecdbb994
files auto/lib/openssl/conf auto/make auto/modules auto/sources docs/xml/nginx/changes.xml src/core/nginx.c src/core/nginx.h src/core/ngx_conf_file.c src/core/ngx_conf_file.h src/core/ngx_connection.c src/core/ngx_log.c src/event/modules/ngx_aio_module.c src/event/modules/ngx_devpoll_module.c src/event/modules/ngx_epoll_module.c src/event/modules/ngx_iocp_module.c src/event/modules/ngx_kqueue_module.c src/event/modules/ngx_poll_module.c src/event/modules/ngx_rtsig_module.c src/event/modules/ngx_select_module.c src/event/ngx_event.c src/event/ngx_event_connect.c src/event/ngx_event_openssl.c src/event/ngx_event_openssl.h src/http/modules/ngx_http_access_module.c src/http/modules/ngx_http_auth_basic_module.c src/http/modules/ngx_http_autoindex_module.c src/http/modules/ngx_http_charset_filter_module.c src/http/modules/ngx_http_chunked_filter_module.c src/http/modules/ngx_http_fastcgi_module.c src/http/modules/ngx_http_geo_module.c src/http/modules/ngx_http_gzip_filter_module.c src/http/modules/ngx_http_headers_filter_module.c src/http/modules/ngx_http_index_module.c src/http/modules/ngx_http_not_modified_filter_module.c src/http/modules/ngx_http_proxy_module.c src/http/modules/ngx_http_range_filter_module.c src/http/modules/ngx_http_rewrite_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/ngx_http_ssl_module.c src/http/modules/ngx_http_ssl_module.h src/http/modules/ngx_http_static_module.c src/http/modules/ngx_http_stub_status_module.c src/http/modules/ngx_http_userid_filter_module.c src/http/ngx_http.c src/http/ngx_http_copy_filter_module.c src/http/ngx_http_core_module.c src/http/ngx_http_header_filter_module.c src/http/ngx_http_log_module.c src/http/ngx_http_postpone_filter_module.c src/http/ngx_http_upstream.c src/http/ngx_http_write_filter_module.c src/imap/ngx_imap.c src/imap/ngx_imap.h src/imap/ngx_imap_auth_http_module.c src/imap/ngx_imap_core_module.c src/imap/ngx_imap_handler.c src/imap/ngx_imap_proxy_module.c src/imap/ngx_imap_ssl_module.c src/os/unix/ngx_posix_init.c src/os/win32/ngx_win32_init.c
diffstat 60 files changed, 732 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- a/auto/lib/openssl/conf
+++ b/auto/lib/openssl/conf
@@ -4,8 +4,6 @@
 
 if [ $OPENSSL != NONE ]; then
     CORE_INCS="$CORE_INCS $OPENSSL/include"
-    CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS"
-    CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS"
 
     case "$CC" in
         *)
@@ -36,8 +34,6 @@ else
         . auto/feature
 
         if [ $ngx_found = yes ]; then
-            CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS"
-            CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS"
             CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             OPENSSL=YES
         fi
--- a/auto/make
+++ b/auto/make
@@ -124,7 +124,7 @@ if test -n "$NGX_ADDON_SRCS"; then
 
 cat << END                                                >> $NGX_MAKEFILE
 
-ADDON_DEPS = \$(CORE_DPES) $NGX_ADDON_DEPS
+ADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPS
 
 END
 
--- a/auto/modules
+++ b/auto/modules
@@ -61,17 +61,22 @@ if [ $HTTP_SSI = YES ]; then
     HTTP_POSTPONE=YES
 fi
 
+# the module order is important
+#     ngx_http_autoindex_module
+#     ngx_http_index_module
+#
+#
 # the filter order is important
 #     ngx_http_write_filter
 #     ngx_http_header_filter
 #     ngx_http_chunked_filter
 #     ngx_http_range_header_filter
-#     ngx_http_ssl_filter
 #     ngx_http_gzip_filter
 #     ngx_http_postpone_filter
 #     ngx_http_charset_filter
 #     ngx_http_ssi_filter
-#     ngx_http_headers_filter
+#         ngx_http_userid_filter
+#         ngx_http_headers_filter
 #     ngx_http_copy_filter
 #     ngx_http_range_body_filter
 #     ngx_http_not_modified_filter
@@ -212,8 +217,23 @@ if test -n "$NGX_ADDONS"; then
 fi
 
 
+if [ $IMAP_SSL = YES ]; then
+    IMAP_DEPS="$IMAP_DEPS $IMAP_SSL_DEPS"
+    IMAP_SRCS="$IMAP_SRCS $IMAP_SSL_SRCS"
+    have=NGX_IMAP_SSL . auto/have
+    USE_OPENSSL=YES
+fi
+
+
 modules="$CORE_MODULES $EVENT_MODULES"
 
+
+if [ $USE_OPENSSL = YES ]; then
+    modules="$modules $OPENSSL_MODULE"
+    CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS"
+    CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS"
+fi
+
 if [ $HTTP = YES ]; then
     modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES \
              $HTTP_HEADERS_FILTER_MODULE \
@@ -230,10 +250,6 @@ if [ $IMAP = YES ]; then
 
     if [ $IMAP_SSL = YES ]; then
         modules="$modules $IMAP_SSL_MODULE"
-        IMAP_DEPS="$IMAP_DEPS $IMAP_SSL_DEPS"
-        IMAP_SRCS="$IMAP_SRCS $IMAP_SSL_SRCS"
-        have=NGX_IMAP_SSL . auto/have
-        USE_OPENSSL=YES
     fi
 
     modules="$modules $IMAP_AUTH_HTTP_MODULE"
--- a/auto/sources
+++ b/auto/sources
@@ -55,6 +55,11 @@ REGEX_DEPS=src/core/ngx_regex.h
 REGEX_SRCS=src/core/ngx_regex.c
 
 
+OPENSSL_MODULE=ngx_openssl_module
+OPENSSL_DEPS=src/event/ngx_event_openssl.h
+OPENSSL_SRCS=src/event/ngx_event_openssl.c
+
+
 EVENT_MODULES="ngx_events_module ngx_event_core_module"
 
 EVENT_INCS="src/event src/event/modules"
@@ -104,10 +109,6 @@ AIO_SRCS="src/event/modules/ngx_aio_modu
           src/os/unix/ngx_aio_write_chain.c"
 
 
-OPENSSL_DEPS=src/event/ngx_event_openssl.h
-OPENSSL_SRCS=src/event/ngx_event_openssl.c
-
-
 UNIX_INCS="$CORE_INCS $EVENT_INCS src/os/unix"
 
 UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,41 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.1.45" date="08.09.2005">
+
+<change type="change">
+<para lang="ru">
+директива ssl_engine упразднена в модуле ngx_http_ssl_module и
+перенесена на глобальный уровень.
+</para>
+<para lang="en">
+the "ssl_engine" directive is canceled in the ngx_http_ssl_module
+and now is introduced at global level.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ответы с подзапросами, включённые с помощью SSI, не передавались
+через SSL соединение.
+</para>
+<para lang="en">
+the responses with SSI subrequests did not transferred via SSL connection.
+</para>
+</change>
+
+<change>
+<para lang="ru">
+Разные исправления в IMAP/POP3 прокси.
+</para>
+<para lang="en">
+Various bug fixes in the IMAP/POP3 proxy.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.1.44" date="06.09.2005">
 
 <change type="feature">
@@ -22,10 +57,10 @@ the IMAP/POP3 proxy supports SSL.
 
 <change type="feature">
 <para lang="ru">
-директива proxy_timeout.
+директива proxy_timeout модуля ngx_imap_proxy_module.
 </para>
 <para lang="en">
-the "proxy_timeout" directive.
+the "proxy_timeout" directive of the ngx_imap_proxy_module.
 </para>
 </change>
 
@@ -75,7 +110,7 @@ the geo2nginx.pl script was added to con
 
 <change type="change">
 <para lang="ru">
-параметры FastCGI, с пустым значениями, теперь передаются серверу.
+параметры FastCGI с пустым значениями теперь передаются серверу.
 </para>
 <para lang="en">
 the FastCGI parameters with the empty values now are passed to a server.
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -118,8 +118,14 @@ ngx_module_t  ngx_core_module = {
     &ngx_core_module_ctx,                  /* module context */
     ngx_core_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
 };
 
 
@@ -153,6 +159,7 @@ main(int argc, char *const *argv)
         return 1;
     }
 
+    /* STUB */
 #if (NGX_OPENSSL)
     ngx_ssl_init(log);
 #endif
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.44"
+#define NGINX_VER          "nginx/0.1.45"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -31,8 +31,14 @@ ngx_module_t  ngx_conf_module = {
     NULL,                                  /* module context */
     ngx_conf_commands,                     /* module directives */
     NGX_CONF_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
 };
 
 
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -65,8 +65,6 @@
 #define NGX_CONF_BLOCK_DONE  2
 #define NGX_CONF_FILE_DONE   3
 
-#define NGX_MODULE_V1        0, 0, 1, 0, 0
-
 #define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
 #define NGX_CONF_MODULE      0x464E4F43  /* "CONF" */
 
@@ -99,21 +97,42 @@ struct ngx_open_file_s {
 };
 
 
+#define NGX_MODULE_V1          0, 0, 1, 0, 0, 0, 0
+#define NGX_MODULE_V1_PADDING  0, 0, 0, 0, 0, 0, 0, 0
+
 struct ngx_module_s {
     ngx_uint_t            ctx_index;
     ngx_uint_t            index;
     ngx_uint_t            version;
+
     ngx_uint_t            spare0;
     ngx_uint_t            spare1;
+    ngx_uint_t            spare2;
+    ngx_uint_t            spare3;
 
     void                 *ctx;
     ngx_command_t        *commands;
     ngx_uint_t            type;
+
+    ngx_int_t           (*init_master)(ngx_log_t *log);
+
     ngx_int_t           (*init_module)(ngx_cycle_t *cycle);
+
     ngx_int_t           (*init_process)(ngx_cycle_t *cycle);
-#if 0
     ngx_int_t           (*init_thread)(ngx_cycle_t *cycle);
-#endif
+    ngx_int_t           (*exit_thread)(ngx_cycle_t *cycle);
+    ngx_int_t           (*exit_process)(ngx_cycle_t *cycle);
+
+    ngx_int_t           (*exit_master)(ngx_cycle_t *cycle);
+
+    uintptr_t             spare_hook0;
+    uintptr_t             spare_hook1;
+    uintptr_t             spare_hook2;
+    uintptr_t             spare_hook3;
+    uintptr_t             spare_hook4;
+    uintptr_t             spare_hook5;
+    uintptr_t             spare_hook6;
+    uintptr_t             spare_hook7;
 };
 
 
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -67,6 +67,7 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
     ngx_listening_t           *ls;
     struct sockaddr_in        *sin;
 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
+    ngx_err_t                  err;
     socklen_t                  aflen;
     struct accept_filter_arg   af;
 #endif
@@ -133,7 +134,13 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
         if (getsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, &af, &aflen)
             == -1)
         {
-            ngx_log_error(NGX_LOG_NOTICE, cycle->log, ngx_errno,
+            err = ngx_errno;
+
+            if (err == NGX_EINVAL) {
+                continue;
+            }
+
+            ngx_log_error(NGX_LOG_NOTICE, cycle->log, err,
                           "getsockopt(SO_ACCEPTFILTER) for %V failed, ignored",
                           &ls[i].addr_text);
             continue;
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -37,8 +37,14 @@ ngx_module_t  ngx_errlog_module = {
     &ngx_errlog_module_ctx,                /* module context */
     ngx_errlog_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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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
 };
 
 
--- 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_connecti
         /* 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;
+            if (err == NGX_ECONNREFUSED || err == NGX_EHOSTUNREACH) {
+                level = NGX_LOG_ERR;
+            } else {
+                level = NGX_LOG_CRIT;
+            }
 
-            ngx_log_error(NGX_LOG_ALERT, pc->log, 0,
-                          "\"%s\", f:%d, l:%uz",
-                          sun->sun_path, sun->sun_family, peer->socklen);
-            }
-#endif
+            ngx_log_error(level, c->log, err, "connect() to %V failed",
+                          &peer->name);
 
             return NGX_CONNECT_ERROR;
         }
--- 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
--- 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
 
 
--- a/src/http/modules/ngx_http_access_module.c
+++ b/src/http/modules/ngx_http_access_module.c
@@ -73,8 +73,14 @@ ngx_module_t  ngx_http_access_module = {
     &ngx_http_access_module_ctx,           /* module context */
     ngx_http_access_commands,              /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_access_init,                  /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -79,8 +79,14 @@ ngx_module_t  ngx_http_auth_basic_module
     &ngx_http_auth_basic_module_ctx,       /* module context */
     ngx_http_auth_basic_commands,          /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_auth_basic_init,              /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -99,8 +99,14 @@ ngx_module_t  ngx_http_autoindex_module 
     &ngx_http_autoindex_module_ctx,        /* module context */ 
     ngx_http_autoindex_commands,           /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_autoindex_init,               /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_charset_filter_module.c
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -121,8 +121,14 @@ ngx_module_t  ngx_http_charset_filter_mo
     &ngx_http_charset_filter_module_ctx,   /* module context */
     ngx_http_charset_filter_commands,      /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_charset_filter_init,          /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_chunked_filter_module.c
+++ b/src/http/modules/ngx_http_chunked_filter_module.c
@@ -32,8 +32,14 @@ ngx_module_t  ngx_http_chunked_filter_mo
     &ngx_http_chunked_filter_module_ctx,   /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_chunked_filter_init,          /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -330,8 +330,14 @@ ngx_module_t  ngx_http_fastcgi_module = 
     &ngx_http_fastcgi_module_ctx,          /* module context */
     ngx_http_fastcgi_commands,             /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -53,8 +53,14 @@ ngx_module_t  ngx_http_geo_module = {
     &ngx_http_geo_module_ctx,              /* module context */
     ngx_http_geo_commands,                 /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -218,8 +218,14 @@ ngx_module_t  ngx_http_gzip_filter_modul
     &ngx_http_gzip_filter_module_ctx,      /* module context */
     ngx_http_gzip_filter_commands,         /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_gzip_filter_init,             /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -60,8 +60,14 @@ ngx_module_t  ngx_http_headers_filter_mo
     &ngx_http_headers_filter_module_ctx,   /* module context */
     ngx_http_headers_filter_commands,      /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_headers_filter_init,          /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -96,8 +96,14 @@ ngx_module_t  ngx_http_index_module = {
     &ngx_http_index_module_ctx,            /* module context */
     ngx_http_index_commands,               /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_index_init,                   /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_not_modified_filter_module.c
+++ b/src/http/modules/ngx_http_not_modified_filter_module.c
@@ -33,8 +33,14 @@ ngx_module_t  ngx_http_not_modified_filt
     &ngx_http_not_modified_filter_module_ctx, /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_not_modified_filter_init,     /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -295,8 +295,14 @@ ngx_module_t  ngx_http_proxy_module = {
     &ngx_http_proxy_module_ctx,            /* module context */
     ngx_http_proxy_commands,               /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -73,8 +73,14 @@ ngx_module_t  ngx_http_range_header_filt
     &ngx_http_range_header_filter_module_ctx, /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_range_header_filter_init,     /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
@@ -98,8 +104,14 @@ ngx_module_t  ngx_http_range_body_filter
     &ngx_http_range_body_filter_module_ctx, /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_range_body_filter_init,       /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -130,8 +130,14 @@ ngx_module_t  ngx_http_rewrite_module = 
     &ngx_http_rewrite_module_ctx,          /* module context */ 
     ngx_http_rewrite_commands,             /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_rewrite_init,                 /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -200,8 +200,14 @@ ngx_module_t  ngx_http_ssi_filter_module
     &ngx_http_ssi_filter_module_ctx,       /* module context */
     ngx_http_ssi_filter_commands,          /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_ssi_filter_init,              /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -8,15 +8,11 @@
 #include <ngx_core.h>
 #include <ngx_http.h>
 
-#include <openssl/engine.h>
-
 
 #define NGX_DEFLAUT_CERTIFICATE      "cert.pem"
 #define NGX_DEFLAUT_CERTIFICATE_KEY  "cert.pem"
 
 
-static void *ngx_http_ssl_create_main_conf(ngx_conf_t *cf);
-static char *ngx_http_ssl_init_main_conf(ngx_conf_t *cf, void *conf);
 static void *ngx_http_ssl_create_srv_conf(ngx_conf_t *cf);
 static char *ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf,
     void *parent, void *child);
@@ -24,13 +20,6 @@ static char *ngx_http_ssl_merge_srv_conf
 
 static ngx_command_t  ngx_http_ssl_commands[] = {
 
-    { ngx_string("ssl_engine"),
-      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
-      ngx_conf_set_str_slot,
-      NGX_HTTP_MAIN_CONF_OFFSET,
-      offsetof(ngx_http_ssl_main_conf_t, engine),
-      NULL },
-
     { ngx_string("ssl"),
       NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -67,8 +56,8 @@ static ngx_http_module_t  ngx_http_ssl_m
     NULL,                                  /* preconfiguration */
     NULL,                                  /* postconfiguration */
 
-    ngx_http_ssl_create_main_conf,         /* create main configuration */
-    ngx_http_ssl_init_main_conf,           /* init main configuration */
+    NULL,                                  /* create main configuration */
+    NULL,                                  /* init main configuration */
 
     ngx_http_ssl_create_srv_conf,          /* create server configuration */
     ngx_http_ssl_merge_srv_conf,           /* merge server configuration */
@@ -83,65 +72,18 @@ ngx_module_t  ngx_http_ssl_module = {
     &ngx_http_ssl_module_ctx,              /* module context */
     ngx_http_ssl_commands,                 /* module directives */
     NGX_HTTP_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
 };
 
 
 static void *
-ngx_http_ssl_create_main_conf(ngx_conf_t *cf)
-{
-    ngx_http_ssl_main_conf_t  *mcf;
-
-    mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssl_main_conf_t));
-    if (mcf == NULL) {
-        return NGX_CONF_ERROR;
-    }
-
-    /*
-     * set by ngx_pcalloc():
-     *
-     *     mcf->engine.len = 0;
-     *     mcf->engine.data = NULL;
-     */
-
-    return mcf;
-}
-
-
-static char *
-ngx_http_ssl_init_main_conf(ngx_conf_t *cf, void *conf)
-{
-    ngx_http_ssl_main_conf_t *mcf = conf;
-
-    ENGINE  *engine;
-
-    if (mcf->engine.len == 0) {
-        return NGX_CONF_OK;
-    }
-
-    engine = ENGINE_by_id((const char *) mcf->engine.data);
-
-    if (engine == NULL) {
-        ngx_ssl_error(NGX_LOG_WARN, cf->log, 0,
-                      "ENGINE_by_id(\"%V\") failed", &mcf->engine);
-        return NGX_CONF_ERROR;
-    }
-
-    if (ENGINE_set_default(engine, ENGINE_METHOD_ALL) == 0) {
-        ngx_ssl_error(NGX_LOG_WARN, cf->log, 0,
-                      "ENGINE_set_default(\"%V\", ENGINE_METHOD_ALL) failed",
-                      &mcf->engine);
-        return NGX_CONF_ERROR;
-    }
-
-    ENGINE_free(engine);
-
-    return NGX_CONF_OK;
-}
-
-
-static void *
 ngx_http_ssl_create_srv_conf(ngx_conf_t *cf)
 {
     ngx_http_ssl_srv_conf_t  *scf;
@@ -240,12 +182,16 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *
         return NGX_CONF_ERROR;
     }
 
+    SSL_CTX_set_verify(conf->ssl_ctx, SSL_VERIFY_NONE, NULL);
+
     return NGX_CONF_OK;
 }
 
 
 #if 0
 
+/* how to enumrate server' configs */
+
 static ngx_int_t
 ngx_http_ssl_init_process(ngx_cycle_t *cycle)
 {
--- a/src/http/modules/ngx_http_ssl_module.h
+++ b/src/http/modules/ngx_http_ssl_module.h
@@ -14,11 +14,6 @@
 
 
 typedef struct {
-    ngx_str_t       engine;
-} ngx_http_ssl_main_conf_t;
-
-
-typedef struct {
     ngx_flag_t      enable;
     ngx_str_t       certificate;
     ngx_str_t       certificate_key;
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -58,8 +58,14 @@ ngx_module_t  ngx_http_static_module = {
     &ngx_http_static_module_ctx,           /* module context */
     ngx_http_static_commands,              /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_static_init,                  /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/modules/ngx_http_stub_status_module.c
+++ b/src/http/modules/ngx_http_stub_status_module.c
@@ -41,8 +41,14 @@ ngx_module_t  ngx_http_stub_status_modul
     &ngx_http_stub_status_module_ctx,      /* module context */
     ngx_http_status_commands,              /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -177,8 +177,14 @@ ngx_module_t  ngx_http_userid_filter_mod
     &ngx_http_userid_filter_module_ctx,    /* module context */
     ngx_http_userid_commands,              /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_userid_init,                  /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -57,8 +57,14 @@ ngx_module_t  ngx_http_module = {
     &ngx_http_module_ctx,                  /* module context */
     ngx_http_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
 };
 
 
--- a/src/http/ngx_http_copy_filter_module.c
+++ b/src/http/ngx_http_copy_filter_module.c
@@ -53,8 +53,14 @@ ngx_module_t  ngx_http_copy_filter_modul
     &ngx_http_copy_filter_module_ctx,      /* module context */
     ngx_http_copy_filter_commands,         /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_copy_filter_init,             /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -383,8 +383,14 @@ ngx_module_t  ngx_http_core_module = {
     &ngx_http_core_module_ctx,             /* module context */
     ngx_http_core_commands,                /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -34,8 +34,14 @@ ngx_module_t  ngx_http_header_filter_mod
     &ngx_http_header_filter_module_ctx,    /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_header_filter_init,           /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/ngx_http_log_module.c
+++ b/src/http/ngx_http_log_module.c
@@ -125,8 +125,14 @@ ngx_module_t  ngx_http_log_module = {
     &ngx_http_log_module_ctx,              /* module context */
     ngx_http_log_commands,                 /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/ngx_http_postpone_filter_module.c
+++ b/src/http/ngx_http_postpone_filter_module.c
@@ -32,8 +32,14 @@ ngx_module_t  ngx_http_postpone_filter_m
     &ngx_http_postpone_filter_module_ctx,  /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_postpone_filter_init,         /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -189,8 +189,14 @@ ngx_module_t  ngx_http_upstream_module =
     &ngx_http_upstream_module_ctx,         /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_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
 };
 
 
--- a/src/http/ngx_http_write_filter_module.c
+++ b/src/http/ngx_http_write_filter_module.c
@@ -33,8 +33,14 @@ ngx_module_t  ngx_http_write_filter_modu
     &ngx_http_write_filter_module_ctx,     /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
     ngx_http_write_filter_init,            /* init module */
-    NULL                                   /* init process */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
 };
 
 
@@ -226,7 +232,7 @@ ngx_http_write_filter(ngx_http_request_t
 
     r->out = chain;
 
-    if (chain || c->buffered) {
+    if (chain || (c->buffered && r->postponed == NULL)) {
         return NGX_AGAIN;
     }
 
--- a/src/imap/ngx_imap.c
+++ b/src/imap/ngx_imap.c
@@ -41,8 +41,14 @@ ngx_module_t  ngx_imap_module = {
     &ngx_imap_module_ctx,                  /* module context */
     ngx_imap_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
 };
 
 
--- a/src/imap/ngx_imap.h
+++ b/src/imap/ngx_imap.h
@@ -123,6 +123,12 @@ typedef struct {
 } ngx_imap_session_t;
 
 
+typedef struct {
+    ngx_str_t           *client;
+    ngx_imap_session_t  *session;
+} ngx_imap_log_ctx_t;
+
+
 #define NGX_POP3_USER       1
 #define NGX_POP3_PASS       2
 #define NGX_POP3_CAPA       3
--- a/src/imap/ngx_imap_auth_http_module.c
+++ b/src/imap/ngx_imap_auth_http_module.c
@@ -105,8 +105,14 @@ ngx_module_t  ngx_imap_auth_http_module 
     &ngx_imap_auth_http_module_ctx,        /* module context */
     ngx_imap_auth_http_commands,           /* module directives */
     NGX_IMAP_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
 };
 
 
@@ -120,6 +126,8 @@ ngx_imap_auth_http_init(ngx_imap_session
     ngx_imap_auth_http_ctx_t   *ctx;
     ngx_imap_auth_http_conf_t  *ahcf;
 
+    s->connection->log->action = "in http auth state";
+
     ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_imap_auth_http_ctx_t));
     if (ctx == NULL) {
         ngx_imap_session_internal_server_error(s);
@@ -142,7 +150,7 @@ ngx_imap_auth_http_init(ngx_imap_session
 
     rc = ngx_event_connect_peer(&ctx->peer);
 
-    if (rc == NGX_ERROR) {
+    if (rc == NGX_ERROR || rc == NGX_CONNECT_ERROR) {
         ngx_imap_session_internal_server_error(s);
         return;
     }
@@ -156,13 +164,13 @@ ngx_imap_auth_http_init(ngx_imap_session
 
     ctx->handler = ngx_imap_auth_http_ignore_status_line;
 
+    ngx_add_timer(ctx->peer.connection->read, ahcf->timeout);
+    ngx_add_timer(ctx->peer.connection->write, ahcf->timeout);
+
     if (rc == NGX_OK) {
         ngx_imap_auth_http_write_handler(ctx->peer.connection->write);
         return;
     }
-
-    ngx_add_timer(ctx->peer.connection->read, ahcf->timeout);
-    ngx_add_timer(ctx->peer.connection->write, ahcf->timeout);
 }
 
 
@@ -185,7 +193,8 @@ ngx_imap_auth_http_write_handler(ngx_eve
 
     if (wev->timedout) {  
         ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
-                      "auth http server timed out");
+                      "auth http server %V timed out",
+                      &ctx->peer.peers->peer[0].name);
         ngx_close_connection(ctx->peer.connection);
         ngx_imap_session_internal_server_error(s);
         return;
@@ -240,7 +249,8 @@ ngx_imap_auth_http_read_handler(ngx_even
 
     if (rev->timedout) {  
         ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT,
-                      "auth http server timed out");
+                      "auth http server %V timed out",
+                      &ctx->peer.peers->peer[0].name);
         ngx_close_connection(ctx->peer.connection);
         ngx_imap_session_internal_server_error(s);
         return;
@@ -355,7 +365,8 @@ ngx_imap_auth_http_ignore_status_line(ng
             }
 
             ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
-                          "auth http server sent invalid response");
+                          "auth http server &V sent invalid response",
+                          &ctx->peer.peers->peer[0].name);
             ngx_close_connection(ctx->peer.connection);
             ngx_imap_session_internal_server_error(s);
             return;
@@ -520,9 +531,11 @@ ngx_imap_auth_http_process_headers(ngx_i
 
                 if (ctx->sleep == 0) {
                     s->quit = 1;
-                }
+
+                    ngx_imap_send(s->connection->write);
 
-                ngx_imap_send(s->connection->write);
+                    return;
+                }
 
                 ngx_add_timer(s->connection->read, ctx->sleep * 1000);
 
@@ -533,7 +546,8 @@ ngx_imap_auth_http_process_headers(ngx_i
 
             if (ctx->addr.len == 0 || ctx->port.len == 0) {
                 ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
-                              "auth http server did not send server or port");
+                              "auth http server %V did not send server or port",
+                              &ctx->peer.peers->peer[0].name);
                 ngx_imap_session_internal_server_error(s);
                 return;
             }
@@ -555,8 +569,9 @@ ngx_imap_auth_http_process_headers(ngx_i
             port = ngx_atoi(ctx->port.data, ctx->port.len);
             if (port == NGX_ERROR || port < 1 || port > 65536) {
                 ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
-                              "auth http server sent invalid server "
-                              "port:\"%V\"", &ctx->port);
+                              "auth http server %V sent invalid server "
+                              "port:\"%V\"",
+                              &ctx->peer.peers->peer[0].name, &ctx->port);
                 ngx_imap_session_internal_server_error(s);
                 return;
             }
@@ -567,8 +582,9 @@ ngx_imap_auth_http_process_headers(ngx_i
             sin->sin_addr.s_addr = inet_addr((char *) ctx->addr.data);
             if (sin->sin_addr.s_addr == INADDR_NONE) {
                 ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
-                              "auth http server sent invalid server "
-                              "address:\"%V\"", &ctx->addr);
+                              "auth http server %V sent invalid server "
+                              "address:\"%V\"",
+                              &ctx->peer.peers->peer[0].name, &ctx->addr);
                 ngx_imap_session_internal_server_error(s);
                 return;
             }
@@ -612,7 +628,8 @@ ngx_imap_auth_http_process_headers(ngx_i
         /* rc == NGX_ERROR */
 
         ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
-                      "auth http server sent invalid header in response");
+                      "auth http server %V sent invalid header in response",
+                      &ctx->peer.peers->peer[0].name);
         ngx_close_connection(ctx->peer.connection);
         ngx_imap_session_internal_server_error(s);
 
@@ -654,6 +671,8 @@ ngx_imap_auth_sleep_handler(ngx_event_t 
             ngx_imap_close_connection(s->connection);
         }
 
+        ngx_imap_send(s->connection->write);
+
         return;
     }
 
--- a/src/imap/ngx_imap_core_module.c
+++ b/src/imap/ngx_imap_core_module.c
@@ -114,8 +114,14 @@ ngx_module_t  ngx_imap_core_module = {
     &ngx_imap_core_module_ctx,             /* module context */
     ngx_imap_core_commands,                /* module directives */
     NGX_IMAP_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
 };
 
 
--- a/src/imap/ngx_imap_handler.c
+++ b/src/imap/ngx_imap_handler.c
@@ -11,7 +11,9 @@
 
 
 static void ngx_imap_init_session(ngx_event_t *rev);
+static void ngx_imap_init_protocol(ngx_event_t *rev);
 static ngx_int_t ngx_imap_read_command(ngx_imap_session_t *s);
+static u_char *ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len);
 
 #if (NGX_IMAP_SSL)
 static void ngx_imap_ssl_close_handler(ngx_event_t *ev);
@@ -40,20 +42,49 @@ static u_char  imap_invalid_command[] = 
 void
 ngx_imap_init_connection(ngx_connection_t *c)
 {
+    ngx_imap_log_ctx_t  *ctx;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "imap init connection");
+
+    ctx = ngx_palloc(c->pool, sizeof(ngx_imap_log_ctx_t));
+    if (ctx == NULL) {
+        ngx_imap_close_connection(c);
+        return;
+    } 
+
+    ctx->client = &c->addr_text;
+    ctx->session = NULL;
+
+    c->log->connection = c->number;
+    c->log->handler = ngx_imap_log_error;
+    c->log->data = ctx;
+    c->log->action = "sending client greeting line";
+
+    c->log_error = NGX_ERROR_INFO;
+
+    ngx_imap_init_session(c->read);
+}
+
+
+static void
+ngx_imap_init_session(ngx_event_t *rev)
+{
+    ngx_connection_t          *c;
     ngx_imap_session_t        *s;
+    ngx_imap_log_ctx_t        *lctx;
     ngx_imap_conf_ctx_t       *ctx;
+    ngx_imap_core_srv_conf_t  *cscf;
 #if (NGX_IMAP_SSL)
     ngx_int_t                  rc;
     ngx_imap_ssl_conf_t       *sslcf;
 #endif
-    ngx_imap_core_srv_conf_t  *cscf;
 
-    ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "imap init connection");
-
-    c->log_error = NGX_ERROR_INFO;
+    c = rev->data;
 
     ctx = c->ctx;
 
+    cscf = ngx_imap_get_module_srv_conf(ctx, ngx_imap_core_module);
+
 #if (NGX_IMAP_SSL)
 
     sslcf = ngx_imap_get_module_srv_conf(ctx, ngx_imap_ssl_module);
@@ -74,6 +105,17 @@ ngx_imap_init_connection(ngx_connection_
             return;
         }
 
+        if (rc == NGX_AGAIN) {
+            ngx_add_timer(rev, cscf->timeout);
+            c->read->handler = ngx_imap_init_session;
+
+            if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
+                ngx_imap_close_connection(c);
+            }
+
+            return;
+        }
+
         c->recv = ngx_ssl_recv;
         c->send = ngx_ssl_write;
         c->send_chain = ngx_ssl_send_chain;
@@ -90,7 +132,6 @@ ngx_imap_init_connection(ngx_connection_
     c->data = s;
     s->connection = c;
 
-    cscf = ngx_imap_get_module_srv_conf(ctx, ngx_imap_core_module);
     s->protocol = cscf->protocol;
 
     s->ctx = ngx_pcalloc(c->pool, sizeof(void *) * ngx_imap_max_module);
@@ -104,13 +145,15 @@ ngx_imap_init_connection(ngx_connection_
 
     s->out = greetings[s->protocol];
 
-    c->read->handler = ngx_imap_init_session;
+    lctx = c->log->data;
+    lctx->session = s;
+
+    c->read->handler = ngx_imap_init_protocol;
     c->write->handler = ngx_imap_send;
 
-    ngx_add_timer(c->write, cscf->timeout);
-    ngx_add_timer(c->read, cscf->timeout);
+    ngx_add_timer(rev, cscf->timeout);
 
-    if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
+    if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
         ngx_imap_close_connection(c);
     }
 
@@ -121,9 +164,10 @@ ngx_imap_init_connection(ngx_connection_
 void
 ngx_imap_send(ngx_event_t *wev)
 {
-    ngx_int_t            n;
-    ngx_connection_t    *c;
-    ngx_imap_session_t  *s;
+    ngx_int_t                  n;
+    ngx_connection_t          *c;
+    ngx_imap_session_t        *s;
+    ngx_imap_core_srv_conf_t  *cscf;
 
     c = wev->data;
     s = c->data;
@@ -147,6 +191,10 @@ ngx_imap_send(ngx_event_t *wev)
     if (n > 0) {
         s->out.len -= n;
 
+        if (wev->timer_set) {
+            ngx_del_timer(wev);
+        }
+
         if (s->quit) {
             ngx_imap_close_connection(c);
             return;
@@ -166,6 +214,10 @@ ngx_imap_send(ngx_event_t *wev)
 
     /* n == NGX_AGAIN */
 
+    cscf = ngx_imap_get_module_srv_conf(s, ngx_imap_core_module);
+
+    ngx_add_timer(c->write, cscf->timeout);
+
     if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
         ngx_imap_close_connection(c);
         return;
@@ -174,7 +226,7 @@ ngx_imap_send(ngx_event_t *wev)
 
 
 static void
-ngx_imap_init_session(ngx_event_t *rev)
+ngx_imap_init_protocol(ngx_event_t *rev)
 {
     size_t                     size;
     ngx_connection_t          *c;
@@ -183,6 +235,8 @@ ngx_imap_init_session(ngx_event_t *rev)
 
     c = rev->data;
 
+    c->log->action = "in auth state";
+
     if (rev->timedout) {
         ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
         ngx_imap_close_connection(c);
@@ -666,3 +720,52 @@ ngx_imap_ssl_close_handler(ngx_event_t *
 }
 
 #endif
+
+
+static u_char *
+ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len)
+{
+    u_char                 *p;
+    ngx_imap_session_t     *s;
+    ngx_imap_log_ctx_t     *ctx;
+
+    if (log->action) {
+        p = ngx_snprintf(buf, len, " while %s", log->action);
+        len -= p - buf;
+        buf = p;
+    }
+    
+    ctx = log->data;
+
+    p = ngx_snprintf(buf, len, ", client: %V", ctx->client);
+    len -= p - buf;
+    buf = p;
+
+    s = ctx->session;
+
+    if (s == NULL) {
+        return p;
+    }
+
+    p = ngx_snprintf(buf, len, ", server: %V",
+                     &s->connection->listening->addr_text);
+    len -= p - buf;
+    buf = p;
+
+    if (s->login.len == 0) {
+        return p;
+    }
+
+    p = ngx_snprintf(buf, len, ", login: \"%V\"", &s->login);
+    len -= p - buf;
+    buf = p;
+
+    if (s->proxy == NULL) {
+        return p;
+    }
+
+    p = ngx_snprintf(buf, len, ", upstream: %V",
+                     &s->proxy->upstream.peers->peer[0].name);
+
+    return p;
+}
--- a/src/imap/ngx_imap_proxy_module.c
+++ b/src/imap/ngx_imap_proxy_module.c
@@ -77,8 +77,14 @@ ngx_module_t  ngx_imap_proxy_module = {
     &ngx_imap_proxy_module_ctx,            /* module context */
     ngx_imap_proxy_commands,               /* module directives */
     NGX_IMAP_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
 };
 
 
@@ -101,9 +107,11 @@ ngx_imap_proxy_init(ngx_imap_session_t *
     p->upstream.log = s->connection->log;
     p->upstream.log_error = NGX_ERROR_ERR;
 
+    s->connection->log->action = "in upstream auth state";
+
     rc = ngx_event_connect_peer(&p->upstream);
 
-    if (rc == NGX_ERROR) {
+    if (rc == NGX_ERROR || rc == NGX_CONNECT_ERROR) {
         ngx_imap_session_internal_server_error(s);
         return;
     }
@@ -284,6 +292,8 @@ ngx_imap_proxy_imap_handler(ngx_event_t 
         pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module);
         ngx_add_timer(s->connection->read, pcf->timeout);
         ngx_del_timer(c->read);
+
+        c->log->action = "proxying";
     }
 }
 
@@ -407,6 +417,8 @@ ngx_imap_proxy_pop3_handler(ngx_event_t 
         pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module);
         ngx_add_timer(s->connection->read, pcf->timeout);
         ngx_del_timer(c->read);
+
+        c->log->action = "proxying";
     }
 }
 
--- a/src/imap/ngx_imap_ssl_module.c
+++ b/src/imap/ngx_imap_ssl_module.c
@@ -65,8 +65,14 @@ ngx_module_t  ngx_imap_ssl_module = {
     &ngx_imap_ssl_module_ctx,              /* module context */
     ngx_imap_ssl_commands,                 /* module directives */
     NGX_IMAP_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
 };
 
 
@@ -170,5 +176,7 @@ ngx_imap_ssl_merge_conf(ngx_conf_t *cf, 
         return NGX_CONF_ERROR;
     }
 
+    SSL_CTX_set_verify(conf->ssl_ctx, SSL_VERIFY_NONE, NULL);
+
     return NGX_CONF_OK;
 }
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -30,8 +30,6 @@ ngx_os_io_t ngx_os_io = {
 ngx_int_t
 ngx_os_init(ngx_log_t *log)
 {
-    ngx_log_error(NGX_LOG_NOTICE, log, 0, NGINX_VER);
-
 #if (NGX_HAVE_OS_SPECIFIC_INIT)
     if (ngx_os_specific_init(log) != NGX_OK) {
         return NGX_ERROR;
@@ -67,6 +65,8 @@ ngx_os_init(ngx_log_t *log)
 void
 ngx_os_status(ngx_log_t *log)
 {
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, NGINX_VER);
+
 #if (NGX_HAVE_OS_SPECIFIC_INIT)
     ngx_os_specific_status(log);
 #endif
--- a/src/os/win32/ngx_win32_init.c
+++ b/src/os/win32/ngx_win32_init.c
@@ -6,6 +6,7 @@
 
 #include <ngx_config.h>
 #include <ngx_core.h>
+#include <nginx.h>
 
 
 ngx_uint_t  ngx_win32_version;
@@ -166,6 +167,8 @@ void ngx_os_status(ngx_log_t *log)
 {
     ngx_osviex_stub_t  *osviex_stub;
 
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, NGINX_VER);
+
     if (osviex) {
 
         /*