Mercurial > hg > nginx
comparison src/imap/ngx_imap_handler.c @ 577:4d9ea73a627a release-0.3.10
nginx-0.3.10-RELEASE import
*) 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.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 15 Nov 2005 13:30:52 +0000 |
parents | 174f1e853e1e |
children | 4e296b7d25bf |
comparison
equal
deleted
inserted
replaced
576:3e0b61c26426 | 577:4d9ea73a627a |
---|---|
15 static ngx_int_t ngx_imap_read_command(ngx_imap_session_t *s); | 15 static ngx_int_t ngx_imap_read_command(ngx_imap_session_t *s); |
16 static u_char *ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len); | 16 static u_char *ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len); |
17 | 17 |
18 #if (NGX_IMAP_SSL) | 18 #if (NGX_IMAP_SSL) |
19 static void ngx_imap_ssl_handshake_handler(ngx_connection_t *c); | 19 static void ngx_imap_ssl_handshake_handler(ngx_connection_t *c); |
20 static void ngx_imap_ssl_close_handler(ngx_event_t *ev); | |
21 #endif | 20 #endif |
22 | 21 |
23 | 22 |
24 static ngx_str_t greetings[] = { | 23 static ngx_str_t greetings[] = { |
25 ngx_string("+OK POP3 ready" CRLF), | 24 ngx_string("+OK POP3 ready" CRLF), |
56 | 55 |
57 lctx = ngx_palloc(c->pool, sizeof(ngx_imap_log_ctx_t)); | 56 lctx = ngx_palloc(c->pool, sizeof(ngx_imap_log_ctx_t)); |
58 if (lctx == NULL) { | 57 if (lctx == NULL) { |
59 ngx_imap_close_connection(c); | 58 ngx_imap_close_connection(c); |
60 return; | 59 return; |
61 } | 60 } |
62 | 61 |
63 lctx->client = &c->addr_text; | 62 lctx->client = &c->addr_text; |
64 lctx->session = NULL; | 63 lctx->session = NULL; |
65 | 64 |
66 c->log->connection = c->number; | 65 c->log->connection = c->number; |
104 | 103 |
105 #if (NGX_IMAP_SSL) | 104 #if (NGX_IMAP_SSL) |
106 | 105 |
107 static void | 106 static void |
108 ngx_imap_ssl_handshake_handler(ngx_connection_t *c) | 107 ngx_imap_ssl_handshake_handler(ngx_connection_t *c) |
109 { | 108 { |
110 if (c->ssl->handshaked) { | 109 if (c->ssl->handshaked) { |
111 ngx_imap_init_session(c); | 110 ngx_imap_init_session(c); |
112 return; | 111 return; |
113 } | 112 } |
114 | 113 |
179 c = wev->data; | 178 c = wev->data; |
180 s = c->data; | 179 s = c->data; |
181 | 180 |
182 if (wev->timedout) { | 181 if (wev->timedout) { |
183 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); | 182 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
183 c->timedout = 1; | |
184 ngx_imap_close_connection(c); | 184 ngx_imap_close_connection(c); |
185 return; | 185 return; |
186 } | 186 } |
187 | 187 |
188 if (s->out.len == 0) { | 188 if (s->out.len == 0) { |
244 | 244 |
245 c->log->action = "in auth state"; | 245 c->log->action = "in auth state"; |
246 | 246 |
247 if (rev->timedout) { | 247 if (rev->timedout) { |
248 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); | 248 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
249 c->timedout = 1; | |
249 ngx_imap_close_connection(c); | 250 ngx_imap_close_connection(c); |
250 return; | 251 return; |
251 } | 252 } |
252 | 253 |
253 s = c->data; | 254 s = c->data; |
296 | 297 |
297 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "imap auth state"); | 298 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "imap auth state"); |
298 | 299 |
299 if (rev->timedout) { | 300 if (rev->timedout) { |
300 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); | 301 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
302 c->timedout = 1; | |
301 ngx_imap_close_connection(c); | 303 ngx_imap_close_connection(c); |
302 return; | 304 return; |
303 } | 305 } |
304 | 306 |
305 if (s->out.len) { | 307 if (s->out.len) { |
496 | 498 |
497 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "pop3 auth state"); | 499 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, c->log, 0, "pop3 auth state"); |
498 | 500 |
499 if (rev->timedout) { | 501 if (rev->timedout) { |
500 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); | 502 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); |
503 c->timedout = 1; | |
501 ngx_imap_close_connection(c); | 504 ngx_imap_close_connection(c); |
502 return; | 505 return; |
503 } | 506 } |
504 | 507 |
505 if (s->out.len) { | 508 if (s->out.len) { |
723 | 726 |
724 #if (NGX_IMAP_SSL) | 727 #if (NGX_IMAP_SSL) |
725 | 728 |
726 if (c->ssl) { | 729 if (c->ssl) { |
727 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { | 730 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { |
728 c->read->handler = ngx_imap_ssl_close_handler; | 731 c->ssl->handler = ngx_imap_close_connection; |
729 c->write->handler = ngx_imap_ssl_close_handler; | |
730 return; | 732 return; |
731 } | 733 } |
732 } | 734 } |
733 | 735 |
734 #endif | 736 #endif |
739 | 741 |
740 ngx_close_connection(c); | 742 ngx_close_connection(c); |
741 | 743 |
742 ngx_destroy_pool(pool); | 744 ngx_destroy_pool(pool); |
743 } | 745 } |
744 | |
745 | |
746 #if (NGX_IMAP_SSL) | |
747 | |
748 static void | |
749 ngx_imap_ssl_close_handler(ngx_event_t *ev) | |
750 { | |
751 ngx_connection_t *c; | |
752 | |
753 c = ev->data; | |
754 | |
755 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, ev->log, 0, "http ssl close handler"); | |
756 | |
757 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { | |
758 return; | |
759 } | |
760 | |
761 ngx_imap_close_connection(c); | |
762 } | |
763 | |
764 #endif | |
765 | 746 |
766 | 747 |
767 static u_char * | 748 static u_char * |
768 ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len) | 749 ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len) |
769 { | 750 { |
774 if (log->action) { | 755 if (log->action) { |
775 p = ngx_snprintf(buf, len, " while %s", log->action); | 756 p = ngx_snprintf(buf, len, " while %s", log->action); |
776 len -= p - buf; | 757 len -= p - buf; |
777 buf = p; | 758 buf = p; |
778 } | 759 } |
779 | 760 |
780 ctx = log->data; | 761 ctx = log->data; |
781 | 762 |
782 p = ngx_snprintf(buf, len, ", client: %V", ctx->client); | 763 p = ngx_snprintf(buf, len, ", client: %V", ctx->client); |
783 len -= p - buf; | 764 len -= p - buf; |
784 buf = p; | 765 buf = p; |