comparison src/mail/ngx_mail_smtp_handler.c @ 442:670af56a1158 NGINX_0_7_33

nginx 0.7.33 *) Bugfix: a double response might be returned if the epoll or rtsig methods are used and a redirect was returned to a request with body. Thanks to Eden Li. *) Bugfix: the $sent_http_location variable was empty for some redirects types. *) Bugfix: a segmentation fault might occur in worker process if "resolver" directive was used in SMTP proxy.
author Igor Sysoev <http://sysoev.ru>
date Mon, 02 Feb 2009 00:00:00 +0300
parents dac47e9ef0d5
children 33394d1255b0
comparison
equal deleted inserted replaced
441:52bbf0e6dfad 442:670af56a1158
10 #include <ngx_mail.h> 10 #include <ngx_mail.h>
11 #include <ngx_mail_smtp_module.h> 11 #include <ngx_mail_smtp_module.h>
12 12
13 13
14 static void ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx); 14 static void ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx);
15 static void ngx_mail_smtp_resolve_name(ngx_event_t *rev);
15 static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx); 16 static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx);
16 static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c); 17 static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c);
17 static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev); 18 static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev);
18 static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, 19 static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s,
19 ngx_connection_t *c); 20 ngx_connection_t *c);
89 90
90 91
91 static void 92 static void
92 ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx) 93 ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx)
93 { 94 {
94 ngx_connection_t *c; 95 ngx_connection_t *c;
95 ngx_mail_session_t *s; 96 ngx_mail_session_t *s;
96 ngx_mail_core_srv_conf_t *cscf;
97 97
98 s = ctx->data; 98 s = ctx->data;
99 c = s->connection; 99 c = s->connection;
100 100
101 if (ctx->state) { 101 if (ctx->state) {
131 131
132 ngx_resolve_addr_done(ctx); 132 ngx_resolve_addr_done(ctx);
133 133
134 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0, 134 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
135 "address resolved: %V", &s->host); 135 "address resolved: %V", &s->host);
136
137 c->read->handler = ngx_mail_smtp_resolve_name;
138
139 ngx_post_event(c->read, &ngx_posted_events);
140 }
141
142
143 static void
144 ngx_mail_smtp_resolve_name(ngx_event_t *rev)
145 {
146 ngx_connection_t *c;
147 ngx_mail_session_t *s;
148 ngx_resolver_ctx_t *ctx;
149 ngx_mail_core_srv_conf_t *cscf;
150
151 c = rev->data;
152 s = c->data;
136 153
137 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); 154 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
138 155
139 ctx = ngx_resolve_start(cscf->resolver, NULL); 156 ctx = ngx_resolve_start(cscf->resolver, NULL);
140 if (ctx == NULL) { 157 if (ctx == NULL) {