comparison src/imap/ngx_imap_proxy_module.c @ 78:9db7e0b5b27f NGINX_0_1_39

nginx 0.1.39 *) The changes in the ngx_http_charset_module: the "default_charset" directive was canceled; the "charset" directive sets the response charset; the "source_charset" directive sets the source charset only. *) Bugfix: the backend "WWW-Authenticate" header line did not transferred while the 401 response code redirecting. *) Bugfix: the ngx_http_proxy_module and ngx_http_fastcgi_module may close a connection before anything was transferred to a client; bug appeared in 0.1.38. *) Workaround: the Linux glibc crypt_r() initialization bug. *) Bugfix: the ngx_http_ssi_module did not support the relative URI in the "include virtual" command. *) Bugfix: if the backend response had the "Location" header line and nginx should not rewrite this line, then the 500 code response body was transferred; bug appeared in 0.1.29. *) Bugfix: some directives of the ngx_http_proxy_module and ngx_http_fastcgi_module were not inherited from the server to the location level; bug appeared in 0.1.29. *) Bugfix: the ngx_http_ssl_module did not support the certificate chain. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; bug appeared in 0.1.38. *) Bugfixes in IMAP/POP3 proxy in interaction with a backend at the login state.
author Igor Sysoev <http://sysoev.ru>
date Thu, 14 Jul 2005 00:00:00 +0400
parents da9a3b14312d
children 6ae11d59d10e
comparison
equal deleted inserted replaced
77:e6b3de2dc637 78:9db7e0b5b27f
167 167
168 if (rc == NGX_AGAIN) { 168 if (rc == NGX_AGAIN) {
169 return; 169 return;
170 } 170 }
171 171
172 if (rc == NGX_ERROR) { 172 if (rc == NGX_ERROR || rc == NGX_IMAP_PROXY_INVALID) {
173 ngx_imap_proxy_internal_server_error(s); 173 ngx_imap_proxy_internal_server_error(s);
174 return;
175 }
176
177 if (rc == NGX_IMAP_PROXY_ERROR) {
178 s->connection->read->handler = ngx_imap_proxy_handler;
179 s->connection->write->handler = ngx_imap_proxy_handler;
180 rev->handler = ngx_imap_proxy_handler;
181 c->write->handler = ngx_imap_proxy_handler;
182
183 ngx_imap_proxy_handler(c->read);
174 return; 184 return;
175 } 185 }
176 186
177 switch (s->imap_state) { 187 switch (s->imap_state) {
178 188
196 break; 206 break;
197 207
198 case ngx_imap_login: 208 case ngx_imap_login:
199 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0, "imap proxy send user"); 209 ngx_log_debug0(NGX_LOG_DEBUG_IMAP, rev->log, 0, "imap proxy send user");
200 210
201 line.len = s->login.len + 1 + NGX_SIZE_T_LEN + 1 + 2; 211 line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2;
202 line.data = ngx_palloc(c->pool, line.len); 212 line.data = ngx_palloc(c->pool, line.len);
203 if (line.data == NULL) { 213 if (line.data == NULL) {
204 ngx_imap_proxy_internal_server_error(s); 214 ngx_imap_proxy_internal_server_error(s);
205 return; 215 return;
206 } 216 }
207 217
208 line.len = ngx_sprintf(line.data, "%V{%uz}" CRLF, 218 line.len = ngx_sprintf(line.data, "%V {%uz}" CRLF,
209 &s->login, s->passwd.len) 219 &s->login, s->passwd.len)
210 - line.data; 220 - line.data;
211 221
212 s->imap_state = ngx_imap_user; 222 s->imap_state = ngx_imap_user;
213 break; 223 break;
296 306
297 if (rc == NGX_AGAIN) { 307 if (rc == NGX_AGAIN) {
298 return; 308 return;
299 } 309 }
300 310
301 if (rc == NGX_ERROR) { 311 if (rc == NGX_ERROR || rc == NGX_IMAP_PROXY_INVALID) {
302 ngx_imap_proxy_internal_server_error(s); 312 ngx_imap_proxy_internal_server_error(s);
313 return;
314 }
315
316 if (rc == NGX_IMAP_PROXY_ERROR) {
317 s->connection->read->handler = ngx_imap_proxy_handler;
318 s->connection->write->handler = ngx_imap_proxy_handler;
319 rev->handler = ngx_imap_proxy_handler;
320 c->write->handler = ngx_imap_proxy_handler;
321
322 ngx_imap_proxy_handler(c->read);
303 return; 323 return;
304 } 324 }
305 325
306 switch (s->imap_state) { 326 switch (s->imap_state) {
307 327
422 if (p[0] == '-' && p[1] == 'E' && p[2] == 'R' && p[3] == 'R') { 442 if (p[0] == '-' && p[1] == 'E' && p[2] == 'R' && p[3] == 'R') {
423 return NGX_IMAP_PROXY_ERROR; 443 return NGX_IMAP_PROXY_ERROR;
424 } 444 }
425 445
426 } else { 446 } else {
447 if (p[0] == 'N' && p[1] == 'O') {
448 return NGX_IMAP_PROXY_ERROR;
449 }
450
427 if (what == NGX_IMAP_WAIT_OK) { 451 if (what == NGX_IMAP_WAIT_OK) {
428 if (p[0] == '*' && p[1] == ' ' && p[2] == 'O' && p[3] == 'K') { 452 if (p[0] == '*' && p[1] == ' ' && p[2] == 'O' && p[3] == 'K') {
429 return NGX_OK; 453 return NGX_OK;
430 } 454 }
431 455
432 } else { 456 } else {
433 if (p[0] == '+' && p[1] == ' ' && p[2] == 'O' && p[3] == 'K') { 457 if (p[0] == '+') {
434 return NGX_OK; 458 return NGX_OK;
435 } 459 }
436 } 460 }
437 } 461 }
438 462
526 } 550 }
527 } 551 }
528 552
529 if (n == NGX_AGAIN || n < (ssize_t) size) { 553 if (n == NGX_AGAIN || n < (ssize_t) size) {
530 if (ngx_handle_write_event(dst->write, /* TODO: LOWAT */ 0) 554 if (ngx_handle_write_event(dst->write, /* TODO: LOWAT */ 0)
531 == NGX_ERROR) 555 == NGX_ERROR)
532 { 556 {
533 ngx_imap_proxy_close_session(s); 557 ngx_imap_proxy_close_session(s);
534 return; 558 return;
535 } 559 }
536 } 560 }