comparison src/http/ngx_http_core_module.h @ 2027:f321b59ae0e9

locations tree
author Igor Sysoev <igor@sysoev.ru>
date Sat, 24 May 2008 14:14:13 +0000
parents 7018254cc006
children bff8689c6953
comparison
equal deleted inserted replaced
2026:72db8932f782 2027:f321b59ae0e9
26 26
27 #define NGX_HTTP_SATISFY_ALL 0 27 #define NGX_HTTP_SATISFY_ALL 0
28 #define NGX_HTTP_SATISFY_ANY 1 28 #define NGX_HTTP_SATISFY_ANY 1
29 29
30 30
31 typedef struct ngx_http_location_tree_node_s ngx_http_location_tree_node_t;
32 typedef struct ngx_http_core_loc_conf_s ngx_http_core_loc_conf_t;
33
34
31 typedef struct { 35 typedef struct {
32 unsigned default_server:1; 36 unsigned default_server:1;
33 unsigned bind:1; 37 unsigned bind:1;
34 38
35 int backlog; 39 int backlog;
125 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1]; 129 ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1];
126 } ngx_http_core_main_conf_t; 130 } ngx_http_core_main_conf_t;
127 131
128 132
129 typedef struct { 133 typedef struct {
130 /*
131 * array of the ngx_http_core_loc_conf_t *,
132 * used in the ngx_http_core_find_location() and in the merge phase
133 */
134 ngx_array_t locations;
135
136 unsigned regex_start:15;
137 unsigned named_start:15;
138
139 /* array of the ngx_http_listen_t, "listen" directive */ 134 /* array of the ngx_http_listen_t, "listen" directive */
140 ngx_array_t listen; 135 ngx_array_t listen;
141 136
142 /* array of the ngx_http_server_name_t, "server_name" directive */ 137 /* array of the ngx_http_server_name_t, "server_name" directive */
143 ngx_array_t server_names; 138 ngx_array_t server_names;
144 139
145 /* server ctx */ 140 /* server ctx */
146 ngx_http_conf_ctx_t *ctx; 141 ngx_http_conf_ctx_t *ctx;
147 142
148 ngx_str_t server_name; 143 ngx_str_t server_name;
149 144
150 size_t connection_pool_size; 145 size_t connection_pool_size;
151 size_t request_pool_size; 146 size_t request_pool_size;
152 size_t client_header_buffer_size; 147 size_t client_header_buffer_size;
153 148
154 ngx_bufs_t large_client_header_buffers; 149 ngx_bufs_t large_client_header_buffers;
155 150
156 ngx_msec_t client_header_timeout; 151 ngx_msec_t client_header_timeout;
157 152
158 ngx_flag_t optimize_server_names; 153 ngx_flag_t optimize_server_names;
159 ngx_flag_t ignore_invalid_headers; 154 ngx_flag_t ignore_invalid_headers;
160 ngx_flag_t merge_slashes; 155 ngx_flag_t merge_slashes;
156
157 ngx_http_core_loc_conf_t **named_locations;
161 } ngx_http_core_srv_conf_t; 158 } ngx_http_core_srv_conf_t;
162 159
163 160
164 /* list of structures to find core_srv_conf quickly at run time */ 161 /* list of structures to find core_srv_conf quickly at run time */
165 162
229 ngx_array_t *uri_lengths; 226 ngx_array_t *uri_lengths;
230 ngx_array_t *uri_values; 227 ngx_array_t *uri_values;
231 } ngx_http_err_page_t; 228 } ngx_http_err_page_t;
232 229
233 230
234 typedef struct ngx_http_core_loc_conf_s ngx_http_core_loc_conf_t;
235
236 struct ngx_http_core_loc_conf_s { 231 struct ngx_http_core_loc_conf_s {
237 ngx_str_t name; /* location name */ 232 ngx_str_t name; /* location name */
238 233
239 #if (NGX_PCRE) 234 #if (NGX_PCRE)
240 ngx_regex_t *regex; 235 ngx_regex_t *regex;
241 #endif 236 #endif
242 237
243 unsigned regex_start:15;
244
245 unsigned noname:1; /* "if () {}" block or limit_except */ 238 unsigned noname:1; /* "if () {}" block or limit_except */
246 unsigned named:1; 239 unsigned named:1;
247 240
248 unsigned exact_match:1; 241 unsigned exact_match:1;
249 unsigned noregex:1; 242 unsigned noregex:1;
250 243
251 unsigned auto_redirect:1; 244 unsigned auto_redirect:1;
252 unsigned alias:1; 245 unsigned alias:1;
253 246
254 /* array of inclusive ngx_http_core_loc_conf_t */ 247 ngx_queue_t *locations;
255 ngx_array_t *locations; 248
249 ngx_http_location_tree_node_t *static_locations;
250 ngx_http_core_loc_conf_t **regex_locations;
256 251
257 /* pointer to the modules' loc_conf */ 252 /* pointer to the modules' loc_conf */
258 void **loc_conf; 253 void **loc_conf;
259 254
260 uint32_t limit_except; 255 uint32_t limit_except;
334 ngx_uint_t types_hash_bucket_size; 329 ngx_uint_t types_hash_bucket_size;
335 330
336 #if 0 331 #if 0
337 ngx_http_core_loc_conf_t *prev_location; 332 ngx_http_core_loc_conf_t *prev_location;
338 #endif 333 #endif
334 };
335
336
337 typedef struct {
338 ngx_queue_t queue;
339 ngx_http_core_loc_conf_t *exact;
340 ngx_http_core_loc_conf_t *inclusive;
341 ngx_str_t *name;
342 u_char *file_name;
343 ngx_uint_t line;
344 ngx_queue_t list;
345 } ngx_http_location_queue_t;
346
347
348 struct ngx_http_location_tree_node_s {
349 ngx_http_location_tree_node_t *left;
350 ngx_http_location_tree_node_t *right;
351 ngx_http_location_tree_node_t *tree;
352
353 ngx_http_core_loc_conf_t *exact;
354 ngx_http_core_loc_conf_t *inclusive;
355
356 u_char auto_redirect;
357 u_char len;
358 u_char name[1];
339 }; 359 };
340 360
341 361
342 void ngx_http_core_run_phases(ngx_http_request_t *r); 362 void ngx_http_core_run_phases(ngx_http_request_t *r);
343 ngx_int_t ngx_http_core_generic_phase(ngx_http_request_t *r, 363 ngx_int_t ngx_http_core_generic_phase(ngx_http_request_t *r,