comparison src/http/modules/ngx_http_rewrite_module.c @ 2027:f321b59ae0e9

locations tree
author Igor Sysoev <igor@sysoev.ru>
date Sat, 24 May 2008 14:14:13 +0000
parents 4c43e25d11ea
children 989176d3ffc5
comparison
equal deleted inserted replaced
2026:72db8932f782 2027:f321b59ae0e9
522 u_char *elts; 522 u_char *elts;
523 ngx_uint_t i; 523 ngx_uint_t i;
524 ngx_conf_t save; 524 ngx_conf_t save;
525 ngx_http_module_t *module; 525 ngx_http_module_t *module;
526 ngx_http_conf_ctx_t *ctx, *pctx; 526 ngx_http_conf_ctx_t *ctx, *pctx;
527 ngx_http_core_loc_conf_t *clcf, *pclcf, **clcfp; 527 ngx_http_core_loc_conf_t *clcf, *pclcf;
528 ngx_http_script_if_code_t *if_code; 528 ngx_http_script_if_code_t *if_code;
529 ngx_http_rewrite_loc_conf_t *nlcf; 529 ngx_http_rewrite_loc_conf_t *nlcf;
530 530
531 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); 531 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
532 if (ctx == NULL) { 532 if (ctx == NULL) {
565 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; 565 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
566 clcf->loc_conf = ctx->loc_conf; 566 clcf->loc_conf = ctx->loc_conf;
567 clcf->name = pclcf->name; 567 clcf->name = pclcf->name;
568 clcf->noname = 1; 568 clcf->noname = 1;
569 569
570 if (pclcf->locations == NULL) { 570 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
571 pclcf->locations = ngx_array_create(cf->pool, 2, sizeof(void *)); 571 return NGX_CONF_ERROR;
572 if (pclcf->locations == NULL) { 572 }
573 return NGX_CONF_ERROR;
574 }
575 }
576
577 clcfp = ngx_array_push(pclcf->locations);
578 if (clcfp == NULL) {
579 return NGX_CONF_ERROR;
580 }
581
582 *clcfp = clcf;
583
584 573
585 if (ngx_http_rewrite_if_condition(cf, lcf) != NGX_CONF_OK) { 574 if (ngx_http_rewrite_if_condition(cf, lcf) != NGX_CONF_OK) {
586 return NGX_CONF_ERROR; 575 return NGX_CONF_ERROR;
587 } 576 }
588 577