comparison src/imap/ngx_imap_proxy_module.c @ 96:ca4f70b3ccc6 NGINX_0_2_2

nginx 0.2.2 *) Feature: the "config errmsg" command of the ngx_http_ssi_module. *) Change: the ngx_http_geo_module variables can be overridden by the "set" directive. *) Feature: the "ssl_protocols" and "ssl_prefer_server_ciphers" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; *) Bugfix: the ngx_http_autoindex_module now do not show the files starting by dot. *) Bugfix: if the SSL handshake failed then another connection may be closed too. Thanks to Rob Mueller. *) Bugfix: the export versions of MSIE 5.x could not connect via HTTPS.
author Igor Sysoev <http://sysoev.ru>
date Fri, 30 Sep 2005 00:00:00 +0400
parents 45945fa8b8ba
children e85dca77c46a
comparison
equal deleted inserted replaced
95:2f95911bc4b4 96:ca4f70b3ccc6
154 154
155 155
156 static void 156 static void
157 ngx_imap_proxy_imap_handler(ngx_event_t *rev) 157 ngx_imap_proxy_imap_handler(ngx_event_t *rev)
158 { 158 {
159 char *action;
159 u_char *p; 160 u_char *p;
160 ngx_int_t rc; 161 ngx_int_t rc;
161 ngx_str_t line; 162 ngx_str_t line;
162 ngx_connection_t *c; 163 ngx_connection_t *c;
163 ngx_imap_session_t *s; 164 ngx_imap_session_t *s;
291 292
292 pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module); 293 pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module);
293 ngx_add_timer(s->connection->read, pcf->timeout); 294 ngx_add_timer(s->connection->read, pcf->timeout);
294 ngx_del_timer(c->read); 295 ngx_del_timer(c->read);
295 296
297 action = c->log->action;
298 c->log->action = NULL;
299 ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
300 c->log->action = action;
301
296 c->log->action = "proxying"; 302 c->log->action = "proxying";
297 } 303 }
298 } 304 }
299 305
300 306
301 static void 307 static void
302 ngx_imap_proxy_pop3_handler(ngx_event_t *rev) 308 ngx_imap_proxy_pop3_handler(ngx_event_t *rev)
303 { 309 {
310 char *action;
304 u_char *p; 311 u_char *p;
305 ngx_int_t rc; 312 ngx_int_t rc;
306 ngx_str_t line; 313 ngx_str_t line;
307 ngx_connection_t *c; 314 ngx_connection_t *c;
308 ngx_imap_session_t *s; 315 ngx_imap_session_t *s;
415 c->write->handler = ngx_imap_proxy_handler; 422 c->write->handler = ngx_imap_proxy_handler;
416 423
417 pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module); 424 pcf = ngx_imap_get_module_srv_conf(s, ngx_imap_proxy_module);
418 ngx_add_timer(s->connection->read, pcf->timeout); 425 ngx_add_timer(s->connection->read, pcf->timeout);
419 ngx_del_timer(c->read); 426 ngx_del_timer(c->read);
427
428 action = c->log->action;
429 c->log->action = NULL;
430 ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
431 c->log->action = action;
420 432
421 c->log->action = "proxying"; 433 c->log->action = "proxying";
422 } 434 }
423 } 435 }
424 436
505 517
506 518
507 static void 519 static void
508 ngx_imap_proxy_handler(ngx_event_t *ev) 520 ngx_imap_proxy_handler(ngx_event_t *ev)
509 { 521 {
522 char *action;
510 size_t size; 523 size_t size;
511 ssize_t n; 524 ssize_t n;
512 ngx_buf_t *b; 525 ngx_buf_t *b;
513 ngx_uint_t again, do_write; 526 ngx_uint_t again, do_write;
514 ngx_connection_t *c, *src, *dst; 527 ngx_connection_t *c, *src, *dst;
601 size = b->end - b->last; 614 size = b->end - b->last;
602 615
603 if (size && src->read->ready) { 616 if (size && src->read->ready) {
604 n = src->recv(src, b->last, size); 617 n = src->recv(src, b->last, size);
605 618
606 if (n == NGX_ERROR || n == 0) { 619 if (n == NGX_ERROR) {
620 ngx_imap_proxy_close_session(s);
621 return;
622 }
623
624 if (n == 0) {
625 action = c->log->action;
626 c->log->action = NULL;
627 ngx_log_error(NGX_LOG_INFO, c->log, 0, "proxied session done");
628 c->log->action = action;
629
607 ngx_imap_proxy_close_session(s); 630 ngx_imap_proxy_close_session(s);
608 return; 631 return;
609 } 632 }
610 633
611 if (n > 0) { 634 if (n > 0) {