comparison src/http/ngx_http_core_module.h @ 230:38e7b94d63ac NGINX_0_4_0

nginx 0.4.0 *) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; bug appeared in 0.1.29.
author Igor Sysoev <http://sysoev.ru>
date Wed, 30 Aug 2006 00:00:00 +0400
parents 9eebc1b2cdbb
children 500a3242dff6
comparison
equal deleted inserted replaced
229:1965c8e23be7 230:38e7b94d63ac
47 47
48 typedef enum { 48 typedef enum {
49 NGX_HTTP_POST_READ_PHASE = 0, 49 NGX_HTTP_POST_READ_PHASE = 0,
50 50
51 NGX_HTTP_SERVER_REWRITE_PHASE, 51 NGX_HTTP_SERVER_REWRITE_PHASE,
52
52 NGX_HTTP_FIND_CONFIG_PHASE, 53 NGX_HTTP_FIND_CONFIG_PHASE,
53 NGX_HTTP_REWRITE_PHASE, 54 NGX_HTTP_REWRITE_PHASE,
55 NGX_HTTP_POST_REWRITE_PHASE,
54 56
55 NGX_HTTP_PREACCESS_PHASE, 57 NGX_HTTP_PREACCESS_PHASE,
56 58
57 NGX_HTTP_ACCESS_PHASE, 59 NGX_HTTP_ACCESS_PHASE,
60 NGX_HTTP_POST_ACCESS_PHASE,
61
58 NGX_HTTP_CONTENT_PHASE, 62 NGX_HTTP_CONTENT_PHASE,
59 63
60 NGX_HTTP_LOG_PHASE 64 NGX_HTTP_LOG_PHASE
61 } ngx_http_phases; 65 } ngx_http_phases;
62 66
67 typedef struct ngx_http_phase_handler_s ngx_http_phase_handler_t;
68
69 typedef ngx_int_t (*ngx_http_phase_handler_pt)(ngx_http_request_t *r,
70 ngx_http_phase_handler_t *ph);
71
72 struct ngx_http_phase_handler_s {
73 ngx_http_phase_handler_pt checker;
74 ngx_http_handler_pt handler;
75 ngx_uint_t next;
76 };
77
78
79 typedef struct {
80 ngx_http_phase_handler_t *handlers;
81 ngx_uint_t server_rewrite_index;
82 } ngx_http_phase_engine_t;
83
63 84
64 typedef struct { 85 typedef struct {
65 ngx_array_t handlers; 86 ngx_array_t handlers;
66 ngx_int_t type; /* NGX_OK, NGX_DECLINED */
67 } ngx_http_phase_t; 87 } ngx_http_phase_t;
68 88
69 89
70 typedef struct { 90 typedef struct {
71 ngx_array_t servers; /* ngx_http_core_srv_conf_t */ 91 ngx_array_t servers; /* ngx_http_core_srv_conf_t */
72 92
73 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1]; 93 ngx_http_phase_engine_t phase_engine;
74 94
75 ngx_hash_t headers_in_hash; 95 ngx_hash_t headers_in_hash;
76 96
77 ngx_hash_t variables_hash; 97 ngx_hash_t variables_hash;
78 98
83 103
84 ngx_uint_t variables_hash_max_size; 104 ngx_uint_t variables_hash_max_size;
85 ngx_uint_t variables_hash_bucket_size; 105 ngx_uint_t variables_hash_bucket_size;
86 106
87 ngx_hash_keys_arrays_t *variables_keys; 107 ngx_hash_keys_arrays_t *variables_keys;
108
109 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1];
88 } ngx_http_core_main_conf_t; 110 } ngx_http_core_main_conf_t;
89 111
90 112
91 typedef struct { 113 typedef struct {
92 /* 114 /*
260 ngx_http_core_loc_conf_t *prev_location; 282 ngx_http_core_loc_conf_t *prev_location;
261 #endif 283 #endif
262 }; 284 };
263 285
264 286
265 ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r); 287 void ngx_http_core_run_phases(ngx_http_request_t *r);
288 ngx_int_t ngx_http_core_generic_phase(ngx_http_request_t *r,
289 ngx_http_phase_handler_t *ph);
290 ngx_int_t ngx_http_core_find_config_phase(ngx_http_request_t *r,
291 ngx_http_phase_handler_t *ph);
292 ngx_int_t ngx_http_core_post_rewrite_phase(ngx_http_request_t *r,
293 ngx_http_phase_handler_t *ph);
294 ngx_int_t ngx_http_core_access_phase(ngx_http_request_t *r,
295 ngx_http_phase_handler_t *ph);
296 ngx_int_t ngx_http_core_post_access_phase(ngx_http_request_t *r,
297 ngx_http_phase_handler_t *ph);
298 ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r,
299 ngx_http_phase_handler_t *ph);
266 300
267 ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r); 301 ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
268 ngx_int_t ngx_http_set_exten(ngx_http_request_t *r); 302 ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
269 u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name, 303 u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name,
270 size_t reserved); 304 size_t reserved);