comparison src/http/ngx_http.c @ 592:09d5f308901f NGINX_0_8_48

nginx 0.8.48 *) Change: now the "server_name" directive default value is an empty name "". Thanks to Gena Makhomed. *) Change: now the "server_name_in_redirect" directive default value is "off". *) Feature: the $geoip_dma_code, $geoip_area_code, and $geoip_region_name variables. Thanks to Christine McGonagle. *) Bugfix: the "proxy_pass", "fastcgi_pass", "uwsgi_pass", and "scgi_pass" directives were not inherited inside "limit_except" blocks. *) Bugfix: the "proxy_cache_min_uses", "fastcgi_cache_min_uses" "uwsgi_cache_min_uses", and "scgi_cache_min_uses" directives did not work; the bug had appeared in 0.8.46. *) Bugfix: the "fastcgi_split_path_info" directive used incorrectly captures, if only parts of an URI were captured. Thanks to Yuriy Taraday and Frank Enderle. *) Bugfix: the "rewrite" directive did not escape a ";" character during copying from URI to query string. Thanks to Daisuke Murase. *) Bugfix: the ngx_http_image_filter_module closed a connection, if an image was larger than "image_filter_buffer" size.
author Igor Sysoev <http://sysoev.ru>
date Tue, 03 Aug 2010 00:00:00 +0400
parents 016632f0fb18
children be70f83b184f
comparison
equal deleted inserted replaced
591:8b891ad58d6a 592:09d5f308901f
24 ngx_http_core_srv_conf_t *cscf, ngx_http_conf_port_t *port, 24 ngx_http_core_srv_conf_t *cscf, ngx_http_conf_port_t *port,
25 ngx_http_listen_opt_t *lsopt); 25 ngx_http_listen_opt_t *lsopt);
26 static ngx_int_t ngx_http_add_server(ngx_conf_t *cf, 26 static ngx_int_t ngx_http_add_server(ngx_conf_t *cf,
27 ngx_http_core_srv_conf_t *cscf, ngx_http_conf_addr_t *addr); 27 ngx_http_core_srv_conf_t *cscf, ngx_http_conf_addr_t *addr);
28 28
29 static char *ngx_http_merge_servers(ngx_conf_t *cf,
30 ngx_http_core_main_conf_t *cmcf, ngx_http_module_t *module,
31 ngx_uint_t ctx_index);
29 static char *ngx_http_merge_locations(ngx_conf_t *cf, 32 static char *ngx_http_merge_locations(ngx_conf_t *cf,
30 ngx_queue_t *locations, void **loc_conf, ngx_http_module_t *module, 33 ngx_queue_t *locations, void **loc_conf, ngx_http_module_t *module,
31 ngx_uint_t ctx_index); 34 ngx_uint_t ctx_index);
32 static ngx_int_t ngx_http_init_locations(ngx_conf_t *cf, 35 static ngx_int_t ngx_http_init_locations(ngx_conf_t *cf,
33 ngx_http_core_srv_conf_t *cscf, ngx_http_core_loc_conf_t *pclcf); 36 ngx_http_core_srv_conf_t *cscf, ngx_http_core_loc_conf_t *pclcf);
261 if (rv != NGX_CONF_OK) { 264 if (rv != NGX_CONF_OK) {
262 goto failed; 265 goto failed;
263 } 266 }
264 } 267 }
265 268
266 for (s = 0; s < cmcf->servers.nelts; s++) { 269 rv = ngx_http_merge_servers(cf, cmcf, module, mi);
267 270 if (rv != NGX_CONF_OK) {
268 /* merge the server{}s' srv_conf's */ 271 goto failed;
269
270 if (module->merge_srv_conf) {
271 rv = module->merge_srv_conf(cf, ctx->srv_conf[mi],
272 cscfp[s]->ctx->srv_conf[mi]);
273 if (rv != NGX_CONF_OK) {
274 goto failed;
275 }
276 }
277
278 if (module->merge_loc_conf) {
279
280 /* merge the server{}'s loc_conf */
281
282 rv = module->merge_loc_conf(cf, ctx->loc_conf[mi],
283 cscfp[s]->ctx->loc_conf[mi]);
284 if (rv != NGX_CONF_OK) {
285 goto failed;
286 }
287
288 /* merge the locations{}' loc_conf's */
289
290 clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
291
292 rv = ngx_http_merge_locations(cf, clcf->locations,
293 cscfp[s]->ctx->loc_conf,
294 module, mi);
295 if (rv != NGX_CONF_OK) {
296 goto failed;
297 }
298 }
299 } 272 }
300 } 273 }
301 274
302 275
303 /* create location trees */ 276 /* create location trees */
584 return NGX_OK; 557 return NGX_OK;
585 } 558 }
586 559
587 560
588 static char * 561 static char *
562 ngx_http_merge_servers(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
563 ngx_http_module_t *module, ngx_uint_t ctx_index)
564 {
565 char *rv;
566 ngx_uint_t s;
567 ngx_http_conf_ctx_t *ctx, saved;
568 ngx_http_core_loc_conf_t *clcf;
569 ngx_http_core_srv_conf_t **cscfp;
570
571 cscfp = cmcf->servers.elts;
572 ctx = (ngx_http_conf_ctx_t *) cf->ctx;
573 saved = *ctx;
574 rv = NGX_CONF_OK;
575
576 for (s = 0; s < cmcf->servers.nelts; s++) {
577
578 /* merge the server{}s' srv_conf's */
579
580 ctx->srv_conf = cscfp[s]->ctx->srv_conf;
581
582 if (module->merge_srv_conf) {
583 rv = module->merge_srv_conf(cf, saved.srv_conf[ctx_index],
584 cscfp[s]->ctx->srv_conf[ctx_index]);
585 if (rv != NGX_CONF_OK) {
586 goto failed;
587 }
588 }
589
590 if (module->merge_loc_conf) {
591
592 /* merge the server{}'s loc_conf */
593
594 ctx->loc_conf = cscfp[s]->ctx->loc_conf;
595
596 rv = module->merge_loc_conf(cf, saved.loc_conf[ctx_index],
597 cscfp[s]->ctx->loc_conf[ctx_index]);
598 if (rv != NGX_CONF_OK) {
599 goto failed;
600 }
601
602 /* merge the locations{}' loc_conf's */
603
604 clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
605
606 rv = ngx_http_merge_locations(cf, clcf->locations,
607 cscfp[s]->ctx->loc_conf,
608 module, ctx_index);
609 if (rv != NGX_CONF_OK) {
610 goto failed;
611 }
612 }
613 }
614
615 failed:
616
617 *ctx = saved;
618
619 return rv;
620 }
621
622
623 static char *
589 ngx_http_merge_locations(ngx_conf_t *cf, ngx_queue_t *locations, 624 ngx_http_merge_locations(ngx_conf_t *cf, ngx_queue_t *locations,
590 void **loc_conf, ngx_http_module_t *module, ngx_uint_t ctx_index) 625 void **loc_conf, ngx_http_module_t *module, ngx_uint_t ctx_index)
591 { 626 {
592 char *rv; 627 char *rv;
593 ngx_queue_t *q; 628 ngx_queue_t *q;
629 ngx_http_conf_ctx_t *ctx, saved;
594 ngx_http_core_loc_conf_t *clcf; 630 ngx_http_core_loc_conf_t *clcf;
595 ngx_http_location_queue_t *lq; 631 ngx_http_location_queue_t *lq;
596 632
597 if (locations == NULL) { 633 if (locations == NULL) {
598 return NGX_CONF_OK; 634 return NGX_CONF_OK;
599 } 635 }
636
637 ctx = (ngx_http_conf_ctx_t *) cf->ctx;
638 saved = *ctx;
600 639
601 for (q = ngx_queue_head(locations); 640 for (q = ngx_queue_head(locations);
602 q != ngx_queue_sentinel(locations); 641 q != ngx_queue_sentinel(locations);
603 q = ngx_queue_next(q)) 642 q = ngx_queue_next(q))
604 { 643 {
605 lq = (ngx_http_location_queue_t *) q; 644 lq = (ngx_http_location_queue_t *) q;
606 645
607 clcf = lq->exact ? lq->exact : lq->inclusive; 646 clcf = lq->exact ? lq->exact : lq->inclusive;
647 ctx->loc_conf = clcf->loc_conf;
608 648
609 rv = module->merge_loc_conf(cf, loc_conf[ctx_index], 649 rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
610 clcf->loc_conf[ctx_index]); 650 clcf->loc_conf[ctx_index]);
611 if (rv != NGX_CONF_OK) { 651 if (rv != NGX_CONF_OK) {
612 return rv; 652 return rv;
616 module, ctx_index); 656 module, ctx_index);
617 if (rv != NGX_CONF_OK) { 657 if (rv != NGX_CONF_OK) {
618 return rv; 658 return rv;
619 } 659 }
620 } 660 }
661
662 *ctx = saved;
621 663
622 return NGX_CONF_OK; 664 return NGX_CONF_OK;
623 } 665 }
624 666
625 667