comparison src/mail/ngx_mail_core_module.c @ 646:615b5ea36fc0 NGINX_1_1_7

nginx 1.1.7 *) Feature: support of several resolvers in the "resolver" directive. Thanks to Kirill A. Korinskiy. *) Bugfix: a segmentation fault occurred on start or while reconfiguration if the "ssl" directive was used at http level and there was no "ssl_certificate" defined. *) Bugfix: reduced memory consumption while proxying of big files if they were buffered to disk. *) Bugfix: a segmentation fault might occur in a worker process if "proxy_http_version 1.1" directive was used. *) Bugfix: in the "expires @time" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 31 Oct 2011 00:00:00 +0400
parents f39b9e29530d
children 753f505670e0
comparison
equal deleted inserted replaced
645:e461dead01e9 646:615b5ea36fc0
67 NGX_MAIL_SRV_CONF_OFFSET, 67 NGX_MAIL_SRV_CONF_OFFSET,
68 offsetof(ngx_mail_core_srv_conf_t, server_name), 68 offsetof(ngx_mail_core_srv_conf_t, server_name),
69 NULL }, 69 NULL },
70 70
71 { ngx_string("resolver"), 71 { ngx_string("resolver"),
72 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, 72 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE,
73 ngx_mail_core_resolver, 73 ngx_mail_core_resolver,
74 NGX_MAIL_SRV_CONF_OFFSET, 74 NGX_MAIL_SRV_CONF_OFFSET,
75 0, 75 0,
76 NULL }, 76 NULL },
77 77
491 static char * 491 static char *
492 ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 492 ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
493 { 493 {
494 ngx_mail_core_srv_conf_t *cscf = conf; 494 ngx_mail_core_srv_conf_t *cscf = conf;
495 495
496 ngx_url_t u;
497 ngx_str_t *value; 496 ngx_str_t *value;
498 497
499 value = cf->args->elts; 498 value = cf->args->elts;
500 499
501 if (cscf->resolver != NGX_CONF_UNSET_PTR) { 500 if (cscf->resolver != NGX_CONF_UNSET_PTR) {
505 if (ngx_strcmp(value[1].data, "off") == 0) { 504 if (ngx_strcmp(value[1].data, "off") == 0) {
506 cscf->resolver = NULL; 505 cscf->resolver = NULL;
507 return NGX_CONF_OK; 506 return NGX_CONF_OK;
508 } 507 }
509 508
510 ngx_memzero(&u, sizeof(ngx_url_t)); 509 cscf->resolver = ngx_resolver_create(cf, &value[1], cf->args->nelts - 1);
511
512 u.host = value[1];
513 u.port = 53;
514
515 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
516 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
517 return NGX_CONF_ERROR;
518 }
519
520 cscf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
521 if (cscf->resolver == NULL) { 510 if (cscf->resolver == NULL) {
522 return NGX_CONF_OK; 511 return NGX_CONF_ERROR;
523 } 512 }
524 513
525 return NGX_CONF_OK; 514 return NGX_CONF_OK;
526 } 515 }
527 516