changeset 486:6484cbba0222 NGINX_0_7_55

nginx 0.7.55 *) Bugfix: the http_XXX parameters in "proxy_cache_use_stale" and "fastcgi_cache_use_stale" directives did not work. *) Bugfix: fastcgi cache did not cache header only responses. *) Bugfix: of "select() failed (9: Bad file descriptor)" error in nginx/Unix and "select() failed (10022: ...)" error in nginx/Windows. *) Bugfix: a segmentation fault might occur in worker process, if an "debug_connection" directive was used; the bug had appeared in 0.7.54. *) Bugfix: fix ngx_http_image_filter_module building errors. *) Bugfix: the files bigger than 2G could not be transferred using $r->sendfile. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Wed, 06 May 2009 00:00:00 +0400
parents 21824e8058e6
children e98b980b4fe7
files CHANGES CHANGES.ru auto/lib/libgd/conf auto/options src/core/nginx.h src/core/ngx_connection.c src/core/ngx_connection.h src/core/ngx_cycle.c src/event/modules/ngx_select_module.c src/event/ngx_event_pipe.c src/http/modules/ngx_http_image_filter_module.c src/http/modules/perl/nginx.pm src/http/modules/perl/nginx.xs src/http/ngx_http.c src/http/ngx_http_upstream.c src/mail/ngx_mail.c src/mail/ngx_mail_core_module.c src/mail/ngx_mail_handler.c
diffstat 18 files changed, 199 insertions(+), 157 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Fri May 01 00:00:00 2009 +0400
+++ b/CHANGES	Wed May 06 00:00:00 2009 +0400
@@ -1,4 +1,25 @@
 
+Changes with nginx 0.7.55                                        06 May 2009
+
+    *) Bugfix: the http_XXX parameters in "proxy_cache_use_stale" and 
+       "fastcgi_cache_use_stale" directives did not work.
+
+    *) Bugfix: fastcgi cache did not cache header only responses.
+
+    *) Bugfix: of "select() failed (9: Bad file descriptor)" error in 
+       nginx/Unix and "select() failed (10022: ...)" error in nginx/Windows.
+
+    *) Bugfix: a segmentation fault might occur in worker process, if an 
+       "debug_connection" directive was used; the bug had appeared in 
+       0.7.54.
+
+    *) Bugfix: fix ngx_http_image_filter_module building errors.
+
+    *) Bugfix: the files bigger than 2G could not be transferred using 
+       $r->sendfile.
+       Thanks to Maxim Dounin.
+
+
 Changes with nginx 0.7.54                                        01 May 2009
 
     *) Feature: the ngx_http_image_filter_module.
--- a/CHANGES.ru	Fri May 01 00:00:00 2009 +0400
+++ b/CHANGES.ru	Wed May 06 00:00:00 2009 +0400
@@ -1,4 +1,25 @@
 
+Изменения в nginx 0.7.55                                          06.05.2009
+
+    *) Исправление: параметры http_XXX в директиве proxy_cache_use_stale и 
+       fastcgi_cache_use_stale не работали.
+
+    *) Исправление: fastcgi кэш не кэшировал ответы, состоящие только из 
+       заголовка.
+
+    *) Исправление: ошибки "select() failed (9: Bad file descriptor)" в 
+       nginx/Unix и "select() failed (10022: ...)" в nginx/Windows.
+
+    *) Исправление: при использовании директивы debug_connection в рабочем 
+       процессе мог произойти segmentation fault; ошибка появилась в 0.7.54.
+
+    *) Исправление: в сборке модуля ngx_http_image_filter_module.
+
+    *) Исправление: файлы больше 2G не передавались с использованием 
+       $r->sendfile.
+       Спасибо Максиму Дунину.
+
+
 Изменения в nginx 0.7.54                                          01.05.2009
 
     *) Добавление: модуль ngx_http_image_filter_module.
@@ -41,7 +62,7 @@
     *) Добавление: теперь ключи можно задавать в сжатой форме.
 
     *) Исправление: nginx/Windows не работал, если файл конфигурации был 
-       задан ключём -c.
+       задан ключом -c.
 
     *) Исправление: при использовании директив proxy_store, fastcgi_store, 
        proxy_cache или fastcgi_cache временные файлы могли не удаляться.
--- a/auto/lib/libgd/conf	Fri May 01 00:00:00 2009 +0400
+++ b/auto/lib/libgd/conf	Wed May 06 00:00:00 2009 +0400
@@ -65,6 +65,7 @@
 
 if [ $ngx_found = yes ]; then
 
+    CORE_INCS="$CORE_INCS $ngx_feature_path"
     CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
 
 else
--- a/auto/options	Fri May 01 00:00:00 2009 +0400
+++ b/auto/options	Wed May 06 00:00:00 2009 +0400
@@ -309,6 +309,7 @@
   --with-http_realip_module          enable ngx_http_realip_module
   --with-http_addition_module        enable ngx_http_addition_module
   --with-http_xslt_module            enable ngx_http_xslt_module
+  --with-http_image_filter_module    enable ngx_http_image_filter_module
   --with-http_sub_module             enable ngx_http_sub_module
   --with-http_dav_module             enable ngx_http_dav_module
   --with-http_flv_module             enable ngx_http_flv_module
--- a/src/core/nginx.h	Fri May 01 00:00:00 2009 +0400
+++ b/src/core/nginx.h	Wed May 06 00:00:00 2009 +0400
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         7054
-#define NGINX_VERSION      "0.7.54"
+#define nginx_version         7055
+#define NGINX_VERSION      "0.7.55"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_connection.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/core/ngx_connection.c	Wed May 06 00:00:00 2009 +0400
@@ -13,11 +13,11 @@
 
 
 ngx_listening_t *
-ngx_listening_inet_stream_socket(ngx_conf_t *cf, in_addr_t addr, in_port_t port)
+ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen)
 {
-    size_t               len;
-    ngx_listening_t     *ls;
-    struct sockaddr_in  *sin;
+    ngx_listening_t  *ls;
+    struct sockaddr  *sa;
+    u_char            text[NGX_SOCKADDR_STRLEN];
 
     ls = ngx_array_push(&cf->cycle->listening);
     if (ls == NULL) {
@@ -26,33 +26,45 @@
 
     ngx_memzero(ls, sizeof(ngx_listening_t));
 
-    sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in));
-    if (sin == NULL) {
+    sa = ngx_palloc(cf->pool, socklen);
+    if (sa == NULL) {
         return NULL;
     }
 
-    sin->sin_family = AF_INET;
-    sin->sin_addr.s_addr = addr;
-    sin->sin_port = htons(port);
+    ngx_memcpy(sa, sockaddr, socklen);
 
+    ls->sockaddr = sa;
+    ls->socklen = socklen;
 
-    ls->addr_text.data = ngx_pnalloc(cf->pool,
-                                    NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
+    ls->addr_text.len = ngx_sock_ntop(sa, text, NGX_SOCKADDR_STRLEN, 1);
+
+    ls->addr_text.data = ngx_pnalloc(cf->pool, ls->addr_text.len);
     if (ls->addr_text.data == NULL) {
         return NULL;
     }
 
-    len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data,
-                        NGX_INET_ADDRSTRLEN);
-
-    ls->addr_text.len = ngx_sprintf(ls->addr_text.data + len, ":%d", port)
-                        - ls->addr_text.data;
+    ngx_memcpy(ls->addr_text.data, text, ls->addr_text.len);
 
     ls->fd = (ngx_socket_t) -1;
     ls->type = SOCK_STREAM;
-    ls->sockaddr = (struct sockaddr *) sin;
-    ls->socklen = sizeof(struct sockaddr_in);
-    ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
+
+    switch (ls->sockaddr->sa_family) {
+#if (NGX_HAVE_INET6)
+    case AF_INET6:
+         ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN;
+         break;
+#endif
+    case AF_INET:
+         ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
+         break;
+    default:
+         ls->addr_text_max_len = NGX_SOCKADDR_STRLEN;
+         break;
+    }
+
+    ls->backlog = NGX_LISTEN_BACKLOG;
+    ls->rcvbuf = -1;
+    ls->sndbuf = -1;
 
     return ls;
 }
@@ -248,8 +260,6 @@
                 continue;
             }
 
-            ls[i].log = *ls[i].logp;
-
             if (ls[i].inherited) {
 
                 /* TODO: close on exit */
@@ -295,7 +305,7 @@
                                (const void *) &ipv6only, sizeof(int))
                     == -1)
                 {
-                    ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
+                    ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
                                   "setsockopt(IPV6_V6ONLY) %V failed, ignored",
                                   &ls[i].addr_text);
                 }
@@ -319,7 +329,7 @@
                 }
             }
 
-            ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
+            ngx_log_debug2(NGX_LOG_DEBUG_CORE, log, 0,
                            "bind() %V #%d ", &ls[i].addr_text, s);
 
             if (bind(s, ls[i].sockaddr, ls[i].socklen) == -1) {
@@ -388,7 +398,7 @@
 
 
 void
-ngx_configure_listening_socket(ngx_cycle_t *cycle)
+ngx_configure_listening_sockets(ngx_cycle_t *cycle)
 {
     ngx_uint_t                 i;
     ngx_listening_t           *ls;
@@ -403,6 +413,8 @@
     ls = cycle->listening.elts;
     for (i = 0; i < cycle->listening.nelts; i++) {
 
+        ls[i].log = *ls[i].logp;
+
         if (ls[i].rcvbuf != -1) {
             if (setsockopt(ls[i].fd, SOL_SOCKET, SO_RCVBUF,
                            (const void *) &ls[i].rcvbuf, sizeof(int))
--- a/src/core/ngx_connection.h	Fri May 01 00:00:00 2009 +0400
+++ b/src/core/ngx_connection.h	Wed May 06 00:00:00 2009 +0400
@@ -163,16 +163,11 @@
 };
 
 
-#ifndef ngx_ssl_set_nosendshut
-#define ngx_ssl_set_nosendshut(ssl)
-#endif
-
-
-ngx_listening_t *ngx_listening_inet_stream_socket(ngx_conf_t *cf,
-    in_addr_t addr, in_port_t port);
+ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, void *sockaddr,
+    socklen_t socklen);
 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
 ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
-void ngx_configure_listening_socket(ngx_cycle_t *cycle);
+void ngx_configure_listening_sockets(ngx_cycle_t *cycle);
 void ngx_close_listening_sockets(ngx_cycle_t *cycle);
 void ngx_close_connection(ngx_connection_t *c);
 ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
--- a/src/core/ngx_cycle.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/core/ngx_cycle.c	Wed May 06 00:00:00 2009 +0400
@@ -573,7 +573,7 @@
         }
 
         if (!ngx_test_config) {
-            ngx_configure_listening_socket(cycle);
+            ngx_configure_listening_sockets(cycle);
         }
     }
 
--- a/src/event/modules/ngx_select_module.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/event/modules/ngx_select_module.c	Wed May 06 00:00:00 2009 +0400
@@ -147,6 +147,16 @@
         return NGX_OK;
     }
 
+    if ((event == NGX_READ_EVENT && ev->write)
+        || (event == NGX_WRITE_EVENT && !ev->write))
+    {
+        ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
+                      "invalid select %s event fd:%d ev:%i",
+                      ev->write ? "write" : "read", c->fd, event);
+        return NGX_ERROR;
+    }
+
+
 #if (NGX_WIN32)
 
     if ((event == NGX_READ_EVENT) && (max_read >= FD_SETSIZE)
@@ -195,6 +205,7 @@
 static ngx_int_t
 ngx_select_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
 {
+    ngx_event_t       *e;
     ngx_connection_t  *c;
 
     c = ev->data;
@@ -235,8 +246,9 @@
 #endif
 
     if (ev->index < --nevents) {
-        event_index[ev->index] = event_index[nevents];
-        event_index[ev->index]->index = ev->index;
+        e = event_index[nevents];
+        event_index[ev->index] = e;
+        e->index = ev->index;
     }
 
     ev->index = NGX_INVALID_INDEX;
--- a/src/event/ngx_event_pipe.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/event/ngx_event_pipe.c	Wed May 06 00:00:00 2009 +0400
@@ -397,7 +397,7 @@
 
         p->free_raw_bufs = p->free_raw_bufs->next;
 
-        if (p->free_bufs) {
+        if (p->free_bufs && p->buf_to_file == NULL) {
             for (cl = p->free_raw_bufs; cl; cl = cl->next) {
                 if (cl->buf->shadow == NULL) {
                     ngx_pfree(p->pool, cl->buf->start);
--- a/src/http/modules/ngx_http_image_filter_module.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/http/modules/ngx_http_image_filter_module.c	Wed May 06 00:00:00 2009 +0400
@@ -186,7 +186,7 @@
 
     len = r->headers_out.content_length_n;
 
-    if (len != -1 && len > conf->buffer_size) {
+    if (len != -1 && len > (off_t) conf->buffer_size) {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "image filter: too big response: %O", len);
 
--- a/src/http/modules/perl/nginx.pm	Fri May 01 00:00:00 2009 +0400
+++ b/src/http/modules/perl/nginx.pm	Wed May 06 00:00:00 2009 +0400
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.7.54';
+our $VERSION = '0.7.55';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/modules/perl/nginx.xs	Fri May 01 00:00:00 2009 +0400
+++ b/src/http/modules/perl/nginx.xs	Wed May 06 00:00:00 2009 +0400
@@ -607,7 +607,7 @@
 
     ngx_http_request_t        *r;
     char                      *filename;
-    int                        offset;
+    off_t                      offset;
     size_t                     bytes;
     ngx_str_t                  path;
     ngx_buf_t                 *b;
--- a/src/http/ngx_http.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/http/ngx_http.c	Wed May 06 00:00:00 2009 +0400
@@ -1688,54 +1688,14 @@
 ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
 {
     ngx_listening_t           *ls;
-    struct sockaddr           *sa;
     ngx_http_core_loc_conf_t  *clcf;
     ngx_http_core_srv_conf_t  *cscf;
-    u_char                     text[NGX_SOCKADDR_STRLEN];
 
-    ls = ngx_array_push(&cf->cycle->listening);
+    ls = ngx_create_listening(cf, addr->sockaddr, addr->socklen);
     if (ls == NULL) {
         return NULL;
     }
 
-    ngx_memzero(ls, sizeof(ngx_listening_t));
-
-    sa = ngx_palloc(cf->pool, addr->socklen);
-    if (sa == NULL) {
-        return NULL;
-    }
-
-    ngx_memcpy(sa, addr->sockaddr, addr->socklen);
-
-    ls->sockaddr = sa;
-    ls->socklen = addr->socklen;
-
-    ls->addr_text.len = ngx_sock_ntop(sa, text, NGX_SOCKADDR_STRLEN, 1);
-
-    ls->addr_text.data = ngx_pnalloc(cf->pool, ls->addr_text.len);
-    if (ls->addr_text.data == NULL) {
-        return NULL;
-    }
-
-    ngx_memcpy(ls->addr_text.data, text, ls->addr_text.len);
-
-    ls->fd = (ngx_socket_t) -1;
-    ls->type = SOCK_STREAM;
-
-    switch (ls->sockaddr->sa_family) {
-#if (NGX_HAVE_INET6)
-    case AF_INET6:
-         ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN;
-         break;
-#endif
-    case AF_INET:
-         ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
-         break;
-    default:
-         ls->addr_text_max_len = NGX_SOCKADDR_STRLEN;
-         break;
-    }
-
     ls->addr_ntop = 1;
 
     ls->handler = ngx_http_init_connection;
--- a/src/http/ngx_http_upstream.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/http/ngx_http_upstream.c	Wed May 06 00:00:00 2009 +0400
@@ -768,6 +768,7 @@
     int                  n;
     char                 buf[1];
     ngx_err_t            err;
+    ngx_int_t            event;
     ngx_connection_t     *c;
     ngx_http_upstream_t  *u;
 
@@ -779,10 +780,22 @@
     u = r->upstream;
 
     if (c->error) {
+        if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) {
+
+            event = ev->write ? NGX_WRITE_EVENT : NGX_READ_EVENT;
+
+            if (ngx_del_event(ev, event, 0) != NGX_OK) {
+                ngx_http_upstream_finalize_request(r, u,
+                                               NGX_HTTP_INTERNAL_SERVER_ERROR);
+                return;
+            }
+        }
+
         if (!u->cacheable) {
             ngx_http_upstream_finalize_request(r, u,
                                                NGX_HTTP_CLIENT_CLOSED_REQUEST);
         }
+
         return;
     }
 
@@ -836,17 +849,15 @@
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, err,
                    "http upstream recv(): %d", n);
 
-    /*
-     * we do not need to disable the write event because
-     * that event has NGX_USE_CLEAR_EVENT type
-     */
-
     if (ev->write && (n >= 0 || err == NGX_EAGAIN)) {
         return;
     }
 
     if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) {
-        if (ngx_del_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) {
+
+        event = ev->write ? NGX_WRITE_EVENT : NGX_READ_EVENT;
+
+        if (ngx_del_event(ev, event, 0) != NGX_OK) {
             ngx_http_upstream_finalize_request(r, u,
                                                NGX_HTTP_INTERNAL_SERVER_ERROR);
             return;
@@ -1472,13 +1483,10 @@
 static ngx_int_t
 ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u)
 {
+    ngx_int_t                  rc;
     ngx_uint_t                 status;
     ngx_http_upstream_next_t  *un;
 
-    if (!(u->conf->next_upstream & NGX_HTTP_UPSTREAM_FT_STATUS)) {
-        return NGX_DECLINED;
-    }
-
     status = u->headers_in.status_n;
 
     for (un = ngx_http_upstream_next_errors; un->status; un++) {
@@ -1494,12 +1502,15 @@
 
 #if (NGX_HTTP_CACHE)
 
-        if (u->peer.tries == 0
-            && u->stale_cache
-            && (u->conf->cache_use_stale & un->mask))
-        {
-            ngx_http_upstream_finalize_request(r, u,
-                                           ngx_http_upstream_cache_send(r, u));
+        if (u->stale_cache && (u->conf->cache_use_stale & un->mask)) {
+
+            rc = u->reinit_request(r);
+
+            if (rc == NGX_OK) {
+                rc = ngx_http_upstream_cache_send(r, u);
+            }
+
+            ngx_http_upstream_finalize_request(r, u, rc);
             return NGX_OK;
         }
 
@@ -2650,9 +2661,15 @@
 #if (NGX_HTTP_CACHE)
 
             if (u->stale_cache && (u->conf->cache_use_stale & ft_type)) {
-
-                ngx_http_upstream_finalize_request(r, u,
-                                           ngx_http_upstream_cache_send(r, u));
+                ngx_int_t  rc;
+
+                rc = u->reinit_request(r);
+
+                if (rc == NGX_OK) {
+                    rc = ngx_http_upstream_cache_send(r, u);
+                }
+
+                ngx_http_upstream_finalize_request(r, u, rc);
                 return;
             }
 #endif
--- a/src/mail/ngx_mail.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/mail/ngx_mail.c	Wed May 06 00:00:00 2009 +0400
@@ -70,9 +70,10 @@
     ngx_conf_t                   pcf;
     ngx_array_t                  in_ports;
     ngx_listening_t             *ls;
-    ngx_mail_listen_t           *imls;
+    ngx_mail_listen_t           *mls;
     ngx_mail_module_t           *module;
-    ngx_mail_in_port_t          *imip;
+    struct sockaddr_in           sin;
+    ngx_mail_in_port_t          *mip;
     ngx_mail_conf_ctx_t         *ctx;
     ngx_mail_conf_in_port_t     *in_port;
     ngx_mail_conf_in_addr_t     *in_addr;
@@ -223,7 +224,7 @@
         return NGX_CONF_ERROR;
     }
 
-    imls = cmcf->listen.elts;
+    mls = cmcf->listen.elts;
 
     for (l = 0; l < cmcf->listen.nelts; l++) {
 
@@ -231,7 +232,7 @@
 
         in_port = in_ports.elts;
         for (p = 0; p < in_ports.nelts; p++) {
-            if (in_port[p].port == imls[l].port) {
+            if (in_port[p].port == mls[l].port) {
                 in_port = &in_port[p];
                 goto found;
             }
@@ -242,7 +243,7 @@
             return NGX_CONF_ERROR;
         }
 
-        in_port->port = imls[l].port;
+        in_port->port = mls[l].port;
 
         if (ngx_array_init(&in_port->addrs, cf->temp_pool, 2,
                            sizeof(ngx_mail_conf_in_addr_t))
@@ -258,11 +259,11 @@
             return NGX_CONF_ERROR;
         }
 
-        in_addr->addr = imls[l].addr;
-        in_addr->ctx = imls[l].ctx;
-        in_addr->bind = imls[l].bind;
+        in_addr->addr = mls[l].addr;
+        in_addr->ctx = mls[l].ctx;
+        in_addr->bind = mls[l].bind;
 #if (NGX_MAIL_SSL)
-        in_addr->ssl = imls[l].ssl;
+        in_addr->ssl = mls[l].ssl;
 #endif
     }
 
@@ -299,16 +300,17 @@
                 continue;
             }
 
-            ls = ngx_listening_inet_stream_socket(cf, in_addr[a].addr,
-                                                  in_port[p].port);
+            ngx_memzero(&sin, sizeof(struct sockaddr_in));
+
+            sin.sin_family = AF_INET;
+            sin.sin_addr.s_addr = in_addr[a].addr;
+            sin.sin_port = htons(in_port[p].port);
+
+            ls = ngx_create_listening(cf, &sin, sizeof(struct sockaddr_in));
             if (ls == NULL) {
-                return NGX_CONF_ERROR;
+                return NULL;
             }
 
-            ls->backlog = NGX_LISTEN_BACKLOG;
-            ls->rcvbuf = -1;
-            ls->sndbuf = -1;
-
             ls->addr_ntop = 1;
             ls->handler = ngx_mail_init_connection;
             ls->pool_size = 256;
@@ -318,27 +320,27 @@
             ls->log.data = &ls->addr_text;
             ls->log.handler = ngx_accept_log_error;
 
-            imip = ngx_palloc(cf->pool, sizeof(ngx_mail_in_port_t));
-            if (imip == NULL) {
+            mip = ngx_palloc(cf->pool, sizeof(ngx_mail_in_port_t));
+            if (mip == NULL) {
                 return NGX_CONF_ERROR;
             }
 
-            ls->servers = imip;
+            ls->servers = mip;
 
             in_addr = in_port[p].addrs.elts;
 
             if (in_addr[a].bind && in_addr[a].addr != INADDR_ANY) {
-                imip->naddrs = 1;
+                mip->naddrs = 1;
                 done = 0;
 
             } else if (in_port[p].addrs.nelts > 1
                        && in_addr[last - 1].addr == INADDR_ANY)
             {
-                imip->naddrs = last;
+                mip->naddrs = last;
                 done = 1;
 
             } else {
-                imip->naddrs = 1;
+                mip->naddrs = 1;
                 done = 0;
             }
 
@@ -346,18 +348,18 @@
             ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
                           "%ui: %V %d %ui %ui",
                           a, &ls->addr_text, in_addr[a].bind,
-                          imip->naddrs, last);
+                          mip->naddrs, last);
 #endif
 
-            imip->addrs = ngx_pcalloc(cf->pool,
-                                    imip->naddrs * sizeof(ngx_mail_in_addr_t));
-            if (imip->addrs == NULL) {
+            mip->addrs = ngx_pcalloc(cf->pool,
+                                     mip->naddrs * sizeof(ngx_mail_in_addr_t));
+            if (mip->addrs == NULL) {
                 return NGX_CONF_ERROR;
             }
 
-            for (i = 0; i < imip->naddrs; i++) {
-                imip->addrs[i].addr = in_addr[i].addr;
-                imip->addrs[i].ctx = in_addr[i].ctx;
+            for (i = 0; i < mip->naddrs; i++) {
+                mip->addrs[i].addr = in_addr[i].addr;
+                mip->addrs[i].ctx = in_addr[i].ctx;
 
                 text = ngx_pnalloc(cf->pool,
                                    NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
@@ -370,11 +372,11 @@
 
                 len = ngx_sprintf(text + len, ":%d", in_port[p].port) - text;
 
-                imip->addrs[i].addr_text.len = len;
-                imip->addrs[i].addr_text.data = text;
+                mip->addrs[i].addr_text.len = len;
+                mip->addrs[i].addr_text.data = text;
 
 #if (NGX_MAIL_SSL)
-                imip->addrs[i].ssl = in_addr[i].ssl;
+                mip->addrs[i].ssl = in_addr[i].ssl;
 #endif
             }
 
--- a/src/mail/ngx_mail_core_module.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/mail/ngx_mail_core_module.c	Wed May 06 00:00:00 2009 +0400
@@ -284,7 +284,7 @@
     ngx_str_t                  *value;
     ngx_url_t                   u;
     ngx_uint_t                  i, m;
-    ngx_mail_listen_t          *imls;
+    ngx_mail_listen_t          *ls;
     ngx_mail_module_t          *module;
     ngx_mail_core_main_conf_t  *cmcf;
 
@@ -312,11 +312,11 @@
 
     cmcf = ngx_mail_conf_get_module_main_conf(cf, ngx_mail_core_module);
 
-    imls = cmcf->listen.elts;
+    ls = cmcf->listen.elts;
 
     for (i = 0; i < cmcf->listen.nelts; i++) {
 
-        if (imls[i].addr != u.addr.in_addr || imls[i].port != u.port) {
+        if (ls[i].addr != u.addr.in_addr || ls[i].port != u.port) {
             continue;
         }
 
@@ -325,17 +325,17 @@
         return NGX_CONF_ERROR;
     }
 
-    imls = ngx_array_push(&cmcf->listen);
-    if (imls == NULL) {
+    ls = ngx_array_push(&cmcf->listen);
+    if (ls == NULL) {
         return NGX_CONF_ERROR;
     }
 
-    ngx_memzero(imls, sizeof(ngx_mail_listen_t));
+    ngx_memzero(ls, sizeof(ngx_mail_listen_t));
 
-    imls->addr = u.addr.in_addr;
-    imls->port = u.port;
-    imls->family = u.family;
-    imls->ctx = cf->ctx;
+    ls->addr = u.addr.in_addr;
+    ls->port = u.port;
+    ls->family = u.family;
+    ls->ctx = cf->ctx;
 
     for (m = 0; ngx_modules[m]; m++) {
         if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
@@ -359,13 +359,13 @@
     for (i = 2; i < cf->args->nelts; i++) {
 
         if (ngx_strcmp(value[i].data, "bind") == 0) {
-            imls->bind = 1;
+            ls->bind = 1;
             continue;
         }
 
         if (ngx_strcmp(value[i].data, "ssl") == 0) {
 #if (NGX_MAIL_SSL)
-            imls->ssl = 1;
+            ls->ssl = 1;
             continue;
 #else
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
--- a/src/mail/ngx_mail_handler.c	Fri May 01 00:00:00 2009 +0400
+++ b/src/mail/ngx_mail_handler.c	Wed May 06 00:00:00 2009 +0400
@@ -26,20 +26,20 @@
     ngx_uint_t            i;
     struct sockaddr_in    sin;
     ngx_mail_log_ctx_t   *ctx;
-    ngx_mail_in_port_t   *imip;
-    ngx_mail_in_addr_t   *imia;
+    ngx_mail_in_port_t   *mip;
+    ngx_mail_in_addr_t   *mia;
     ngx_mail_session_t   *s;
 
     /* find the server configuration for the address:port */
 
     /* AF_INET only */
 
-    imip = c->listening->servers;
-    imia = imip->addrs;
+    mip = c->listening->servers;
+    mia = mip->addrs;
 
     i = 0;
 
-    if (imip->naddrs > 1) {
+    if (mip->naddrs > 1) {
 
         /*
          * There are several addresses on this port and one of them
@@ -70,8 +70,8 @@
 
         /* the last address is "*" */
 
-        for ( /* void */ ; i < imip->naddrs - 1; i++) {
-            if (in_addr == imia[i].addr) {
+        for ( /* void */ ; i < mip->naddrs - 1; i++) {
+            if (in_addr == mia[i].addr) {
                 break;
             }
         }
@@ -84,10 +84,10 @@
         return;
     }
 
-    s->main_conf = imia[i].ctx->main_conf;
-    s->srv_conf = imia[i].ctx->srv_conf;
+    s->main_conf = mia[i].ctx->main_conf;
+    s->srv_conf = mia[i].ctx->srv_conf;
 
-    s->addr_text = &imia[i].addr_text;
+    s->addr_text = &mia[i].addr_text;
 
     c->data = s;
     s->connection = c;
@@ -124,7 +124,7 @@
         return;
     }
 
-    if (imia[i].ssl) {
+    if (mia[i].ssl) {
 
         c->log->action = "SSL handshaking";