diff src/imap/ngx_imap_proxy_module.c @ 96:ca4f70b3ccc6 NGINX_0_2_2

nginx 0.2.2 *) Feature: the "config errmsg" command of the ngx_http_ssi_module. *) Change: the ngx_http_geo_module variables can be overridden by the "set" directive. *) Feature: the "ssl_protocols" and "ssl_prefer_server_ciphers" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; *) Bugfix: the ngx_http_autoindex_module now do not show the files starting by dot. *) Bugfix: if the SSL handshake failed then another connection may be closed too. Thanks to Rob Mueller. *) Bugfix: the export versions of MSIE 5.x could not connect via HTTPS.
author Igor Sysoev <http://sysoev.ru>
date Fri, 30 Sep 2005 00:00:00 +0400
parents 45945fa8b8ba
children e85dca77c46a
line wrap: on
line diff
--- a/src/imap/ngx_imap_proxy_module.c
+++ b/src/imap/ngx_imap_proxy_module.c
@@ -156,6 +156,7 @@ ngx_imap_proxy_block_read(ngx_event_t *r
 static void
 ngx_imap_proxy_imap_handler(ngx_event_t *rev)
 {
+    char                   *action;
     u_char                 *p;
     ngx_int_t               rc;
     ngx_str_t               line;
@@ -293,6 +294,11 @@ ngx_imap_proxy_imap_handler(ngx_event_t 
         ngx_add_timer(s->connection->read, pcf->timeout);
         ngx_del_timer(c->read);
 
+        action = c->log->action;
+        c->log->action = NULL;
+        ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
+        c->log->action = action;
+
         c->log->action = "proxying";
     }
 }
@@ -301,6 +307,7 @@ ngx_imap_proxy_imap_handler(ngx_event_t 
 static void
 ngx_imap_proxy_pop3_handler(ngx_event_t *rev)
 {
+    char                   *action;
     u_char                 *p;
     ngx_int_t               rc;
     ngx_str_t               line;
@@ -418,6 +425,11 @@ ngx_imap_proxy_pop3_handler(ngx_event_t 
         ngx_add_timer(s->connection->read, pcf->timeout);
         ngx_del_timer(c->read);
 
+        action = c->log->action;
+        c->log->action = NULL;
+        ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
+        c->log->action = action;
+
         c->log->action = "proxying";
     }
 }
@@ -507,6 +519,7 @@ ngx_imap_proxy_read_response(ngx_imap_se
 static void
 ngx_imap_proxy_handler(ngx_event_t *ev)
 {
+    char                   *action;
     size_t                  size;
     ssize_t                 n;
     ngx_buf_t              *b;
@@ -603,7 +616,17 @@ ngx_imap_proxy_handler(ngx_event_t *ev)
         if (size && src->read->ready) {
             n = src->recv(src, b->last, size);
 
-            if (n == NGX_ERROR || n == 0) {
+            if (n == NGX_ERROR) {
+                ngx_imap_proxy_close_session(s);
+                return;
+            }
+
+            if (n == 0) {
+                action = c->log->action;
+                c->log->action = NULL;
+                ngx_log_error(NGX_LOG_INFO, c->log, 0, "proxied session done");
+                c->log->action = action;
+
                 ngx_imap_proxy_close_session(s);
                 return;
             }