summaryrefslogtreecommitdiffhomepage
path: root/src/imap
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-11-15 13:30:52 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-11-15 13:30:52 +0000
commit0e5dc5cff692f532f0ccb2655ab196995f4233e0 (patch)
treef56f40e788077b9820ebb45f3e0739fabb7be421 /src/imap
parent2a7f83eceda87e520f36bbfb16b82b8c2d6606d7 (diff)
downloadnginx-release-0.3.10.tar.gz
nginx-release-0.3.10.tar.bz2
nginx-0.3.10-RELEASE importrelease-0.3.10
*) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
Diffstat (limited to '')
-rw-r--r--src/imap/ngx_imap.c16
-rw-r--r--src/imap/ngx_imap_auth_http_module.c26
-rw-r--r--src/imap/ngx_imap_core_module.c12
-rw-r--r--src/imap/ngx_imap_handler.c35
-rw-r--r--src/imap/ngx_imap_parse.c2
-rw-r--r--src/imap/ngx_imap_proxy_module.c8
-rw-r--r--src/imap/ngx_imap_ssl_module.c14
7 files changed, 49 insertions, 64 deletions
diff --git a/src/imap/ngx_imap.c b/src/imap/ngx_imap.c
index b8a75ad2b..2b768ddfb 100644
--- a/src/imap/ngx_imap.c
+++ b/src/imap/ngx_imap.c
@@ -28,12 +28,12 @@ static ngx_command_t ngx_imap_commands[] = {
ngx_null_command
};
-
+
static ngx_core_module_t ngx_imap_module_ctx = {
ngx_string("imap"),
NULL,
NULL
-};
+};
ngx_module_t ngx_imap_module = {
@@ -164,7 +164,7 @@ ngx_imap_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/* init imap{} main_conf's */
if (module->init_main_conf) {
- rv = module->init_main_conf(cf, ctx->main_conf[mi]);
+ rv = module->init_main_conf(cf, ctx->main_conf[mi]);
if (rv != NGX_CONF_OK) {
*cf = pcf;
return rv;
@@ -172,9 +172,9 @@ ngx_imap_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
for (s = 0; s < cmcf->servers.nelts; s++) {
-
+
/* merge the server{}s' srv_conf's */
-
+
if (module->merge_srv_conf) {
rv = module->merge_srv_conf(cf,
ctx->srv_conf[mi],
@@ -187,9 +187,9 @@ ngx_imap_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
}
- /* imap{}'s cf->ctx was needed while the configuration merging */
-
- *cf = pcf;
+ /* imap{}'s cf->ctx was needed while the configuration merging */
+
+ *cf = pcf;
return NGX_CONF_OK;
}
diff --git a/src/imap/ngx_imap_auth_http_module.c b/src/imap/ngx_imap_auth_http_module.c
index dfe0c2043..75350d5ad 100644
--- a/src/imap/ngx_imap_auth_http_module.c
+++ b/src/imap/ngx_imap_auth_http_module.c
@@ -217,7 +217,7 @@ ngx_imap_auth_http_write_handler(ngx_event_t *wev)
ngx_log_debug0(NGX_LOG_DEBUG_IMAP, wev->log, 0,
"imap auth http write handler");
- if (wev->timedout) {
+ if (wev->timedout) {
ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
"auth http server %V timed out",
&ctx->peer.peers->peer[0].name);
@@ -275,7 +275,7 @@ ngx_imap_auth_http_read_handler(ngx_event_t *rev)
ctx = ngx_imap_get_module_ctx(s, ngx_imap_auth_http_module);
- if (rev->timedout) {
+ if (rev->timedout) {
ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT,
"auth http server %V timed out",
&ctx->peer.peers->peer[0].name);
@@ -384,7 +384,7 @@ ngx_imap_auth_http_ignore_status_line(ngx_imap_session_t *s,
state = sw_almost_done;
break;
- case LF:
+ case LF:
goto done;
}
break;
@@ -767,11 +767,11 @@ ngx_imap_auth_http_parse_header_line(ngx_imap_session_t *s,
sw_space_before_value,
sw_value,
sw_space_after_value,
- sw_almost_done,
+ sw_almost_done,
sw_header_almost_done
} state;
- state = ctx->state;
+ state = ctx->state;
hash = ctx->hash;
for (p = ctx->response->pos; p < ctx->response->last; p++) {
@@ -784,10 +784,10 @@ ngx_imap_auth_http_parse_header_line(ngx_imap_session_t *s,
switch (ch) {
case CR:
- ctx->header_end = p;
+ ctx->header_end = p;
state = sw_header_almost_done;
break;
- case LF:
+ case LF:
ctx->header_end = p;
goto header_done;
default:
@@ -1061,9 +1061,9 @@ ngx_imap_auth_http_create_request(ngx_imap_session_t *s, ngx_pool_t *pool,
static void *
ngx_imap_auth_http_create_conf(ngx_conf_t *cf)
-{
+{
ngx_imap_auth_http_conf_t *ahcf;
-
+
ahcf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_auth_http_conf_t));
if (ahcf == NULL) {
return NGX_CONF_ERROR;
@@ -1128,7 +1128,7 @@ ngx_imap_auth_http_merge_conf(ngx_conf_t *cf, void *parent, void *child)
static char *
ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
+{
ngx_imap_auth_http_conf_t *ahcf = conf;
ngx_str_t *value, *url;
@@ -1159,13 +1159,13 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ahcf->host_header.len = sizeof("localhost") - 1;
ahcf->host_header.data = (u_char *) "localhost";
ahcf->uri = unix_upstream.uri;
-
+
#else
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the unix domain sockets are not supported "
"on this platform");
return NGX_CONF_ERROR;
-
+
#endif
} else {
@@ -1196,7 +1196,7 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
static char *
ngx_imap_auth_http_header(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
+{
ngx_imap_auth_http_conf_t *ahcf = conf;
ngx_str_t *value;
diff --git a/src/imap/ngx_imap_core_module.c b/src/imap/ngx_imap_core_module.c
index d037ad83b..6408e5401 100644
--- a/src/imap/ngx_imap_core_module.c
+++ b/src/imap/ngx_imap_core_module.c
@@ -127,7 +127,7 @@ ngx_module_t ngx_imap_core_module = {
static void *
ngx_imap_core_create_main_conf(ngx_conf_t *cf)
-{
+{
ngx_imap_core_main_conf_t *cmcf;
cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_core_main_conf_t));
@@ -147,9 +147,9 @@ ngx_imap_core_create_main_conf(ngx_conf_t *cf)
static void *
ngx_imap_core_create_srv_conf(ngx_conf_t *cf)
-{
+{
ngx_imap_core_srv_conf_t *cscf;
-
+
cscf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_core_srv_conf_t));
if (cscf == NULL) {
return NULL;
@@ -299,7 +299,7 @@ ngx_imap_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
imap_ctx = cf->ctx;
ctx->main_conf = imap_ctx->main_conf;
-
+
/* the server{}'s srv_conf */
ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_imap_max_module);
@@ -388,7 +388,7 @@ ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (in_addr == INADDR_NONE) {
h = gethostbyname((const char *) inet_upstream.host.data);
-
+
if (h == NULL || h->h_addr_list[0] == NULL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"can not resolve host \"%s\" "
@@ -407,7 +407,7 @@ ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls = ngx_listening_inet_stream_socket(cf, in_addr, inet_upstream.port);
if (ls == NULL) {
- return NGX_CONF_ERROR;
+ return NGX_CONF_ERROR;
}
ls->backlog = -1;
diff --git a/src/imap/ngx_imap_handler.c b/src/imap/ngx_imap_handler.c
index ac5db73b4..ddff96a29 100644
--- a/src/imap/ngx_imap_handler.c
+++ b/src/imap/ngx_imap_handler.c
@@ -17,7 +17,6 @@ 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_handshake_handler(ngx_connection_t *c);
-static void ngx_imap_ssl_close_handler(ngx_event_t *ev);
#endif
@@ -58,7 +57,7 @@ ngx_imap_init_connection(ngx_connection_t *c)
if (lctx == NULL) {
ngx_imap_close_connection(c);
return;
- }
+ }
lctx->client = &c->addr_text;
lctx->session = NULL;
@@ -106,7 +105,7 @@ ngx_imap_init_connection(ngx_connection_t *c)
static void
ngx_imap_ssl_handshake_handler(ngx_connection_t *c)
-{
+{
if (c->ssl->handshaked) {
ngx_imap_init_session(c);
return;
@@ -181,6 +180,7 @@ ngx_imap_send(ngx_event_t *wev)
if (wev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
+ c->timedout = 1;
ngx_imap_close_connection(c);
return;
}
@@ -246,6 +246,7 @@ ngx_imap_init_protocol(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
+ c->timedout = 1;
ngx_imap_close_connection(c);
return;
}
@@ -298,6 +299,7 @@ ngx_imap_auth_state(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
+ c->timedout = 1;
ngx_imap_close_connection(c);
return;
}
@@ -498,6 +500,7 @@ ngx_pop3_auth_state(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
+ c->timedout = 1;
ngx_imap_close_connection(c);
return;
}
@@ -725,8 +728,7 @@ ngx_imap_close_connection(ngx_connection_t *c)
if (c->ssl) {
if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
- c->read->handler = ngx_imap_ssl_close_handler;
- c->write->handler = ngx_imap_ssl_close_handler;
+ c->ssl->handler = ngx_imap_close_connection;
return;
}
}
@@ -743,27 +745,6 @@ ngx_imap_close_connection(ngx_connection_t *c)
}
-#if (NGX_IMAP_SSL)
-
-static void
-ngx_imap_ssl_close_handler(ngx_event_t *ev)
-{
- ngx_connection_t *c;
-
- c = ev->data;
-
- ngx_log_debug0(NGX_LOG_DEBUG_IMAP, ev->log, 0, "http ssl close handler");
-
- if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
- return;
- }
-
- ngx_imap_close_connection(c);
-}
-
-#endif
-
-
static u_char *
ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len)
{
@@ -776,7 +757,7 @@ ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len)
len -= p - buf;
buf = p;
}
-
+
ctx = log->data;
p = ngx_snprintf(buf, len, ", client: %V", ctx->client);
diff --git a/src/imap/ngx_imap_parse.c b/src/imap/ngx_imap_parse.c
index 473825c92..d8c436b87 100644
--- a/src/imap/ngx_imap_parse.c
+++ b/src/imap/ngx_imap_parse.c
@@ -473,7 +473,7 @@ ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s)
case sw_argument:
switch (ch) {
- /*
+ /*
* the space should be considered part of the at username
* or password, but not of argument in other commands
*
diff --git a/src/imap/ngx_imap_proxy_module.c b/src/imap/ngx_imap_proxy_module.c
index e1cccf122..62329607f 100644
--- a/src/imap/ngx_imap_proxy_module.c
+++ b/src/imap/ngx_imap_proxy_module.c
@@ -172,6 +172,7 @@ ngx_imap_proxy_imap_handler(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"upstream timed out");
+ c->timedout = 1;
ngx_imap_proxy_internal_server_error(s);
return;
}
@@ -310,6 +311,7 @@ ngx_imap_proxy_pop3_handler(ngx_event_t *rev)
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"upstream timed out");
+ c->timedout = 1;
ngx_imap_proxy_internal_server_error(s);
return;
}
@@ -501,6 +503,8 @@ ngx_imap_proxy_handler(ngx_event_t *ev)
if (c == s->connection) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"client timed out");
+ c->timedout = 1;
+
} else {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"upstream timed out");
@@ -652,9 +656,9 @@ ngx_imap_proxy_close_session(ngx_imap_session_t *s)
static void *
ngx_imap_proxy_create_conf(ngx_conf_t *cf)
-{
+{
ngx_imap_proxy_conf_t *pcf;
-
+
pcf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_proxy_conf_t));
if (pcf == NULL) {
return NGX_CONF_ERROR;
diff --git a/src/imap/ngx_imap_ssl_module.c b/src/imap/ngx_imap_ssl_module.c
index f92dba60b..cbbbb6802 100644
--- a/src/imap/ngx_imap_ssl_module.c
+++ b/src/imap/ngx_imap_ssl_module.c
@@ -27,7 +27,7 @@ static char ngx_imap_ssl_openssl097[] = "OpenSSL 0.9.7 and higher";
#endif
-static ngx_conf_bitmask_t ngx_imap_ssl_protocols[] = {
+static ngx_conf_bitmask_t ngx_imap_ssl_protocols[] = {
{ ngx_string("SSLv2"), NGX_SSL_SSLv2 },
{ ngx_string("SSLv3"), NGX_SSL_SSLv3 },
{ ngx_string("TLSv1"), NGX_SSL_TLSv1 },
@@ -124,16 +124,16 @@ static u_char ngx_imap_session_id_ctx[] = "IMAP";
static void *
ngx_imap_ssl_create_conf(ngx_conf_t *cf)
-{
+{
ngx_imap_ssl_conf_t *scf;
-
+
scf = ngx_pcalloc(cf->pool, sizeof(ngx_imap_ssl_conf_t));
if (scf == NULL) {
return NGX_CONF_ERROR;
}
/*
- * set by ngx_pcalloc():
+ * set by ngx_pcalloc():
*
* scf->protocols = 0;
*
@@ -240,12 +240,12 @@ ngx_imap_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_OK;
}
-
+
#if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE)
-
+
static char *
ngx_imap_ssl_nosupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
+{
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"%V\" directive is available only in %s,",
&cmd->name, cmd->post);