comparison src/http/ngx_http_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 6f21ae02fb01
children f200748c0ac8
comparison
equal deleted inserted replaced
645:e461dead01e9 646:615b5ea36fc0
716 NGX_HTTP_LOC_CONF_OFFSET, 716 NGX_HTTP_LOC_CONF_OFFSET,
717 offsetof(ngx_http_core_loc_conf_t, open_file_cache_events), 717 offsetof(ngx_http_core_loc_conf_t, open_file_cache_events),
718 NULL }, 718 NULL },
719 719
720 { ngx_string("resolver"), 720 { ngx_string("resolver"),
721 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 721 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
722 ngx_http_core_resolver, 722 ngx_http_core_resolver,
723 NGX_HTTP_LOC_CONF_OFFSET, 723 NGX_HTTP_LOC_CONF_OFFSET,
724 0, 724 0,
725 NULL }, 725 NULL },
726 726
3533 /* 3533 /*
3534 * create dummy resolver in http {} context 3534 * create dummy resolver in http {} context
3535 * to inherit it in all servers 3535 * to inherit it in all servers
3536 */ 3536 */
3537 3537
3538 prev->resolver = ngx_resolver_create(cf, NULL); 3538 prev->resolver = ngx_resolver_create(cf, NULL, 0);
3539 if (prev->resolver == NULL) { 3539 if (prev->resolver == NULL) {
3540 return NGX_CONF_ERROR; 3540 return NGX_CONF_ERROR;
3541 } 3541 }
3542 } 3542 }
3543 3543
4538 static char * 4538 static char *
4539 ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 4539 ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4540 { 4540 {
4541 ngx_http_core_loc_conf_t *clcf = conf; 4541 ngx_http_core_loc_conf_t *clcf = conf;
4542 4542
4543 ngx_url_t u;
4544 ngx_str_t *value; 4543 ngx_str_t *value;
4545 4544
4546 if (clcf->resolver) { 4545 if (clcf->resolver) {
4547 return "is duplicate"; 4546 return "is duplicate";
4548 } 4547 }
4549 4548
4550 value = cf->args->elts; 4549 value = cf->args->elts;
4551 4550
4552 ngx_memzero(&u, sizeof(ngx_url_t)); 4551 clcf->resolver = ngx_resolver_create(cf, &value[1], cf->args->nelts - 1);
4553 4552 if (clcf->resolver == NULL) {
4554 u.host = value[1];
4555 u.port = 53;
4556
4557 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
4558 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
4559 return NGX_CONF_ERROR; 4553 return NGX_CONF_ERROR;
4560 }
4561
4562 clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
4563 if (clcf->resolver == NULL) {
4564 return NGX_OK;
4565 } 4554 }
4566 4555
4567 return NGX_CONF_OK; 4556 return NGX_CONF_OK;
4568 } 4557 }
4569 4558