comparison src/http/ngx_http_core_module.h @ 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 d2b2ff157da5
children 20f139e9ffa8
comparison
equal deleted inserted replaced
7070:f583559aadc7 7071:cce6936ed2f4
117 NGX_HTTP_PREACCESS_PHASE, 117 NGX_HTTP_PREACCESS_PHASE,
118 118
119 NGX_HTTP_ACCESS_PHASE, 119 NGX_HTTP_ACCESS_PHASE,
120 NGX_HTTP_POST_ACCESS_PHASE, 120 NGX_HTTP_POST_ACCESS_PHASE,
121 121
122 NGX_HTTP_TRY_FILES_PHASE, 122 NGX_HTTP_PRECONTENT_PHASE,
123
123 NGX_HTTP_CONTENT_PHASE, 124 NGX_HTTP_CONTENT_PHASE,
124 125
125 NGX_HTTP_LOG_PHASE 126 NGX_HTTP_LOG_PHASE
126 } ngx_http_phases; 127 } ngx_http_phases;
127 128
170 171
171 ngx_hash_keys_arrays_t *variables_keys; 172 ngx_hash_keys_arrays_t *variables_keys;
172 173
173 ngx_array_t *ports; 174 ngx_array_t *ports;
174 175
175 ngx_uint_t try_files; /* unsigned try_files:1 */
176
177 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1]; 176 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1];
178 } ngx_http_core_main_conf_t; 177 } ngx_http_core_main_conf_t;
179 178
180 179
181 typedef struct { 180 typedef struct {
292 ngx_int_t status; 291 ngx_int_t status;
293 ngx_int_t overwrite; 292 ngx_int_t overwrite;
294 ngx_http_complex_value_t value; 293 ngx_http_complex_value_t value;
295 ngx_str_t args; 294 ngx_str_t args;
296 } ngx_http_err_page_t; 295 } ngx_http_err_page_t;
297
298
299 typedef struct {
300 ngx_array_t *lengths;
301 ngx_array_t *values;
302 ngx_str_t name;
303
304 unsigned code:10;
305 unsigned test_dir:1;
306 } ngx_http_try_file_t;
307 296
308 297
309 struct ngx_http_core_loc_conf_s { 298 struct ngx_http_core_loc_conf_s {
310 ngx_str_t name; /* location name */ 299 ngx_str_t name; /* location name */
311 300
423 ngx_uint_t disable_symlinks; /* disable_symlinks */ 412 ngx_uint_t disable_symlinks; /* disable_symlinks */
424 ngx_http_complex_value_t *disable_symlinks_from; 413 ngx_http_complex_value_t *disable_symlinks_from;
425 #endif 414 #endif
426 415
427 ngx_array_t *error_pages; /* error_page */ 416 ngx_array_t *error_pages; /* error_page */
428 ngx_http_try_file_t *try_files; /* try_files */
429 417
430 ngx_path_t *client_body_temp_path; /* client_body_temp_path */ 418 ngx_path_t *client_body_temp_path; /* client_body_temp_path */
431 419
432 ngx_open_file_cache_t *open_file_cache; 420 ngx_open_file_cache_t *open_file_cache;
433 time_t open_file_cache_valid; 421 time_t open_file_cache_valid;
483 ngx_int_t ngx_http_core_post_rewrite_phase(ngx_http_request_t *r, 471 ngx_int_t ngx_http_core_post_rewrite_phase(ngx_http_request_t *r,
484 ngx_http_phase_handler_t *ph); 472 ngx_http_phase_handler_t *ph);
485 ngx_int_t ngx_http_core_access_phase(ngx_http_request_t *r, 473 ngx_int_t ngx_http_core_access_phase(ngx_http_request_t *r,
486 ngx_http_phase_handler_t *ph); 474 ngx_http_phase_handler_t *ph);
487 ngx_int_t ngx_http_core_post_access_phase(ngx_http_request_t *r, 475 ngx_int_t ngx_http_core_post_access_phase(ngx_http_request_t *r,
488 ngx_http_phase_handler_t *ph);
489 ngx_int_t ngx_http_core_try_files_phase(ngx_http_request_t *r,
490 ngx_http_phase_handler_t *ph); 476 ngx_http_phase_handler_t *ph);
491 ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r, 477 ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r,
492 ngx_http_phase_handler_t *ph); 478 ngx_http_phase_handler_t *ph);
493 479
494 480