diff src/imap/ngx_imap_proxy_module.c @ 571:458b6c3fea65 release-0.3.7

nginx-0.3.7-RELEASE import *) Feature: the "access_log" supports the "buffer=" parameter. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.3.2.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 27 Oct 2005 15:46:13 +0000
parents 818fbd4750b9
children 4d9ea73a627a
line wrap: on
line diff
--- a/src/imap/ngx_imap_proxy_module.c
+++ b/src/imap/ngx_imap_proxy_module.c
@@ -32,8 +32,8 @@ static char *ngx_imap_proxy_merge_conf(n
     void *child);
 
 
-#define NGX_IMAP_WAIT_OK    0
-#define NGX_IMAP_WAIT_NEXT  1
+#define NGX_IMAP_WAIT_OK      0
+#define NGX_IMAP_WAIT_NEXT    1
 
 
 static ngx_command_t  ngx_imap_proxy_commands[] = {
@@ -156,7 +156,6 @@ 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;
@@ -194,21 +193,11 @@ ngx_imap_proxy_imap_handler(ngx_event_t 
         return;
     }
 
-    if (rc == NGX_ERROR || rc == NGX_IMAP_PROXY_INVALID) {
+    if (rc == NGX_ERROR) {
         ngx_imap_proxy_internal_server_error(s);
         return;
     }
 
-    if (rc == NGX_IMAP_PROXY_ERROR) {
-        s->connection->read->handler = ngx_imap_proxy_handler;
-        s->connection->write->handler = ngx_imap_proxy_handler;
-        rev->handler = ngx_imap_proxy_handler;
-        c->write->handler = ngx_imap_proxy_handler;
-
-        ngx_imap_proxy_handler(c->read);
-        return;
-    }
-
     switch (s->imap_state) {
 
     case ngx_imap_start:
@@ -294,10 +283,8 @@ 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";
     }
@@ -307,7 +294,6 @@ 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;
@@ -344,21 +330,11 @@ ngx_imap_proxy_pop3_handler(ngx_event_t 
         return;
     }
 
-    if (rc == NGX_ERROR || rc == NGX_IMAP_PROXY_INVALID) {
+    if (rc == NGX_ERROR) {
         ngx_imap_proxy_internal_server_error(s);
         return;
     }
 
-    if (rc == NGX_IMAP_PROXY_ERROR) {
-        s->connection->read->handler = ngx_imap_proxy_handler;
-        s->connection->write->handler = ngx_imap_proxy_handler;
-        rev->handler = ngx_imap_proxy_handler;
-        c->write->handler = ngx_imap_proxy_handler;
-
-        ngx_imap_proxy_handler(c->read);
-        return;
-    }
-
     switch (s->imap_state) {
 
     case ngx_pop3_start:
@@ -425,10 +401,8 @@ 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";
     }
@@ -474,7 +448,7 @@ ngx_imap_proxy_read_response(ngx_imap_se
             ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
                           "upstream sent too long response line: \"%s\"",
                           b->pos);
-            return NGX_IMAP_PROXY_INVALID;
+            return NGX_ERROR;
         }
 
         return NGX_AGAIN;
@@ -487,15 +461,7 @@ ngx_imap_proxy_read_response(ngx_imap_se
             return NGX_OK;
         }
 
-        if (p[0] == '-' && p[1] == 'E' && p[2] == 'R' && p[3] == 'R') {
-            return NGX_IMAP_PROXY_ERROR;
-        }
-
     } else {
-        if (p[0] == 'N' && p[1] == 'O') {
-            return NGX_IMAP_PROXY_ERROR;
-        }
-
         if (what == NGX_IMAP_WAIT_OK) {
             if (p[0] == '*' && p[1] == ' ' && p[2] == 'O' && p[3] == 'K') {
                 return NGX_OK;
@@ -512,7 +478,7 @@ ngx_imap_proxy_read_response(ngx_imap_se
     ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
                   "upstream sent invalid response: \"%s\"", p);
 
-    return NGX_IMAP_PROXY_INVALID;
+    return NGX_ERROR;
 }