Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 7071:cce6936ed2f4
Precontent phase.
The phase is added instead of the try_files phase. Unlike the old phase, the
new one supports registering multiple handlers. The try_files implementation is
moved to a separate ngx_http_try_files_module, which now registers a precontent
phase handler.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 20 Jul 2017 15:51:11 +0300 |
parents | 863b862534d7 |
children | e7b2b907c0f8 |
comparison
equal
deleted
inserted
replaced
7070:f583559aadc7 | 7071:cce6936ed2f4 |
---|---|
380 != NGX_OK) | 380 != NGX_OK) |
381 { | 381 { |
382 return NGX_ERROR; | 382 return NGX_ERROR; |
383 } | 383 } |
384 | 384 |
385 if (ngx_array_init(&cmcf->phases[NGX_HTTP_PRECONTENT_PHASE].handlers, | |
386 cf->pool, 2, sizeof(ngx_http_handler_pt)) | |
387 != NGX_OK) | |
388 { | |
389 return NGX_ERROR; | |
390 } | |
391 | |
385 if (ngx_array_init(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers, | 392 if (ngx_array_init(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers, |
386 cf->pool, 4, sizeof(ngx_http_handler_pt)) | 393 cf->pool, 4, sizeof(ngx_http_handler_pt)) |
387 != NGX_OK) | 394 != NGX_OK) |
388 { | 395 { |
389 return NGX_ERROR; | 396 return NGX_ERROR; |
457 use_rewrite = cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers.nelts ? 1 : 0; | 464 use_rewrite = cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers.nelts ? 1 : 0; |
458 use_access = cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers.nelts ? 1 : 0; | 465 use_access = cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers.nelts ? 1 : 0; |
459 | 466 |
460 n = 1 /* find config phase */ | 467 n = 1 /* find config phase */ |
461 + use_rewrite /* post rewrite phase */ | 468 + use_rewrite /* post rewrite phase */ |
462 + use_access /* post access phase */ | 469 + use_access; /* post access phase */ |
463 + cmcf->try_files; | |
464 | 470 |
465 for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) { | 471 for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) { |
466 n += cmcf->phases[i].handlers.nelts; | 472 n += cmcf->phases[i].handlers.nelts; |
467 } | 473 } |
468 | 474 |
522 | 528 |
523 case NGX_HTTP_POST_ACCESS_PHASE: | 529 case NGX_HTTP_POST_ACCESS_PHASE: |
524 if (use_access) { | 530 if (use_access) { |
525 ph->checker = ngx_http_core_post_access_phase; | 531 ph->checker = ngx_http_core_post_access_phase; |
526 ph->next = n; | 532 ph->next = n; |
527 ph++; | |
528 } | |
529 | |
530 continue; | |
531 | |
532 case NGX_HTTP_TRY_FILES_PHASE: | |
533 if (cmcf->try_files) { | |
534 ph->checker = ngx_http_core_try_files_phase; | |
535 n++; | |
536 ph++; | 533 ph++; |
537 } | 534 } |
538 | 535 |
539 continue; | 536 continue; |
540 | 537 |