comparison src/http/modules/ngx_http_proxy_module.c @ 2784:c2230102df6f

*) check a proxy_redirect single parameter *) warn about "proxy_redirect false"
author Igor Sysoev <igor@sysoev.ru>
date Thu, 30 Apr 2009 12:43:38 +0000
parents 9ba1bee1b1e4
children 4e002555652d
comparison
equal deleted inserted replaced
2783:87c088e6956a 2784:c2230102df6f
2673 return NGX_CONF_OK; 2673 return NGX_CONF_OK;
2674 } 2674 }
2675 2675
2676 value = cf->args->elts; 2676 value = cf->args->elts;
2677 2677
2678 if (ngx_strcmp(value[1].data, "off") == 0) { 2678 if (cf->args->nelts == 2) {
2679 plcf->redirect = 0; 2679 if (ngx_strcmp(value[1].data, "off") == 0) {
2680 plcf->redirects = NULL; 2680 plcf->redirect = 0;
2681 return NGX_CONF_OK; 2681 plcf->redirects = NULL;
2682 return NGX_CONF_OK;
2683 }
2684
2685 if (ngx_strcmp(value[1].data, "false") == 0) {
2686 ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
2687 "invalid parameter \"false\", use \"off\" instead");
2688 plcf->redirect = 0;
2689 plcf->redirects = NULL;
2690 return NGX_CONF_OK;
2691 }
2692
2693 if (ngx_strcmp(value[1].data, "default") != 0) {
2694 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2695 "invalid parameter \"%V\"", &value[1]);
2696 return NGX_CONF_ERROR;
2697 }
2682 } 2698 }
2683 2699
2684 if (plcf->redirects == NULL) { 2700 if (plcf->redirects == NULL) {
2685 plcf->redirects = ngx_array_create(cf->pool, 1, 2701 plcf->redirects = ngx_array_create(cf->pool, 1,
2686 sizeof(ngx_http_proxy_redirect_t)); 2702 sizeof(ngx_http_proxy_redirect_t));
2692 pr = ngx_array_push(plcf->redirects); 2708 pr = ngx_array_push(plcf->redirects);
2693 if (pr == NULL) { 2709 if (pr == NULL) {
2694 return NGX_CONF_ERROR; 2710 return NGX_CONF_ERROR;
2695 } 2711 }
2696 2712
2697 if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "default") == 0) { 2713 if (ngx_strcmp(value[1].data, "default") == 0) {
2698 if (plcf->url.data == NULL) { 2714 if (plcf->url.data == NULL) {
2699 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2715 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2700 "\"proxy_rewrite_location default\" must go " 2716 "\"proxy_rewrite_location default\" must go "
2701 "after the \"proxy_pass\" directive"); 2717 "after the \"proxy_pass\" directive");
2702 return NGX_CONF_ERROR; 2718 return NGX_CONF_ERROR;