Mercurial > hg > nginx-vendor-current
comparison src/imap/ngx_imap_core_module.c @ 190:3689cd4e3228 NGINX_0_3_42
nginx 0.3.42
*) Feature: the "bind" option of the "listen" directive in IMAP/POP3
proxy.
*) Bugfix: if the same capture in the "rewrite" directive was used more
then once.
*) Bugfix: the $sent_http_content_type, $sent_http_content_length,
$sent_http_last_modified, $sent_http_connection,
$sent_http_keep_alive, and $sent_http_transfer_encoding variables
were not written to access log.
*) Bugfix: the $sent_http_cache_control returned value of the single
"Cache-Control" response header line.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 26 Apr 2006 00:00:00 +0400 |
parents | 3314be145cb9 |
children | 56688ed172c8 |
comparison
equal
deleted
inserted
replaced
189:fca7768a4aca | 190:3689cd4e3228 |
---|---|
53 0, | 53 0, |
54 0, | 54 0, |
55 NULL }, | 55 NULL }, |
56 | 56 |
57 { ngx_string("listen"), | 57 { ngx_string("listen"), |
58 NGX_IMAP_SRV_CONF|NGX_CONF_TAKE1, | 58 NGX_IMAP_SRV_CONF|NGX_CONF_TAKE12, |
59 ngx_imap_core_listen, | 59 ngx_imap_core_listen, |
60 0, | 60 0, |
61 0, | 61 0, |
62 NULL }, | 62 NULL }, |
63 | 63 |
141 if (cmcf == NULL) { | 141 if (cmcf == NULL) { |
142 return NGX_CONF_ERROR; | 142 return NGX_CONF_ERROR; |
143 } | 143 } |
144 | 144 |
145 if (ngx_array_init(&cmcf->servers, cf->pool, 4, | 145 if (ngx_array_init(&cmcf->servers, cf->pool, 4, |
146 sizeof(ngx_imap_core_srv_conf_t *)) == NGX_ERROR) | 146 sizeof(ngx_imap_core_srv_conf_t *)) |
147 != NGX_OK) | |
148 { | |
149 return NGX_CONF_ERROR; | |
150 } | |
151 | |
152 if (ngx_array_init(&cmcf->listen, cf->pool, 4, sizeof(ngx_imap_listen_t)) | |
153 != NGX_OK) | |
147 { | 154 { |
148 return NGX_CONF_ERROR; | 155 return NGX_CONF_ERROR; |
149 } | 156 } |
150 | 157 |
151 return cmcf; | 158 return cmcf; |
417 /* AF_INET only */ | 424 /* AF_INET only */ |
418 | 425 |
419 static char * | 426 static char * |
420 ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 427 ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
421 { | 428 { |
422 char *err; | 429 char *err; |
423 ngx_str_t *value; | 430 ngx_str_t *value; |
424 in_addr_t in_addr; | 431 in_addr_t in_addr; |
425 struct hostent *h; | 432 ngx_uint_t i; |
426 ngx_listening_t *ls; | 433 struct hostent *h; |
427 ngx_inet_upstream_t inet_upstream; | 434 ngx_imap_listen_t *imls; |
435 ngx_inet_upstream_t inet_upstream; | |
436 ngx_imap_core_main_conf_t *cmcf; | |
428 | 437 |
429 value = cf->args->elts; | 438 value = cf->args->elts; |
430 | 439 |
431 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); | 440 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); |
432 | 441 |
467 | 476 |
468 } else { | 477 } else { |
469 in_addr = INADDR_ANY; | 478 in_addr = INADDR_ANY; |
470 } | 479 } |
471 | 480 |
472 | 481 cmcf = ngx_imap_conf_get_module_main_conf(cf, ngx_imap_core_module); |
473 ls = ngx_listening_inet_stream_socket(cf, in_addr, inet_upstream.port); | 482 |
474 if (ls == NULL) { | 483 imls = cmcf->listen.elts; |
475 return NGX_CONF_ERROR; | 484 |
476 } | 485 for (i = 0; i < cmcf->listen.nelts; i++) { |
477 | 486 |
478 ls->backlog = -1; | 487 if (imls[i].addr != in_addr || imls[i].port != inet_upstream.port) { |
479 ls->rcvbuf = -1; | 488 continue; |
480 ls->sndbuf = -1; | 489 } |
481 | 490 |
482 ls->addr_ntop = 1; | 491 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
483 ls->handler = ngx_imap_init_connection; | 492 "duplicate \"%V\" address and port pair", |
484 ls->pool_size = 256; | 493 &inet_upstream.url); |
485 | 494 return NGX_CONF_ERROR; |
486 ls->ctx = cf->ctx; | 495 } |
487 | 496 |
488 /* STUB */ | 497 imls = ngx_array_push(&cmcf->listen); |
489 ls->log = *cf->cycle->new_log; | 498 if (imls == NULL) { |
490 ls->log.data = &ls->addr_text; | 499 return NGX_CONF_ERROR; |
491 ls->log.handler = ngx_accept_log_error; | 500 } |
492 /**/ | 501 |
493 | 502 ngx_memzero(imls, sizeof(ngx_imap_listen_t)); |
494 return NGX_CONF_OK; | 503 |
504 imls->addr = in_addr; | |
505 imls->port = inet_upstream.port; | |
506 imls->family = AF_INET; | |
507 imls->ctx = cf->ctx; | |
508 | |
509 if (cf->args->nelts == 2) { | |
510 return NGX_CONF_OK; | |
511 } | |
512 | |
513 if (ngx_strcmp(value[2].data, "bind") == 0) { | |
514 imls->bind = 1; | |
515 return NGX_CONF_OK; | |
516 } | |
517 | |
518 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
519 "the invalid \"%V\" parameter", &value[2]); | |
520 return NGX_CONF_ERROR; | |
495 } | 521 } |
496 | 522 |
497 | 523 |
498 static char * | 524 static char * |
499 ngx_imap_core_capability(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 525 ngx_imap_core_capability(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |