Mercurial > hg > nginx
annotate src/http/ngx_http_core_module.c @ 2565:456e453eb84a
fix reserved mapped uri length if alias has captures
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 14 Mar 2009 19:20:34 +0000 |
parents | 47839f59ce2a |
children | 5e7d590cd704 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
5 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
8 #include <ngx_core.h> |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
9 #include <ngx_http.h> |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
10 |
461 | 11 |
631 | 12 typedef struct { |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
13 u_char *name; |
631 | 14 uint32_t method; |
15 } ngx_http_method_name_t; | |
16 | |
17 | |
1073 | 18 #define NGX_HTTP_REQUEST_BODY_FILE_OFF 0 |
19 #define NGX_HTTP_REQUEST_BODY_FILE_ON 1 | |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
20 #define NGX_HTTP_REQUEST_BODY_FILE_CLEAN 2 |
1073 | 21 |
22 | |
2027 | 23 static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r); |
24 static ngx_int_t ngx_http_core_find_static_location(ngx_http_request_t *r, | |
25 ngx_http_location_tree_node_t *node); | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
26 |
509 | 27 static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf); |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
28 static void *ngx_http_core_create_main_conf(ngx_conf_t *cf); |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
29 static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf); |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
30 static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf); |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
31 static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf, |
487 | 32 void *parent, void *child); |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
33 static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf); |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
34 static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf, |
487 | 35 void *parent, void *child); |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
36 |
485 | 37 static char *ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 38 void *dummy); |
485 | 39 static char *ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 40 void *dummy); |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
41 static ngx_int_t ngx_http_core_regex_location(ngx_conf_t *cf, |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
42 ngx_http_core_loc_conf_t *clcf, ngx_str_t *regex, ngx_uint_t caseless); |
485 | 43 |
44 static char *ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd, | |
487 | 45 void *conf); |
485 | 46 static char *ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, |
487 | 47 void *conf); |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 |
485 | 49 static char *ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 50 void *conf); |
485 | 51 static char *ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 52 void *conf); |
485 | 53 static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
631 | 54 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, |
55 void *conf); | |
2129 | 56 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, |
57 void *conf); | |
485 | 58 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 59 void *conf); |
2407 | 60 static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, |
61 void *conf); | |
1454 | 62 static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, |
63 void *conf); | |
485 | 64 static char *ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 65 void *conf); |
485 | 66 static char *ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 67 void *conf); |
509 | 68 static char *ngx_http_core_internal(ngx_conf_t *cf, ngx_command_t *cmd, |
69 void *conf); | |
1674 | 70 static char *ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
71 void *conf); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
72 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
73 static char *ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
74 void *conf); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
75 #endif |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
76 |
485 | 77 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data); |
1200 | 78 static char *ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data); |
485 | 79 |
80 static ngx_conf_post_t ngx_http_core_lowat_post = | |
1199 | 81 { ngx_http_core_lowat_check }; |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
82 |
1200 | 83 static ngx_conf_post_handler_pt ngx_http_core_pool_size_p = |
84 ngx_http_core_pool_size; | |
85 | |
2029
c036922f6f07
*) remove optimize_host_names
Igor Sysoev <igor@sysoev.ru>
parents:
2027
diff
changeset
|
86 static ngx_conf_deprecated_t ngx_conf_deprecated_optimize_server_names = { |
c036922f6f07
*) remove optimize_host_names
Igor Sysoev <igor@sysoev.ru>
parents:
2027
diff
changeset
|
87 ngx_conf_deprecated, "optimize_server_names", "server_name_in_redirect" |
609 | 88 }; |
89 | |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
90 static ngx_conf_deprecated_t ngx_conf_deprecated_open_file_cache_retest = { |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
91 ngx_conf_deprecated, "open_file_cache_retest", "open_file_cache_valid" |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
92 }; |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
93 |
1806 | 94 static ngx_conf_deprecated_t ngx_conf_deprecated_satisfy_any = { |
95 ngx_conf_deprecated, "satisfy_any", "satisfy" | |
96 }; | |
97 | |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
98 |
1073 | 99 static ngx_conf_enum_t ngx_http_core_request_body_in_file[] = { |
100 { ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF }, | |
101 { ngx_string("on"), NGX_HTTP_REQUEST_BODY_FILE_ON }, | |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
102 { ngx_string("clean"), NGX_HTTP_REQUEST_BODY_FILE_CLEAN }, |
1073 | 103 { ngx_null_string, 0 } |
104 }; | |
105 | |
106 | |
1806 | 107 static ngx_conf_enum_t ngx_http_core_satisfy[] = { |
108 { ngx_string("all"), NGX_HTTP_SATISFY_ALL }, | |
109 { ngx_string("any"), NGX_HTTP_SATISFY_ANY }, | |
110 { ngx_null_string, 0 } | |
111 }; | |
112 | |
113 | |
2361 | 114 static ngx_conf_enum_t ngx_http_core_if_modified_since[] = { |
2496 | 115 { ngx_string("off"), NGX_HTTP_IMS_OFF }, |
116 { ngx_string("exact"), NGX_HTTP_IMS_EXACT }, | |
117 { ngx_string("before"), NGX_HTTP_IMS_BEFORE }, | |
2361 | 118 { ngx_null_string, 0 } |
119 }; | |
120 | |
121 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
122 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
123 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
124 static ngx_conf_enum_t ngx_http_gzip_http_version[] = { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
125 { ngx_string("1.0"), NGX_HTTP_VERSION_10 }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
126 { ngx_string("1.1"), NGX_HTTP_VERSION_11 }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
127 { ngx_null_string, 0 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
128 }; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
129 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
130 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
131 static ngx_conf_bitmask_t ngx_http_gzip_proxied_mask[] = { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
132 { ngx_string("off"), NGX_HTTP_GZIP_PROXIED_OFF }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
133 { ngx_string("expired"), NGX_HTTP_GZIP_PROXIED_EXPIRED }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
134 { ngx_string("no-cache"), NGX_HTTP_GZIP_PROXIED_NO_CACHE }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
135 { ngx_string("no-store"), NGX_HTTP_GZIP_PROXIED_NO_STORE }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
136 { ngx_string("private"), NGX_HTTP_GZIP_PROXIED_PRIVATE }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
137 { ngx_string("no_last_modified"), NGX_HTTP_GZIP_PROXIED_NO_LM }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
138 { ngx_string("no_etag"), NGX_HTTP_GZIP_PROXIED_NO_ETAG }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
139 { ngx_string("auth"), NGX_HTTP_GZIP_PROXIED_AUTH }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
140 { ngx_string("any"), NGX_HTTP_GZIP_PROXIED_ANY }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
141 { ngx_null_string, 0 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
142 }; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
143 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
144 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
145 static ngx_str_t ngx_http_gzip_no_cache = ngx_string("no-cache"); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
146 static ngx_str_t ngx_http_gzip_no_store = ngx_string("no-store"); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
147 static ngx_str_t ngx_http_gzip_private = ngx_string("private"); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
148 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
149 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
150 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
151 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
152 static ngx_command_t ngx_http_core_commands[] = { |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
153 |
611 | 154 { ngx_string("variables_hash_max_size"), |
155 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
156 ngx_conf_set_num_slot, | |
157 NGX_HTTP_MAIN_CONF_OFFSET, | |
158 offsetof(ngx_http_core_main_conf_t, variables_hash_max_size), | |
159 NULL }, | |
160 | |
161 { ngx_string("variables_hash_bucket_size"), | |
162 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
163 ngx_conf_set_num_slot, | |
164 NGX_HTTP_MAIN_CONF_OFFSET, | |
165 offsetof(ngx_http_core_main_conf_t, variables_hash_bucket_size), | |
166 NULL }, | |
167 | |
593 | 168 { ngx_string("server_names_hash_max_size"), |
477 | 169 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
170 ngx_conf_set_num_slot, | |
171 NGX_HTTP_MAIN_CONF_OFFSET, | |
593 | 172 offsetof(ngx_http_core_main_conf_t, server_names_hash_max_size), |
477 | 173 NULL }, |
174 | |
593 | 175 { ngx_string("server_names_hash_bucket_size"), |
477 | 176 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
177 ngx_conf_set_num_slot, | |
178 NGX_HTTP_MAIN_CONF_OFFSET, | |
593 | 179 offsetof(ngx_http_core_main_conf_t, server_names_hash_bucket_size), |
477 | 180 NULL }, |
181 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
182 { ngx_string("server"), |
651 | 183 NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_MULTI|NGX_CONF_NOARGS, |
485 | 184 ngx_http_core_server, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
185 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
186 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
187 NULL }, |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
188 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
189 { ngx_string("connection_pool_size"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
190 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
191 ngx_conf_set_size_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
192 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
193 offsetof(ngx_http_core_srv_conf_t, connection_pool_size), |
1200 | 194 &ngx_http_core_pool_size_p }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
195 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
196 { ngx_string("request_pool_size"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
197 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
198 ngx_conf_set_size_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
199 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
200 offsetof(ngx_http_core_srv_conf_t, request_pool_size), |
1200 | 201 &ngx_http_core_pool_size_p }, |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
202 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
203 { ngx_string("client_header_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
204 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
205 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
206 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
207 offsetof(ngx_http_core_srv_conf_t, client_header_timeout), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
208 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
209 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
210 { ngx_string("client_header_buffer_size"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
211 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
212 ngx_conf_set_size_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
213 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
214 offsetof(ngx_http_core_srv_conf_t, client_header_buffer_size), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
215 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
216 |
436
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
217 { ngx_string("large_client_header_buffers"), |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
218 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE2, |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
219 ngx_conf_set_bufs_slot, |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
220 NGX_HTTP_SRV_CONF_OFFSET, |
436
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
221 offsetof(ngx_http_core_srv_conf_t, large_client_header_buffers), |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
222 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
223 |
609 | 224 { ngx_string("optimize_server_names"), |
225 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
226 ngx_conf_set_flag_slot, | |
2029
c036922f6f07
*) remove optimize_host_names
Igor Sysoev <igor@sysoev.ru>
parents:
2027
diff
changeset
|
227 NGX_HTTP_LOC_CONF_OFFSET, |
c036922f6f07
*) remove optimize_host_names
Igor Sysoev <igor@sysoev.ru>
parents:
2027
diff
changeset
|
228 offsetof(ngx_http_core_loc_conf_t, server_name_in_redirect), |
c036922f6f07
*) remove optimize_host_names
Igor Sysoev <igor@sysoev.ru>
parents:
2027
diff
changeset
|
229 &ngx_conf_deprecated_optimize_server_names }, |
603 | 230 |
511 | 231 { ngx_string("ignore_invalid_headers"), |
232 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
233 ngx_conf_set_flag_slot, | |
234 NGX_HTTP_SRV_CONF_OFFSET, | |
235 offsetof(ngx_http_core_srv_conf_t, ignore_invalid_headers), | |
236 NULL }, | |
237 | |
1585 | 238 { ngx_string("merge_slashes"), |
239 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
240 ngx_conf_set_flag_slot, | |
241 NGX_HTTP_SRV_CONF_OFFSET, | |
242 offsetof(ngx_http_core_srv_conf_t, merge_slashes), | |
243 NULL }, | |
244 | |
2256 | 245 { ngx_string("underscores_in_headers"), |
246 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
247 ngx_conf_set_flag_slot, | |
248 NGX_HTTP_SRV_CONF_OFFSET, | |
249 offsetof(ngx_http_core_srv_conf_t, underscores_in_headers), | |
250 NULL }, | |
251 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
252 { ngx_string("location"), |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
253 NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE12, |
485 | 254 ngx_http_core_location, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
255 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
256 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
257 NULL }, |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
258 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
259 { ngx_string("listen"), |
523 | 260 NGX_HTTP_SRV_CONF|NGX_CONF_1MORE, |
485 | 261 ngx_http_core_listen, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
262 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
263 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
264 NULL }, |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
265 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
266 { ngx_string("server_name"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
267 NGX_HTTP_SRV_CONF|NGX_CONF_1MORE, |
485 | 268 ngx_http_core_server_name, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
269 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
270 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
271 NULL }, |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
272 |
589 | 273 { ngx_string("types_hash_max_size"), |
274 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
275 ngx_conf_set_num_slot, | |
276 NGX_HTTP_LOC_CONF_OFFSET, | |
277 offsetof(ngx_http_core_loc_conf_t, types_hash_max_size), | |
278 NULL }, | |
279 | |
280 { ngx_string("types_hash_bucket_size"), | |
281 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
282 ngx_conf_set_num_slot, | |
283 NGX_HTTP_LOC_CONF_OFFSET, | |
284 offsetof(ngx_http_core_loc_conf_t, types_hash_bucket_size), | |
285 NULL }, | |
286 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
287 { ngx_string("types"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
288 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
289 |NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
485 | 290 ngx_http_core_types, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
291 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
292 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
293 NULL }, |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
294 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
295 { ngx_string("default_type"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
296 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
297 ngx_conf_set_str_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
298 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
299 offsetof(ngx_http_core_loc_conf_t, default_type), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
300 NULL }, |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
301 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
302 { ngx_string("root"), |
509 | 303 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
304 |NGX_CONF_TAKE1, | |
485 | 305 ngx_http_core_root, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
306 NGX_HTTP_LOC_CONF_OFFSET, |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
307 0, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
308 NULL }, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
309 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
310 { ngx_string("alias"), |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
311 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
485 | 312 ngx_http_core_root, |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
313 NGX_HTTP_LOC_CONF_OFFSET, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
314 0, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
315 NULL }, |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
316 |
631 | 317 { ngx_string("limit_except"), |
318 NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_1MORE, | |
319 ngx_http_core_limit_except, | |
320 NGX_HTTP_LOC_CONF_OFFSET, | |
321 0, | |
322 NULL }, | |
323 | |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
324 { ngx_string("client_max_body_size"), |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
325 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
663 | 326 ngx_conf_set_off_slot, |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
327 NGX_HTTP_LOC_CONF_OFFSET, |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
328 offsetof(ngx_http_core_loc_conf_t, client_max_body_size), |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
329 NULL }, |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
330 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
331 { ngx_string("client_body_buffer_size"), |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
332 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
333 ngx_conf_set_size_slot, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
334 NGX_HTTP_LOC_CONF_OFFSET, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
335 offsetof(ngx_http_core_loc_conf_t, client_body_buffer_size), |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
336 NULL }, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
337 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
338 { ngx_string("client_body_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
339 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
340 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
341 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
342 offsetof(ngx_http_core_loc_conf_t, client_body_timeout), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
343 NULL }, |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
160
diff
changeset
|
344 |
479 | 345 { ngx_string("client_body_temp_path"), |
346 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, | |
347 ngx_conf_set_path_slot, | |
348 NGX_HTTP_LOC_CONF_OFFSET, | |
349 offsetof(ngx_http_core_loc_conf_t, client_body_temp_path), | |
350 (void *) ngx_garbage_collector_temp_handler }, | |
351 | |
633 | 352 { ngx_string("client_body_in_file_only"), |
353 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
1073 | 354 ngx_conf_set_enum_slot, |
633 | 355 NGX_HTTP_LOC_CONF_OFFSET, |
356 offsetof(ngx_http_core_loc_conf_t, client_body_in_file_only), | |
1073 | 357 &ngx_http_core_request_body_in_file }, |
633 | 358 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
359 { ngx_string("sendfile"), |
1070
b54a1e283d6d
allow "sendfile" in "if" context
Igor Sysoev <igor@sysoev.ru>
parents:
1028
diff
changeset
|
360 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
b54a1e283d6d
allow "sendfile" in "if" context
Igor Sysoev <igor@sysoev.ru>
parents:
1028
diff
changeset
|
361 |NGX_CONF_TAKE1, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
362 ngx_conf_set_flag_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
363 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
364 offsetof(ngx_http_core_loc_conf_t, sendfile), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
365 NULL }, |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
366 |
1197 | 367 { ngx_string("sendfile_max_chunk"), |
368 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
369 ngx_conf_set_size_slot, | |
370 NGX_HTTP_LOC_CONF_OFFSET, | |
371 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), | |
372 NULL }, | |
373 | |
2129 | 374 { ngx_string("directio"), |
375 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
376 ngx_http_core_directio, | |
377 NGX_HTTP_LOC_CONF_OFFSET, | |
378 0, | |
379 NULL }, | |
380 | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
381 { ngx_string("tcp_nopush"), |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
382 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
383 ngx_conf_set_flag_slot, |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
384 NGX_HTTP_LOC_CONF_OFFSET, |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
385 offsetof(ngx_http_core_loc_conf_t, tcp_nopush), |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
386 NULL }, |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
387 |
452 | 388 { ngx_string("tcp_nodelay"), |
389 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
390 ngx_conf_set_flag_slot, | |
391 NGX_HTTP_LOC_CONF_OFFSET, | |
392 offsetof(ngx_http_core_loc_conf_t, tcp_nodelay), | |
393 NULL }, | |
394 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
395 { ngx_string("send_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
396 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
397 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
398 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
399 offsetof(ngx_http_core_loc_conf_t, send_timeout), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
400 NULL }, |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
401 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
402 { ngx_string("send_lowat"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
403 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
404 ngx_conf_set_size_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
405 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
406 offsetof(ngx_http_core_loc_conf_t, send_lowat), |
485 | 407 &ngx_http_core_lowat_post }, |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
408 |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
409 { ngx_string("postpone_output"), |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
410 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
411 ngx_conf_set_size_slot, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
412 NGX_HTTP_LOC_CONF_OFFSET, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
413 offsetof(ngx_http_core_loc_conf_t, postpone_output), |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
414 NULL }, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
415 |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
416 { ngx_string("limit_rate"), |
485 | 417 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
418 |NGX_CONF_TAKE1, | |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
419 ngx_conf_set_size_slot, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
420 NGX_HTTP_LOC_CONF_OFFSET, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
421 offsetof(ngx_http_core_loc_conf_t, limit_rate), |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
422 NULL }, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
423 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
424 { ngx_string("keepalive_timeout"), |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
425 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
485 | 426 ngx_http_core_keepalive, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
427 NGX_HTTP_LOC_CONF_OFFSET, |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
428 0, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
429 NULL }, |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
430 |
1806 | 431 { ngx_string("satisfy"), |
432 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
433 ngx_conf_set_enum_slot, | |
434 NGX_HTTP_LOC_CONF_OFFSET, | |
435 offsetof(ngx_http_core_loc_conf_t, satisfy), | |
436 &ngx_http_core_satisfy }, | |
437 | |
543 | 438 { ngx_string("satisfy_any"), |
439 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
440 ngx_conf_set_flag_slot, | |
441 NGX_HTTP_LOC_CONF_OFFSET, | |
1806 | 442 offsetof(ngx_http_core_loc_conf_t, satisfy), |
443 &ngx_conf_deprecated_satisfy_any }, | |
543 | 444 |
509 | 445 { ngx_string("internal"), |
446 NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS, | |
447 ngx_http_core_internal, | |
448 NGX_HTTP_LOC_CONF_OFFSET, | |
449 0, | |
450 NULL }, | |
451 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
452 { ngx_string("lingering_time"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
453 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
454 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
455 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
456 offsetof(ngx_http_core_loc_conf_t, lingering_time), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
457 NULL }, |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
458 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
459 { ngx_string("lingering_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
460 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
461 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
462 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
463 offsetof(ngx_http_core_loc_conf_t, lingering_timeout), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
464 NULL }, |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
465 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
466 { ngx_string("reset_timedout_connection"), |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
467 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
468 ngx_conf_set_flag_slot, |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
469 NGX_HTTP_LOC_CONF_OFFSET, |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
470 offsetof(ngx_http_core_loc_conf_t, reset_timedout_connection), |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
471 NULL }, |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
472 |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
473 { ngx_string("server_name_in_redirect"), |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
474 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
475 ngx_conf_set_flag_slot, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
476 NGX_HTTP_LOC_CONF_OFFSET, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
477 offsetof(ngx_http_core_loc_conf_t, server_name_in_redirect), |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
478 NULL }, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
479 |
521 | 480 { ngx_string("port_in_redirect"), |
481 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
482 ngx_conf_set_flag_slot, | |
483 NGX_HTTP_LOC_CONF_OFFSET, | |
484 offsetof(ngx_http_core_loc_conf_t, port_in_redirect), | |
485 NULL }, | |
486 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
487 { ngx_string("msie_padding"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
488 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
489 ngx_conf_set_flag_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
490 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
491 offsetof(ngx_http_core_loc_conf_t, msie_padding), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
492 NULL }, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
493 |
679 | 494 { ngx_string("msie_refresh"), |
495 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
496 ngx_conf_set_flag_slot, | |
497 NGX_HTTP_LOC_CONF_OFFSET, | |
498 offsetof(ngx_http_core_loc_conf_t, msie_refresh), | |
499 NULL }, | |
500 | |
527 | 501 { ngx_string("log_not_found"), |
502 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
503 ngx_conf_set_flag_slot, | |
504 NGX_HTTP_LOC_CONF_OFFSET, | |
505 offsetof(ngx_http_core_loc_conf_t, log_not_found), | |
506 NULL }, | |
507 | |
2261 | 508 { ngx_string("log_subrequest"), |
509 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
510 ngx_conf_set_flag_slot, | |
511 NGX_HTTP_LOC_CONF_OFFSET, | |
512 offsetof(ngx_http_core_loc_conf_t, log_subrequest), | |
513 NULL }, | |
514 | |
679 | 515 { ngx_string("recursive_error_pages"), |
516 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
517 ngx_conf_set_flag_slot, | |
518 NGX_HTTP_LOC_CONF_OFFSET, | |
519 offsetof(ngx_http_core_loc_conf_t, recursive_error_pages), | |
520 NULL }, | |
521 | |
1592 | 522 { ngx_string("server_tokens"), |
523 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
524 ngx_conf_set_flag_slot, | |
525 NGX_HTTP_LOC_CONF_OFFSET, | |
526 offsetof(ngx_http_core_loc_conf_t, server_tokens), | |
527 NULL }, | |
528 | |
2361 | 529 { ngx_string("if_modified_since"), |
530 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
531 ngx_conf_set_enum_slot, | |
532 NGX_HTTP_LOC_CONF_OFFSET, | |
533 offsetof(ngx_http_core_loc_conf_t, if_modified_since), | |
534 &ngx_http_core_if_modified_since }, | |
535 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
536 { ngx_string("error_page"), |
509 | 537 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
538 |NGX_CONF_2MORE, | |
485 | 539 ngx_http_core_error_page, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
540 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
541 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
542 NULL }, |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
543 |
2407 | 544 { ngx_string("try_files"), |
545 NGX_HTTP_LOC_CONF|NGX_CONF_2MORE, | |
546 ngx_http_core_try_files, | |
547 NGX_HTTP_LOC_CONF_OFFSET, | |
548 0, | |
549 NULL }, | |
550 | |
577 | 551 { ngx_string("post_action"), |
552 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF | |
553 |NGX_CONF_TAKE1, | |
554 ngx_conf_set_str_slot, | |
555 NGX_HTTP_LOC_CONF_OFFSET, | |
556 offsetof(ngx_http_core_loc_conf_t, post_action), | |
557 NULL }, | |
558 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
559 { ngx_string("error_log"), |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
560 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
485 | 561 ngx_http_core_error_log, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
562 NGX_HTTP_LOC_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
563 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
564 NULL }, |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
565 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
566 { ngx_string("open_file_cache"), |
1454 | 567 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
568 ngx_http_core_open_file_cache, | |
569 NGX_HTTP_LOC_CONF_OFFSET, | |
570 offsetof(ngx_http_core_loc_conf_t, open_file_cache), | |
571 NULL }, | |
572 | |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
573 { ngx_string("open_file_cache_valid"), |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
574 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
575 ngx_conf_set_sec_slot, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
576 NGX_HTTP_LOC_CONF_OFFSET, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
577 offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid), |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
578 NULL }, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
579 |
1454 | 580 { ngx_string("open_file_cache_retest"), |
581 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
582 ngx_conf_set_sec_slot, | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
583 NGX_HTTP_LOC_CONF_OFFSET, |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
584 offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid), |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
585 &ngx_conf_deprecated_open_file_cache_retest }, |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
586 |
1772 | 587 { ngx_string("open_file_cache_min_uses"), |
588 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
589 ngx_conf_set_num_slot, | |
590 NGX_HTTP_LOC_CONF_OFFSET, | |
591 offsetof(ngx_http_core_loc_conf_t, open_file_cache_min_uses), | |
592 NULL }, | |
593 | |
1454 | 594 { ngx_string("open_file_cache_errors"), |
595 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
596 ngx_conf_set_flag_slot, | |
597 NGX_HTTP_LOC_CONF_OFFSET, | |
598 offsetof(ngx_http_core_loc_conf_t, open_file_cache_errors), | |
599 NULL }, | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
600 |
1457 | 601 { ngx_string("open_file_cache_events"), |
602 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
603 ngx_conf_set_flag_slot, | |
604 NGX_HTTP_LOC_CONF_OFFSET, | |
605 offsetof(ngx_http_core_loc_conf_t, open_file_cache_events), | |
606 NULL }, | |
607 | |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
608 { ngx_string("resolver"), |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
609 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
610 ngx_http_core_resolver, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
611 NGX_HTTP_LOC_CONF_OFFSET, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
612 0, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
613 NULL }, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
614 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
615 { ngx_string("resolver_timeout"), |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
616 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
617 ngx_conf_set_msec_slot, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
618 NGX_HTTP_LOC_CONF_OFFSET, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
619 offsetof(ngx_http_core_loc_conf_t, resolver_timeout), |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
620 NULL }, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
621 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
622 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
623 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
624 { ngx_string("gzip_vary"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
625 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
626 ngx_conf_set_flag_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
627 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
628 offsetof(ngx_http_core_loc_conf_t, gzip_vary), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
629 NULL }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
630 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
631 { ngx_string("gzip_http_version"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
632 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
633 ngx_conf_set_enum_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
634 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
635 offsetof(ngx_http_core_loc_conf_t, gzip_http_version), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
636 &ngx_http_gzip_http_version }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
637 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
638 { ngx_string("gzip_proxied"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
639 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
640 ngx_conf_set_bitmask_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
641 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
642 offsetof(ngx_http_core_loc_conf_t, gzip_proxied), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
643 &ngx_http_gzip_proxied_mask }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
644 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
645 { ngx_string("gzip_disable"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
646 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
647 ngx_http_gzip_disable, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
648 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
649 0, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
650 NULL }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
651 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
652 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
653 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
654 ngx_null_command |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
655 }; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
656 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
657 |
667 | 658 static ngx_http_module_t ngx_http_core_module_ctx = { |
509 | 659 ngx_http_core_preconfiguration, /* preconfiguration */ |
573 | 660 NULL, /* postconfiguration */ |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
661 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
662 ngx_http_core_create_main_conf, /* create main configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
663 ngx_http_core_init_main_conf, /* init main configuration */ |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
664 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
665 ngx_http_core_create_srv_conf, /* create server configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
666 ngx_http_core_merge_srv_conf, /* merge server configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
667 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
668 ngx_http_core_create_loc_conf, /* create location configuration */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
669 ngx_http_core_merge_loc_conf /* merge location configuration */ |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
670 }; |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
671 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
672 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
673 ngx_module_t ngx_http_core_module = { |
509 | 674 NGX_MODULE_V1, |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
675 &ngx_http_core_module_ctx, /* module context */ |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
676 ngx_http_core_commands, /* module directives */ |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
677 NGX_HTTP_MODULE, /* module type */ |
541 | 678 NULL, /* init master */ |
509 | 679 NULL, /* init module */ |
541 | 680 NULL, /* init process */ |
681 NULL, /* init thread */ | |
682 NULL, /* exit thread */ | |
683 NULL, /* exit process */ | |
684 NULL, /* exit master */ | |
685 NGX_MODULE_V1_PADDING | |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
686 }; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
687 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
688 |
1882 | 689 static ngx_str_t ngx_http_core_get_method = { 3, (u_char *) "GET " }; |
690 | |
691 | |
487 | 692 void |
693 ngx_http_handler(ngx_http_request_t *r) | |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
694 { |
681 | 695 ngx_http_core_main_conf_t *cmcf; |
696 | |
483 | 697 r->connection->log->action = NULL; |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
698 |
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
699 r->connection->unexpected_eof = 0; |
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
700 |
675 | 701 if (!r->internal) { |
543 | 702 switch (r->headers_in.connection_type) { |
703 case 0: | |
704 if (r->http_version > NGX_HTTP_VERSION_10) { | |
705 r->keepalive = 1; | |
706 } else { | |
707 r->keepalive = 0; | |
708 } | |
709 break; | |
710 | |
711 case NGX_HTTP_CONNECTION_CLOSE: | |
712 r->keepalive = 0; | |
713 break; | |
714 | |
715 case NGX_HTTP_CONNECTION_KEEP_ALIVE: | |
153
c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
152
diff
changeset
|
716 r->keepalive = 1; |
543 | 717 break; |
718 } | |
719 | |
720 if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) { | |
721 | |
722 /* | |
681 | 723 * MSIE may wait for some time if an response for |
724 * a POST request was sent over a keepalive connection | |
543 | 725 */ |
726 | |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
727 r->keepalive = 0; |
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
728 } |
543 | 729 |
730 if (r->headers_in.content_length_n > 0) { | |
731 r->lingering_close = 1; | |
732 | |
733 } else { | |
734 r->lingering_close = 0; | |
735 } | |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
736 |
681 | 737 r->phase_handler = 0; |
738 | |
739 } else { | |
740 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | |
741 r->phase_handler = cmcf->phase_engine.server_rewrite_index; | |
742 } | |
743 | |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
744 if (r->unparsed_uri.len) { |
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
745 r->valid_unparsed_uri = 1; |
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
746 } |
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
747 |
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
748 r->valid_location = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
749 r->gzip = 0; |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
750 |
681 | 751 r->write_event_handler = ngx_http_core_run_phases; |
485 | 752 ngx_http_core_run_phases(r); |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
753 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
754 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
755 |
681 | 756 void |
487 | 757 ngx_http_core_run_phases(ngx_http_request_t *r) |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
758 { |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
759 ngx_int_t rc; |
681 | 760 ngx_http_phase_handler_t *ph; |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
761 ngx_http_core_main_conf_t *cmcf; |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
762 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
763 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
764 |
681 | 765 ph = cmcf->phase_engine.handlers; |
766 | |
767 while (ph[r->phase_handler].checker) { | |
768 | |
769 rc = ph[r->phase_handler].checker(r, &ph[r->phase_handler]); | |
770 | |
771 if (rc == NGX_OK) { | |
543 | 772 return; |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
773 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
774 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
775 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
776 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
777 |
487 | 778 ngx_int_t |
681 | 779 ngx_http_core_generic_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph) |
780 { | |
781 ngx_int_t rc; | |
782 | |
783 /* | |
784 * generic phase checker, | |
785 * used by the post read, server rewrite, rewrite, and pre-access phases | |
786 */ | |
787 | |
788 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
789 "generic phase: %ui", r->phase_handler); | |
790 | |
791 rc = ph->handler(r); | |
792 | |
793 if (rc == NGX_OK) { | |
794 r->phase_handler = ph->next; | |
795 return NGX_AGAIN; | |
796 } | |
797 | |
798 if (rc == NGX_DECLINED) { | |
799 r->phase_handler++; | |
800 return NGX_AGAIN; | |
801 } | |
802 | |
803 if (rc == NGX_AGAIN || rc == NGX_DONE) { | |
804 return NGX_OK; | |
805 } | |
806 | |
807 /* rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
808 | |
809 ngx_http_finalize_request(r, rc); | |
810 | |
811 return NGX_OK; | |
812 } | |
813 | |
814 | |
815 ngx_int_t | |
816 ngx_http_core_find_config_phase(ngx_http_request_t *r, | |
817 ngx_http_phase_handler_t *ph) | |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
818 { |
1403 | 819 u_char *p; |
820 size_t len; | |
2436
26d9d4a41e91
send "100 Continue" just before reading request body
Igor Sysoev <igor@sysoev.ru>
parents:
2435
diff
changeset
|
821 ngx_int_t rc; |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
822 ngx_http_core_loc_conf_t *clcf; |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
823 |
489 | 824 r->content_handler = NULL; |
825 r->uri_changed = 0; | |
826 | |
2027 | 827 rc = ngx_http_core_find_location(r); |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
828 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
829 if (rc == NGX_ERROR) { |
681 | 830 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
831 return NGX_OK; | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
832 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
833 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
834 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
835 |
509 | 836 if (!r->internal && clcf->internal) { |
681 | 837 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); |
838 return NGX_OK; | |
509 | 839 } |
840 | |
555 | 841 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
842 "using configuration \"%s%V\"", | |
843 (clcf->noname ? "*" : (clcf->exact_match ? "=" : "")), | |
844 &clcf->name); | |
845 | |
535 | 846 ngx_http_update_location_config(r); |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
847 |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
848 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
663 | 849 "http cl:%O max:%O", |
461 | 850 r->headers_in.content_length_n, clcf->client_max_body_size); |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
851 |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
852 if (r->headers_in.content_length_n != -1 |
673 | 853 && !r->discard_body |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
854 && clcf->client_max_body_size |
663 | 855 && clcf->client_max_body_size < r->headers_in.content_length_n) |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
856 { |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
857 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1586 | 858 "client intended to send too large body: %O bytes", |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
859 r->headers_in.content_length_n); |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
860 |
681 | 861 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); |
862 return NGX_OK; | |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
863 } |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
864 |
2027 | 865 if (rc == NGX_DONE) { |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
866 r->headers_out.location = ngx_list_push(&r->headers_out.headers); |
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
867 if (r->headers_out.location == NULL) { |
681 | 868 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
869 return NGX_OK; | |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
870 } |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
871 |
509 | 872 /* |
873 * we do not need to set the r->headers_out.location->hash and | |
874 * r->headers_out.location->key fields | |
875 */ | |
876 | |
1403 | 877 if (r->args.len == 0) { |
878 r->headers_out.location->value = clcf->name; | |
879 | |
880 } else { | |
881 len = clcf->name.len + 1 + r->args.len; | |
2049 | 882 p = ngx_pnalloc(r->pool, len); |
1403 | 883 |
884 if (p == NULL) { | |
885 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
886 return NGX_OK; | |
887 } | |
888 | |
889 r->headers_out.location->value.len = len; | |
890 r->headers_out.location->value.data = p; | |
891 | |
892 p = ngx_cpymem(p, clcf->name.data, clcf->name.len); | |
893 *p++ = '?'; | |
894 ngx_memcpy(p, r->args.data, r->args.len); | |
895 } | |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
896 |
681 | 897 ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY); |
898 return NGX_OK; | |
899 } | |
900 | |
901 r->phase_handler++; | |
902 return NGX_AGAIN; | |
903 } | |
904 | |
905 | |
906 ngx_int_t | |
907 ngx_http_core_post_rewrite_phase(ngx_http_request_t *r, | |
908 ngx_http_phase_handler_t *ph) | |
909 { | |
2043
1d86674d1286
after URI was rewritten location configuration should be to a server's null one
Igor Sysoev <igor@sysoev.ru>
parents:
2029
diff
changeset
|
910 ngx_http_core_srv_conf_t *cscf; |
1d86674d1286
after URI was rewritten location configuration should be to a server's null one
Igor Sysoev <igor@sysoev.ru>
parents:
2029
diff
changeset
|
911 |
681 | 912 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
913 "post rewrite phase: %ui", r->phase_handler); | |
914 | |
915 if (!r->uri_changed) { | |
916 r->phase_handler++; | |
917 return NGX_AGAIN; | |
918 } | |
919 | |
920 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
921 "uri changes: %d", r->uri_changes); | |
922 | |
923 /* | |
924 * gcc before 3.3 compiles the broken code for | |
925 * if (r->uri_changes-- == 0) | |
926 * if the r->uri_changes is defined as | |
927 * unsigned uri_changes:4 | |
928 */ | |
929 | |
930 r->uri_changes--; | |
931 | |
932 if (r->uri_changes == 0) { | |
933 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
934 "rewrite or internal redirection cycle " | |
935 "while processing \"%V\"", &r->uri); | |
936 | |
937 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
938 return NGX_OK; | |
939 } | |
940 | |
941 r->phase_handler = ph->next; | |
942 | |
2043
1d86674d1286
after URI was rewritten location configuration should be to a server's null one
Igor Sysoev <igor@sysoev.ru>
parents:
2029
diff
changeset
|
943 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
1d86674d1286
after URI was rewritten location configuration should be to a server's null one
Igor Sysoev <igor@sysoev.ru>
parents:
2029
diff
changeset
|
944 r->loc_conf = cscf->ctx->loc_conf; |
1d86674d1286
after URI was rewritten location configuration should be to a server's null one
Igor Sysoev <igor@sysoev.ru>
parents:
2029
diff
changeset
|
945 |
681 | 946 return NGX_AGAIN; |
947 } | |
948 | |
949 | |
950 ngx_int_t | |
951 ngx_http_core_access_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph) | |
952 { | |
953 ngx_int_t rc; | |
954 ngx_http_core_loc_conf_t *clcf; | |
955 | |
956 if (r != r->main) { | |
957 r->phase_handler = ph->next; | |
958 return NGX_AGAIN; | |
959 } | |
960 | |
961 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
962 "access phase: %ui", r->phase_handler); | |
963 | |
964 rc = ph->handler(r); | |
965 | |
966 if (rc == NGX_DECLINED) { | |
967 r->phase_handler++; | |
968 return NGX_AGAIN; | |
969 } | |
970 | |
971 if (rc == NGX_AGAIN || rc == NGX_DONE) { | |
972 return NGX_OK; | |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
973 } |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
974 |
681 | 975 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
976 | |
1806 | 977 if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) { |
681 | 978 |
979 if (rc == NGX_OK) { | |
980 r->phase_handler++; | |
981 return NGX_AGAIN; | |
982 } | |
983 | |
984 } else { | |
985 if (rc == NGX_OK) { | |
986 r->access_code = 0; | |
987 | |
988 if (r->headers_out.www_authenticate) { | |
989 r->headers_out.www_authenticate->hash = 0; | |
990 } | |
991 | |
992 r->phase_handler = ph->next; | |
993 return NGX_AGAIN; | |
994 } | |
995 | |
996 if (rc == NGX_HTTP_FORBIDDEN || rc == NGX_HTTP_UNAUTHORIZED) { | |
997 r->access_code = rc; | |
998 | |
999 r->phase_handler++; | |
1000 return NGX_AGAIN; | |
1001 } | |
1002 } | |
1003 | |
1004 /* rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
1005 | |
1006 ngx_http_finalize_request(r, rc); | |
1007 return NGX_OK; | |
1008 } | |
1009 | |
1010 | |
1011 ngx_int_t | |
1012 ngx_http_core_post_access_phase(ngx_http_request_t *r, | |
1013 ngx_http_phase_handler_t *ph) | |
1014 { | |
1015 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1016 "post access phase: %ui", r->phase_handler); | |
1017 | |
1018 if (r->access_code) { | |
1019 | |
1020 if (r->access_code == NGX_HTTP_FORBIDDEN) { | |
1021 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1022 "access forbidden by rule"); | |
1023 } | |
1024 | |
1025 ngx_http_finalize_request(r, r->access_code); | |
1026 return NGX_OK; | |
1027 } | |
1028 | |
1029 r->phase_handler++; | |
1030 return NGX_AGAIN; | |
1031 } | |
1032 | |
1033 | |
1034 ngx_int_t | |
2407 | 1035 ngx_http_core_try_files_phase(ngx_http_request_t *r, |
1036 ngx_http_phase_handler_t *ph) | |
1037 { | |
2481 | 1038 size_t len, root, alias, reserve, allocated; |
2407 | 1039 u_char *p, *name; |
1040 ngx_str_t path; | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
1041 ngx_uint_t test_dir; |
2407 | 1042 ngx_http_try_file_t *tf; |
1043 ngx_open_file_info_t of; | |
1044 ngx_http_script_code_pt code; | |
1045 ngx_http_script_engine_t e; | |
1046 ngx_http_core_loc_conf_t *clcf; | |
1047 ngx_http_script_len_code_pt lcode; | |
1048 | |
1049 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1050 "try files phase: %ui", r->phase_handler); | |
1051 | |
1052 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1053 | |
1054 if (clcf->try_files == NULL) { | |
1055 r->phase_handler++; | |
1056 return NGX_AGAIN; | |
1057 } | |
1058 | |
1059 allocated = 0; | |
1060 root = 0; | |
1061 name = NULL; | |
2481 | 1062 /* suppress MSVC warning */ |
2407 | 1063 path.data = NULL; |
1064 | |
1065 tf = clcf->try_files; | |
1066 | |
1067 alias = clcf->alias ? clcf->name.len : 0; | |
1068 | |
1069 for ( ;; ) { | |
1070 | |
1071 if (tf->lengths) { | |
1072 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); | |
1073 | |
1074 e.ip = tf->lengths->elts; | |
1075 e.request = r; | |
1076 | |
1077 /* 1 is for terminating '\0' as in static names */ | |
1078 len = 1; | |
1079 | |
1080 while (*(uintptr_t *) e.ip) { | |
1081 lcode = *(ngx_http_script_len_code_pt *) e.ip; | |
1082 len += lcode(&e); | |
1083 } | |
1084 | |
1085 } else { | |
1086 len = tf->name.len; | |
1087 } | |
1088 | |
1089 /* 16 bytes are preallocation */ | |
2541
e73f70b4ca5c
fix case when the first try is shorter then URI
Igor Sysoev <igor@sysoev.ru>
parents:
2536
diff
changeset
|
1090 reserve = ngx_abs((ssize_t) (len - r->uri.len)) + alias + 16; |
2407 | 1091 |
1092 if (reserve > allocated) { | |
1093 | |
1094 /* we just need to allocate path and to copy a root */ | |
1095 | |
1096 if (ngx_http_map_uri_to_path(r, &path, &root, reserve) == NULL) { | |
1097 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
1098 return NGX_OK; | |
1099 } | |
1100 | |
1101 name = path.data + root; | |
1102 allocated = path.len - root - (r->uri.len - alias); | |
1103 } | |
1104 | |
1105 if (tf->values == NULL) { | |
1106 | |
1107 /* tf->name.len includes the terminating '\0' */ | |
1108 | |
1109 ngx_memcpy(name, tf->name.data, tf->name.len); | |
1110 | |
1111 path.len = (name + tf->name.len - 1) - path.data; | |
1112 | |
1113 } else { | |
1114 e.ip = tf->values->elts; | |
1115 e.pos = name; | |
2424
46d11bff21ef
flush variable values in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2423
diff
changeset
|
1116 e.flushed = 1; |
2407 | 1117 |
1118 while (*(uintptr_t *) e.ip) { | |
1119 code = *(ngx_http_script_code_pt *) e.ip; | |
1120 code((ngx_http_script_engine_t *) &e); | |
1121 } | |
1122 | |
1123 path.len = e.pos - path.data; | |
1124 | |
2564 | 1125 *e.pos = '\0'; |
2407 | 1126 |
1127 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) { | |
1128 ngx_memcpy(name, name + alias, len - alias); | |
1129 path.len -= alias; | |
1130 } | |
1131 } | |
1132 | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
1133 test_dir = tf->test_dir; |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
1134 |
2407 | 1135 tf++; |
1136 | |
1137 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1138 "try to use file: \"%s\"", name); | |
1139 | |
1140 if (tf->lengths == NULL && tf->name.len == 0) { | |
1141 | |
1142 path.len -= root; | |
1143 path.data += root; | |
1144 | |
1145 if (path.data[0] == '@') { | |
1146 (void) ngx_http_named_location(r, &path); | |
1147 | |
1148 } else { | |
1149 (void) ngx_http_internal_redirect(r, &path, NULL); | |
1150 } | |
1151 | |
1152 return NGX_OK; | |
1153 } | |
1154 | |
1155 ngx_memzero(&of, sizeof(ngx_open_file_info_t)); | |
1156 | |
1157 of.directio = clcf->directio; | |
1158 of.valid = clcf->open_file_cache_valid; | |
1159 of.min_uses = clcf->open_file_cache_min_uses; | |
1160 of.errors = clcf->open_file_cache_errors; | |
1161 of.events = clcf->open_file_cache_events; | |
1162 | |
1163 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) | |
1164 != NGX_OK) | |
1165 { | |
1166 if (of.err != NGX_ENOENT && of.err != NGX_ENOTDIR) { | |
1167 ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err, | |
1168 ngx_open_file_n " \"%s\" failed", path.data); | |
1169 } | |
1170 | |
1171 continue; | |
1172 } | |
1173 | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
1174 if (of.is_dir && !test_dir) { |
2453
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1175 continue; |
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1176 } |
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1177 |
2407 | 1178 path.len -= root; |
1179 path.data += root; | |
1180 | |
1181 if (!alias) { | |
1182 r->uri = path; | |
1183 | |
1184 } else { | |
1185 r->uri.len = alias + path.len; | |
1186 r->uri.data = ngx_pnalloc(r->pool, r->uri.len); | |
1187 if (r->uri.data == NULL) { | |
1188 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
1189 return NGX_OK; | |
1190 } | |
1191 | |
1192 p = ngx_copy(r->uri.data, clcf->name.data, alias); | |
1193 ngx_memcpy(p, name, path.len); | |
1194 } | |
1195 | |
2503
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1196 if (ngx_http_set_exten(r) != NGX_OK) { |
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1197 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1198 return NGX_OK; |
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1199 } |
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1200 |
2407 | 1201 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1202 "try file uri: \"%V\"", &r->uri); | |
1203 | |
1204 r->phase_handler++; | |
1205 return NGX_AGAIN; | |
1206 } | |
1207 | |
1208 /* not reached */ | |
1209 } | |
1210 | |
1211 | |
1212 ngx_int_t | |
681 | 1213 ngx_http_core_content_phase(ngx_http_request_t *r, |
1214 ngx_http_phase_handler_t *ph) | |
1215 { | |
773 | 1216 size_t root; |
681 | 1217 ngx_int_t rc; |
1218 ngx_str_t path; | |
1219 | |
1220 if (r->content_handler) { | |
1221 r->write_event_handler = ngx_http_request_empty_handler; | |
1222 ngx_http_finalize_request(r, r->content_handler(r)); | |
1223 return NGX_OK; | |
1224 } | |
1225 | |
1226 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1227 "content phase: %ui", r->phase_handler); | |
1228 | |
1229 rc = ph->handler(r); | |
1230 | |
1231 if (rc == NGX_DONE) { | |
1232 return NGX_OK; | |
1233 } | |
1234 | |
1235 if (rc != NGX_DECLINED) { | |
1236 ngx_http_finalize_request(r, rc); | |
1237 return NGX_OK; | |
1238 } | |
1239 | |
1240 /* rc == NGX_DECLINED */ | |
1241 | |
1242 ph++; | |
1243 | |
1244 if (ph->checker) { | |
1245 r->phase_handler++; | |
1246 return NGX_AGAIN; | |
1247 } | |
1248 | |
1249 /* no content handler was found */ | |
1250 | |
1251 if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) { | |
1252 | |
773 | 1253 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { |
681 | 1254 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1546
2956fb9b7dcb
omit trailing zero in directory name
Igor Sysoev <igor@sysoev.ru>
parents:
1489
diff
changeset
|
1255 "directory index of \"%s\" is forbidden", path.data); |
681 | 1256 } |
1257 | |
1258 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); | |
1259 return NGX_OK; | |
1260 } | |
1261 | |
1262 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found"); | |
1263 | |
1264 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); | |
535 | 1265 return NGX_OK; |
1266 } | |
1267 | |
1268 | |
1269 void | |
1270 ngx_http_update_location_config(ngx_http_request_t *r) | |
1271 { | |
1272 ngx_http_core_loc_conf_t *clcf; | |
1273 | |
1274 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1275 | |
631 | 1276 if (r->method & clcf->limit_except) { |
1277 r->loc_conf = clcf->limit_except_loc_conf; | |
1278 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1279 } | |
1280 | |
643 | 1281 if (r == r->main) { |
1148 | 1282 r->connection->log->file = clcf->err_log->file; |
1283 | |
643 | 1284 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { |
1285 r->connection->log->log_level = clcf->err_log->log_level; | |
1286 } | |
535 | 1287 } |
1288 | |
1289 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { | |
1290 r->connection->sendfile = 1; | |
1291 | |
1292 } else { | |
1293 r->connection->sendfile = 0; | |
1294 } | |
1295 | |
633 | 1296 if (clcf->client_body_in_file_only) { |
1297 r->request_body_in_file_only = 1; | |
1298 r->request_body_in_persistent_file = 1; | |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
1299 r->request_body_in_clean_file = |
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
1300 clcf->client_body_in_file_only == NGX_HTTP_REQUEST_BODY_FILE_CLEAN; |
637 | 1301 r->request_body_file_log_level = NGX_LOG_NOTICE; |
1302 | |
1303 } else { | |
1304 r->request_body_file_log_level = NGX_LOG_WARN; | |
633 | 1305 } |
1306 | |
535 | 1307 if (r->keepalive && clcf->keepalive_timeout == 0) { |
1308 r->keepalive = 0; | |
1309 } | |
1310 | |
1311 if (!clcf->tcp_nopush) { | |
1312 /* disable TCP_NOPUSH/TCP_CORK use */ | |
1313 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; | |
1314 } | |
1315 | |
613 | 1316 if (r->limit_rate == 0) { |
1317 r->limit_rate = clcf->limit_rate; | |
1318 } | |
527 | 1319 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
1320 if (clcf->handler) { |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
1321 r->content_handler = clcf->handler; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1322 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1323 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1324 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1325 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1326 /* |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1327 * NGX_OK - exact or regex match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1328 * NGX_DONE - auto redirect |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1329 * NGX_AGAIN - inclusive match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1330 * NGX_ERROR - regex error |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1331 * NGX_DECLINED - no match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1332 */ |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1333 |
487 | 1334 static ngx_int_t |
2027 | 1335 ngx_http_core_find_location(ngx_http_request_t *r) |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1336 { |
2027 | 1337 ngx_int_t rc; |
1338 ngx_http_core_loc_conf_t *pclcf; | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1339 #if (NGX_PCRE) |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1340 ngx_int_t n, len; |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1341 ngx_uint_t noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1342 ngx_http_core_loc_conf_t *clcf, **clcfp; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1343 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1344 noregex = 0; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1345 #endif |
2027 | 1346 |
1347 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1348 | |
1349 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); | |
1350 | |
1351 if (rc == NGX_AGAIN) { | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1352 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1353 #if (NGX_PCRE) |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1354 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1355 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1356 noregex = clcf->noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1357 #endif |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1358 |
2027 | 1359 /* look up nested locations */ |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1360 |
2027 | 1361 rc = ngx_http_core_find_location(r); |
1362 } | |
1363 | |
1364 if (rc == NGX_OK || rc == NGX_DONE) { | |
1365 return rc; | |
1366 } | |
1367 | |
1368 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ | |
1369 | |
1370 #if (NGX_PCRE) | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1371 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1372 if (noregex == 0 && pclcf->regex_locations) { |
2027 | 1373 |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1374 len = 0; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1375 |
2027 | 1376 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { |
1377 | |
1378 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1379 "test location: ~ \"%V\"", &(*clcfp)->name); | |
1380 | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1381 if ((*clcfp)->captures && r->captures == NULL) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1382 |
2556
8ec97ff12a0a
fix segfaults introduced in r2549 and r2550
Igor Sysoev <igor@sysoev.ru>
parents:
2549
diff
changeset
|
1383 len = (NGX_HTTP_MAX_CAPTURES + 1) * 3; |
8ec97ff12a0a
fix segfaults introduced in r2549 and r2550
Igor Sysoev <igor@sysoev.ru>
parents:
2549
diff
changeset
|
1384 |
8ec97ff12a0a
fix segfaults introduced in r2549 and r2550
Igor Sysoev <igor@sysoev.ru>
parents:
2549
diff
changeset
|
1385 r->captures = ngx_palloc(r->pool, len * sizeof(int)); |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1386 if (r->captures == NULL) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1387 return NGX_ERROR; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1388 } |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1389 } |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1390 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1391 n = ngx_regex_exec((*clcfp)->regex, &r->uri, r->captures, len); |
2027 | 1392 |
1393 if (n == NGX_REGEX_NO_MATCHED) { | |
1394 continue; | |
1395 } | |
1396 | |
1397 if (n < 0) { | |
1398 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
1399 ngx_regex_exec_n | |
1400 " failed: %d on \"%V\" using \"%V\"", | |
1401 n, &r->uri, &(*clcfp)->name); | |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1402 return NGX_ERROR; |
2027 | 1403 } |
1404 | |
1405 /* match */ | |
1406 | |
1407 r->loc_conf = (*clcfp)->loc_conf; | |
1408 | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1409 r->ncaptures = len; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1410 r->captures_data = r->uri.data; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1411 |
2027 | 1412 /* look up nested locations */ |
1413 | |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1414 rc = ngx_http_core_find_location(r); |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1415 |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1416 return (rc == NGX_ERROR) ? rc : NGX_OK; |
2027 | 1417 } |
1418 } | |
1386
3c6da0610f19
fix building by bcc without PCRE
Igor Sysoev <igor@sysoev.ru>
parents:
1377
diff
changeset
|
1419 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1420 |
2027 | 1421 return rc; |
1422 } | |
1423 | |
1424 | |
1425 /* | |
1426 * NGX_OK - exact match | |
1427 * NGX_DONE - auto redirect | |
1428 * NGX_AGAIN - inclusive match | |
1429 * NGX_DECLINED - no match | |
1430 */ | |
1431 | |
1432 static ngx_int_t | |
1433 ngx_http_core_find_static_location(ngx_http_request_t *r, | |
1434 ngx_http_location_tree_node_t *node) | |
1435 { | |
1436 u_char *uri; | |
1437 size_t len, n; | |
1438 ngx_int_t rc, rv; | |
1439 | |
1440 len = r->uri.len; | |
1441 uri = r->uri.data; | |
1442 | |
1443 rv = NGX_DECLINED; | |
1444 | |
1445 for ( ;; ) { | |
1446 | |
1447 if (node == NULL) { | |
1448 return rv; | |
485 | 1449 } |
1450 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1451 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2027 | 1452 "test location: \"%*s\"", node->len, node->name); |
1453 | |
1454 n = (len <= (size_t) node->len) ? len : node->len; | |
1455 | |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
2085
diff
changeset
|
1456 rc = ngx_filename_cmp(uri, node->name, n); |
2027 | 1457 |
1458 if (rc != 0) { | |
1459 node = (rc < 0) ? node->left : node->right; | |
1460 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1461 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1462 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1463 |
2027 | 1464 if (len > (size_t) node->len) { |
1465 | |
1466 if (node->inclusive) { | |
1467 | |
1468 r->loc_conf = node->inclusive->loc_conf; | |
1469 rv = NGX_AGAIN; | |
1470 | |
1471 node = node->tree; | |
1472 uri += n; | |
1473 len -= n; | |
485 | 1474 |
1475 continue; | |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1476 } |
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1477 |
2027 | 1478 /* exact only */ |
1479 | |
1480 node = node->right; | |
1481 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1482 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1483 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1484 |
2027 | 1485 if (len == (size_t) node->len) { |
1486 | |
1487 r->loc_conf = (node->exact) ? node->exact->loc_conf: | |
1488 node->inclusive->loc_conf; | |
1489 return NGX_OK; | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1490 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1491 |
2027 | 1492 /* len < node->len */ |
1493 | |
1494 if (len + 1 == (size_t) node->len && node->auto_redirect) { | |
1495 | |
1496 r->loc_conf = (node->exact) ? node->exact->loc_conf: | |
1497 node->inclusive->loc_conf; | |
1498 rv = NGX_DONE; | |
1499 } | |
1500 | |
1501 node = node->left; | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1502 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1503 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1504 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1505 |
2138 | 1506 void * |
1507 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) | |
1508 { | |
1509 u_char c, *p; | |
1510 ngx_uint_t i, hash; | |
1511 | |
1512 if (r->headers_out.content_type.len == 0) { | |
1513 return NULL; | |
1514 } | |
1515 | |
1516 if (r->headers_out.content_type_lowcase == NULL) { | |
1517 | |
1518 p = ngx_pnalloc(r->pool, r->headers_out.content_type_len); | |
1519 | |
1520 if (p == NULL) { | |
1521 return NULL; | |
1522 } | |
1523 | |
1524 r->headers_out.content_type_lowcase = p; | |
1525 | |
1526 hash = 0; | |
1527 | |
1528 for (i = 0; i < r->headers_out.content_type_len; i++) { | |
1529 c = ngx_tolower(r->headers_out.content_type.data[i]); | |
1530 hash = ngx_hash(hash, c); | |
1531 *p++ = c; | |
1532 } | |
1533 | |
1534 r->headers_out.content_type_hash = hash; | |
1535 } | |
1536 | |
1537 return ngx_hash_find(types_hash, | |
1538 r->headers_out.content_type_hash, | |
1539 r->headers_out.content_type_lowcase, | |
1540 r->headers_out.content_type_len); | |
1541 } | |
1542 | |
1543 | |
487 | 1544 ngx_int_t |
1545 ngx_http_set_content_type(ngx_http_request_t *r) | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1546 { |
2136 | 1547 u_char c, *exten; |
589 | 1548 ngx_str_t *type; |
649 | 1549 ngx_uint_t i, hash; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1550 ngx_http_core_loc_conf_t *clcf; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1551 |
673 | 1552 if (r->headers_out.content_type.len) { |
1553 return NGX_OK; | |
1554 } | |
1555 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1556 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1557 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1558 if (r->exten.len) { |
485 | 1559 |
649 | 1560 hash = 0; |
1561 | |
1562 for (i = 0; i < r->exten.len; i++) { | |
1563 c = r->exten.data[i]; | |
1564 | |
1565 if (c >= 'A' && c <= 'Z') { | |
1566 | |
2136 | 1567 exten = ngx_pnalloc(r->pool, r->exten.len); |
1568 if (exten == NULL) { | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1569 return NGX_ERROR; |
485 | 1570 } |
1571 | |
2136 | 1572 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); |
485 | 1573 |
1574 r->exten.data = exten; | |
649 | 1575 |
1576 break; | |
485 | 1577 } |
1578 | |
649 | 1579 hash = ngx_hash(hash, c); |
485 | 1580 } |
1581 | |
649 | 1582 type = ngx_hash_find(&clcf->types_hash, hash, |
589 | 1583 r->exten.data, r->exten.len); |
1584 | |
1585 if (type) { | |
657 | 1586 r->headers_out.content_type_len = type->len; |
589 | 1587 r->headers_out.content_type = *type; |
657 | 1588 |
589 | 1589 return NGX_OK; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1590 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1591 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1592 |
657 | 1593 r->headers_out.content_type_len = clcf->default_type.len; |
589 | 1594 r->headers_out.content_type = clcf->default_type; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1595 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1596 return NGX_OK; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1597 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1598 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1599 |
487 | 1600 ngx_int_t |
1601 ngx_http_set_exten(ngx_http_request_t *r) | |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1602 { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1603 ngx_int_t i; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1604 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1605 r->exten.len = 0; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1606 r->exten.data = NULL; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1607 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1608 for (i = r->uri.len - 1; i > 1; i--) { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1609 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { |
649 | 1610 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1611 r->exten.len = r->uri.len - i - 1; |
649 | 1612 r->exten.data = &r->uri.data[i + 1]; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1613 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1614 break; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1615 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1616 } else if (r->uri.data[i] == '/') { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1617 break; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1618 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1619 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1620 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1621 return NGX_OK; |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1622 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1623 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1624 |
487 | 1625 ngx_int_t |
557 | 1626 ngx_http_send_header(ngx_http_request_t *r) |
1627 { | |
1628 if (r->err_status) { | |
1629 r->headers_out.status = r->err_status; | |
1630 r->headers_out.status_line.len = 0; | |
1631 } | |
1632 | |
1633 return ngx_http_top_header_filter(r); | |
1634 } | |
1635 | |
1636 | |
1637 ngx_int_t | |
1638 ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in) | |
1639 { | |
1640 ngx_int_t rc; | |
1641 | |
583 | 1642 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1643 "http output filter \"%V?%V\"", &r->uri, &r->args); | |
557 | 1644 |
1645 rc = ngx_http_top_body_filter(r, in); | |
1646 | |
1647 if (rc == NGX_ERROR) { | |
1648 /* NGX_ERROR may be returned by any filter */ | |
583 | 1649 r->connection->error = 1; |
557 | 1650 } |
1651 | |
1652 return rc; | |
1653 } | |
1654 | |
1655 | |
1656 u_char * | |
1657 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | |
773 | 1658 size_t *root_length, size_t reserved) |
557 | 1659 { |
623 | 1660 u_char *last; |
1661 size_t alias; | |
1662 ngx_http_core_loc_conf_t *clcf; | |
557 | 1663 |
1664 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1665 | |
1666 alias = clcf->alias ? clcf->name.len : 0; | |
1667 | |
603 | 1668 if (alias && !r->valid_location) { |
1669 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
1670 "\"alias\" could not be used in location \"%V\" " | |
1671 "where URI was rewritten", &clcf->name); | |
1672 return NULL; | |
1673 } | |
1674 | |
595 | 1675 if (clcf->root_lengths == NULL) { |
1676 | |
773 | 1677 *root_length = clcf->root.len; |
595 | 1678 |
2565
456e453eb84a
fix reserved mapped uri length if alias has captures
Igor Sysoev <igor@sysoev.ru>
parents:
2564
diff
changeset
|
1679 path->len = clcf->root.len + reserved + r->uri.len - alias + 1; |
595 | 1680 |
2049 | 1681 path->data = ngx_pnalloc(r->pool, path->len); |
595 | 1682 if (path->data == NULL) { |
1683 return NULL; | |
1684 } | |
1685 | |
1686 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | |
623 | 1687 |
1688 } else { | |
2565
456e453eb84a
fix reserved mapped uri length if alias has captures
Igor Sysoev <igor@sysoev.ru>
parents:
2564
diff
changeset
|
1689 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, ++reserved, |
671 | 1690 clcf->root_values->elts) |
667 | 1691 == NULL) |
1692 { | |
1693 return NULL; | |
1694 } | |
1695 | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1696 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0) != NGX_OK) { |
623 | 1697 return NULL; |
1698 } | |
1699 | |
773 | 1700 *root_length = path->len - reserved; |
1701 last = path->data + *root_length; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1702 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1703 if (alias) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1704 *last = '\0'; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1705 return last; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1706 } |
595 | 1707 } |
1708 | |
623 | 1709 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
557 | 1710 |
1711 return last; | |
1712 } | |
1713 | |
1714 | |
1715 ngx_int_t | |
539 | 1716 ngx_http_auth_basic_user(ngx_http_request_t *r) |
1717 { | |
1718 ngx_str_t auth, encoded; | |
1719 ngx_uint_t len; | |
1720 | |
1721 if (r->headers_in.user.len == 0 && r->headers_in.user.data != NULL) { | |
1722 return NGX_DECLINED; | |
1723 } | |
1724 | |
1725 if (r->headers_in.authorization == NULL) { | |
1726 r->headers_in.user.data = (u_char *) ""; | |
1727 return NGX_DECLINED; | |
1728 } | |
1729 | |
1730 encoded = r->headers_in.authorization->value; | |
1731 | |
1732 if (encoded.len < sizeof("Basic ") - 1 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1733 || ngx_strncasecmp(encoded.data, (u_char *) "Basic ", |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1734 sizeof("Basic ") - 1) |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1735 != 0) |
539 | 1736 { |
1737 r->headers_in.user.data = (u_char *) ""; | |
1738 return NGX_DECLINED; | |
1739 } | |
1740 | |
1741 encoded.len -= sizeof("Basic ") - 1; | |
1742 encoded.data += sizeof("Basic ") - 1; | |
1743 | |
1744 while (encoded.len && encoded.data[0] == ' ') { | |
1745 encoded.len--; | |
1746 encoded.data++; | |
1747 } | |
1748 | |
1749 if (encoded.len == 0) { | |
1750 r->headers_in.user.data = (u_char *) ""; | |
1751 return NGX_DECLINED; | |
1752 } | |
577 | 1753 |
539 | 1754 auth.len = ngx_base64_decoded_length(encoded.len); |
2049 | 1755 auth.data = ngx_pnalloc(r->pool, auth.len + 1); |
539 | 1756 if (auth.data == NULL) { |
1757 return NGX_ERROR; | |
1758 } | |
1759 | |
1760 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) { | |
1761 r->headers_in.user.data = (u_char *) ""; | |
1762 return NGX_DECLINED; | |
1763 } | |
577 | 1764 |
539 | 1765 auth.data[auth.len] = '\0'; |
577 | 1766 |
1767 for (len = 0; len < auth.len; len++) { | |
539 | 1768 if (auth.data[len] == ':') { |
1769 break; | |
1770 } | |
1771 } | |
577 | 1772 |
573 | 1773 if (len == 0 || len == auth.len) { |
539 | 1774 r->headers_in.user.data = (u_char *) ""; |
1775 return NGX_DECLINED; | |
1776 } | |
1777 | |
1778 r->headers_in.user.len = len; | |
1779 r->headers_in.user.data = auth.data; | |
1780 r->headers_in.passwd.len = auth.len - len - 1; | |
1781 r->headers_in.passwd.data = &auth.data[len + 1]; | |
1782 | |
1783 return NGX_OK; | |
1784 } | |
1785 | |
1786 | |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1787 ngx_int_t |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1788 ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s) |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1789 { |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1790 socklen_t len; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1791 ngx_connection_t *c; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1792 u_char sa[NGX_SOCKADDRLEN]; |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1793 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1794 c = r->connection; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1795 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1796 if (c->local_sockaddr == NULL) { |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1797 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1798 len = NGX_SOCKADDRLEN; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1799 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1800 if (getsockname(c->fd, (struct sockaddr *) &sa, &len) == -1) { |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1801 ngx_connection_error(c, ngx_socket_errno, "getsockname() failed"); |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1802 return NGX_ERROR; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1803 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1804 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1805 c->local_sockaddr = ngx_palloc(r->connection->pool, len); |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1806 if (c->local_sockaddr == NULL) { |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1807 return NGX_ERROR; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1808 } |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1809 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1810 c->local_socklen = len; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1811 ngx_memcpy(c->local_sockaddr, &sa, len); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1812 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1813 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1814 if (s == NULL) { |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1815 return NGX_OK; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1816 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1817 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
1818 s->len = ngx_sock_ntop(c->local_sockaddr, s->data, s->len, 0); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1819 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1820 return NGX_OK; |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1821 } |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1822 |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
1823 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1824 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1825 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1826 ngx_int_t |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1827 ngx_http_gzip_ok(ngx_http_request_t *r) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1828 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1829 time_t date, expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1830 ngx_uint_t p; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1831 ngx_array_t *cc; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1832 ngx_table_elt_t *e, *d; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1833 ngx_http_core_loc_conf_t *clcf; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1834 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1835 if (r->gzip == 1) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1836 return NGX_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1837 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1838 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1839 if (r->gzip == 2) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1840 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1841 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1842 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1843 r->gzip = 2; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1844 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1845 if (r != r->main |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1846 || r->headers_in.accept_encoding == NULL |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1847 || ngx_strcasestrn(r->headers_in.accept_encoding->value.data, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1848 "gzip", 4 - 1) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1849 == NULL |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1850 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1851 /* |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1852 * if the URL (without the "http://" prefix) is longer than 253 bytes, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1853 * then MSIE 4.x can not handle the compressed stream - it waits |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1854 * too long, hangs up or crashes |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1855 */ |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1856 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1857 || (r->headers_in.msie4 && r->unparsed_uri.len > 200)) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1858 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1859 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1860 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1861 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1862 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1863 |
2205 | 1864 if (r->headers_in.msie6 && clcf->gzip_disable_msie6) { |
1865 return NGX_DECLINED; | |
1866 } | |
1867 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1868 if (r->http_version < clcf->gzip_http_version) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1869 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1870 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1871 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1872 if (r->headers_in.via == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1873 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1874 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1875 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1876 p = clcf->gzip_proxied; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1877 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1878 if (p & NGX_HTTP_GZIP_PROXIED_OFF) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1879 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1880 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1881 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1882 if (p & NGX_HTTP_GZIP_PROXIED_ANY) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1883 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1884 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1885 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1886 if (r->headers_in.authorization && (p & NGX_HTTP_GZIP_PROXIED_AUTH)) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1887 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1888 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1889 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1890 e = r->headers_out.expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1891 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1892 if (e) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1893 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1894 if (!(p & NGX_HTTP_GZIP_PROXIED_EXPIRED)) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1895 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1896 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1897 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1898 expires = ngx_http_parse_time(e->value.data, e->value.len); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1899 if (expires == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1900 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1901 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1902 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1903 d = r->headers_out.date; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1904 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1905 if (d) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1906 date = ngx_http_parse_time(d->value.data, d->value.len); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1907 if (date == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1908 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1909 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1910 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1911 } else { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1912 date = ngx_time(); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1913 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1914 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1915 if (expires < date) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1916 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1917 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1918 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1919 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1920 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1921 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1922 cc = &r->headers_out.cache_control; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1923 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1924 if (cc->elts) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1925 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1926 if ((p & NGX_HTTP_GZIP_PROXIED_NO_CACHE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1927 && ngx_http_parse_multi_header_lines(cc, &ngx_http_gzip_no_cache, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1928 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1929 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1930 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1931 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1932 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1933 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1934 if ((p & NGX_HTTP_GZIP_PROXIED_NO_STORE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1935 && ngx_http_parse_multi_header_lines(cc, &ngx_http_gzip_no_store, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1936 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1937 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1938 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1939 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1940 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1941 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1942 if ((p & NGX_HTTP_GZIP_PROXIED_PRIVATE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1943 && ngx_http_parse_multi_header_lines(cc, &ngx_http_gzip_private, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1944 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1945 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1946 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1947 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1948 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1949 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1950 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1951 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1952 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1953 if ((p & NGX_HTTP_GZIP_PROXIED_NO_LM) && r->headers_out.last_modified) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1954 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1955 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1956 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1957 if ((p & NGX_HTTP_GZIP_PROXIED_NO_ETAG) && r->headers_out.etag) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1958 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1959 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1960 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1961 ok: |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1962 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1963 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1964 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1965 if (clcf->gzip_disable && r->headers_in.user_agent) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1966 |
1801
a4cb9c04e7f2
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1800
diff
changeset
|
1967 if (ngx_regex_exec_array(clcf->gzip_disable, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1968 &r->headers_in.user_agent->value, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1969 r->connection->log) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1970 != NGX_DECLINED) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1971 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1972 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1973 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1974 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1975 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1976 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1977 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1978 r->gzip = 1; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1979 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1980 return NGX_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1981 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1982 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1983 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1984 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
1985 |
539 | 1986 ngx_int_t |
509 | 1987 ngx_http_subrequest(ngx_http_request_t *r, |
758
86bb73dc8d40
fix <!--#include virtual=... wait="yes" -->
Igor Sysoev <igor@sysoev.ru>
parents:
716
diff
changeset
|
1988 ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr, |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
1989 ngx_http_post_subrequest_t *ps, ngx_uint_t flags) |
509 | 1990 { |
583 | 1991 ngx_connection_t *c; |
509 | 1992 ngx_http_request_t *sr; |
1993 ngx_http_core_srv_conf_t *cscf; | |
1994 ngx_http_postponed_request_t *pr, *p; | |
1995 | |
657 | 1996 r->main->subrequests--; |
1997 | |
1998 if (r->main->subrequests == 0) { | |
1999 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2000 "subrequests cycle while processing \"%V\"", uri); |
838 | 2001 r->main->subrequests = 1; |
657 | 2002 return NGX_ERROR; |
2003 } | |
2004 | |
509 | 2005 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t)); |
2006 if (sr == NULL) { | |
645 | 2007 return NGX_ERROR; |
509 | 2008 } |
2009 | |
2010 sr->signature = NGX_HTTP_MODULE; | |
583 | 2011 |
2012 c = r->connection; | |
2013 sr->connection = c; | |
509 | 2014 |
2015 sr->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); | |
2016 if (sr->ctx == NULL) { | |
645 | 2017 return NGX_ERROR; |
509 | 2018 } |
2019 | |
2020 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | |
581 | 2021 sizeof(ngx_table_elt_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2022 != NGX_OK) |
509 | 2023 { |
645 | 2024 return NGX_ERROR; |
509 | 2025 } |
2026 | |
2027 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | |
2028 sr->main_conf = cscf->ctx->main_conf; | |
2029 sr->srv_conf = cscf->ctx->srv_conf; | |
2030 sr->loc_conf = cscf->ctx->loc_conf; | |
2031 | |
2032 sr->pool = r->pool; | |
2033 | |
2034 sr->headers_in = r->headers_in; | |
2035 | |
577 | 2036 ngx_http_clear_content_length(sr); |
2037 ngx_http_clear_accept_ranges(sr); | |
2038 ngx_http_clear_last_modified(sr); | |
509 | 2039 |
2040 sr->request_body = r->request_body; | |
2041 | |
2042 sr->method = NGX_HTTP_GET; | |
2043 sr->http_version = r->http_version; | |
2044 | |
2045 sr->request_line = r->request_line; | |
2046 sr->uri = *uri; | |
573 | 2047 |
509 | 2048 if (args) { |
2049 sr->args = *args; | |
2050 } | |
573 | 2051 |
583 | 2052 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2053 "http subrequest \"%V?%V\"", uri, &sr->args); | |
2054 | |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2055 sr->zero_in_uri = (flags & NGX_HTTP_ZERO_IN_URI) != 0; |
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2056 sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0; |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2057 sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0; |
573 | 2058 |
509 | 2059 sr->unparsed_uri = r->unparsed_uri; |
1857
18c20c38ad6d
update GET method text in an subrequest
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
2060 sr->method_name = ngx_http_core_get_method; |
509 | 2061 sr->http_protocol = r->http_protocol; |
2062 | |
2063 if (ngx_http_set_exten(sr) != NGX_OK) { | |
645 | 2064 return NGX_ERROR; |
509 | 2065 } |
2066 | |
553 | 2067 sr->main = r->main; |
509 | 2068 sr->parent = r; |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2069 sr->post_subrequest = ps; |
509 | 2070 sr->read_event_handler = ngx_http_request_empty_handler; |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2071 sr->write_event_handler = ngx_http_handler; |
509 | 2072 |
2423 | 2073 if (c->data == r && r->postponed == NULL) { |
583 | 2074 c->data = sr; |
509 | 2075 } |
2076 | |
2077 sr->variables = r->variables; | |
2078 | |
2079 sr->log_handler = r->log_handler; | |
2080 | |
2081 pr = ngx_palloc(r->pool, sizeof(ngx_http_postponed_request_t)); | |
2082 if (pr == NULL) { | |
645 | 2083 return NGX_ERROR; |
509 | 2084 } |
2085 | |
2086 pr->request = sr; | |
2087 pr->out = NULL; | |
2088 pr->next = NULL; | |
2089 | |
2090 if (r->postponed) { | |
2091 for (p = r->postponed; p->next; p = p->next) { /* void */ } | |
2092 p->next = pr; | |
2093 | |
2094 } else { | |
2095 r->postponed = pr; | |
2096 } | |
2097 | |
2098 sr->internal = 1; | |
2099 | |
543 | 2100 sr->discard_body = r->discard_body; |
2436
26d9d4a41e91
send "100 Continue" just before reading request body
Igor Sysoev <igor@sysoev.ru>
parents:
2435
diff
changeset
|
2101 sr->expect_tested = 1; |
513 | 2102 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; |
2103 | |
651 | 2104 sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1; |
2105 | |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2106 r->main->subrequests++; |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2107 |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2108 *psr = sr; |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2109 |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2110 return ngx_http_post_request(sr); |
509 | 2111 } |
2112 | |
2113 | |
2114 ngx_int_t | |
487 | 2115 ngx_http_internal_redirect(ngx_http_request_t *r, |
2116 ngx_str_t *uri, ngx_str_t *args) | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2117 { |
487 | 2118 ngx_http_core_srv_conf_t *cscf; |
2119 | |
677 | 2120 r->uri_changes--; |
2121 | |
2122 if (r->uri_changes == 0) { | |
2123 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2124 "rewrite or internal redirection cycle " |
2125 "while internal redirect to \"%V\"", uri); | |
2126 | |
677 | 2127 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2128 return NGX_DONE; | |
2129 } | |
2130 | |
461 | 2131 r->uri = *uri; |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2132 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2133 if (args) { |
461 | 2134 r->args = *args; |
509 | 2135 |
2136 } else { | |
2137 r->args.len = 0; | |
2138 r->args.data = NULL; | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2139 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2140 |
583 | 2141 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2142 "internal redirect: \"%V?%V\"", uri, &r->args); | |
2143 | |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
2144 if (ngx_http_set_exten(r) != NGX_OK) { |
677 | 2145 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2146 return NGX_DONE; | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2147 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2148 |
675 | 2149 /* clear the modules contexts */ |
2150 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2151 |
487 | 2152 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2153 r->loc_conf = cscf->ctx->loc_conf; | |
2154 | |
535 | 2155 ngx_http_update_location_config(r); |
2156 | |
509 | 2157 r->internal = 1; |
2158 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2159 ngx_http_handler(r); |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2160 |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
2161 return NGX_DONE; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2162 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2163 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2164 |
1353 | 2165 ngx_int_t |
2166 ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name) | |
2167 { | |
2168 ngx_http_core_srv_conf_t *cscf; | |
2169 ngx_http_core_loc_conf_t **clcfp; | |
2170 ngx_http_core_main_conf_t *cmcf; | |
2171 | |
2172 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | |
2173 | |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2174 if (cscf->named_locations) { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2175 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2176 for (clcfp = cscf->named_locations; *clcfp; clcfp++) { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2177 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2178 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2179 "test location: \"%V\"", &(*clcfp)->name); |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2180 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2181 if (name->len != (*clcfp)->name.len |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2182 || ngx_strncmp(name->data, (*clcfp)->name.data, name->len) != 0) |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2183 { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2184 continue; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2185 } |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2186 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2187 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2188 "using location: %V \"%V?%V\"", |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2189 name, &r->uri, &r->args); |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2190 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2191 r->internal = 1; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2192 r->content_handler = NULL; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2193 r->loc_conf = (*clcfp)->loc_conf; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2194 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2195 ngx_http_update_location_config(r); |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2196 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2197 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2198 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2199 r->phase_handler = cmcf->phase_engine.location_rewrite_index; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2200 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2201 ngx_http_core_run_phases(r); |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2202 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2203 return NGX_DONE; |
1353 | 2204 } |
2205 } | |
2206 | |
2207 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1591 | 2208 "could not find named location \"%V\"", name); |
1353 | 2209 |
2210 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
2027 | 2211 |
1353 | 2212 return NGX_DONE; |
2213 } | |
2214 | |
2215 | |
569 | 2216 ngx_http_cleanup_t * |
2217 ngx_http_cleanup_add(ngx_http_request_t *r, size_t size) | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2218 { |
569 | 2219 ngx_http_cleanup_t *cln; |
2220 | |
2221 r = r->main; | |
2222 | |
2223 cln = ngx_palloc(r->pool, sizeof(ngx_http_cleanup_t)); | |
2224 if (cln == NULL) { | |
2225 return NULL; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2226 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2227 |
569 | 2228 if (size) { |
2229 cln->data = ngx_palloc(r->pool, size); | |
2230 if (cln->data == NULL) { | |
2231 return NULL; | |
2232 } | |
2233 | |
2234 } else { | |
2235 cln->data = NULL; | |
2236 } | |
2237 | |
2238 cln->handler = NULL; | |
2239 cln->next = r->cleanup; | |
2240 | |
2241 r->cleanup = cln; | |
2242 | |
2243 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2244 "http cleanup add: %p", cln); | |
2245 | |
2246 return cln; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2247 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2248 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2249 |
487 | 2250 static char * |
2251 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2252 { |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2253 char *rv; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2254 void *mconf; |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2255 ngx_uint_t i; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2256 ngx_conf_t pcf; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2257 ngx_http_module_t *module; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2258 ngx_http_conf_ctx_t *ctx, *http_ctx; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2259 ngx_http_core_srv_conf_t *cscf, **cscfp; |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2260 ngx_http_core_main_conf_t *cmcf; |
487 | 2261 |
501 | 2262 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2263 if (ctx == NULL) { | |
487 | 2264 return NGX_CONF_ERROR; |
2265 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2266 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2267 http_ctx = cf->ctx; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2268 ctx->main_conf = http_ctx->main_conf; |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
2269 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2270 /* the server{}'s srv_conf */ |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
2271 |
487 | 2272 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2273 if (ctx->srv_conf == NULL) { | |
2274 return NGX_CONF_ERROR; | |
2275 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2276 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2277 /* the server{}'s loc_conf */ |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
2278 |
487 | 2279 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2280 if (ctx->loc_conf == NULL) { | |
2281 return NGX_CONF_ERROR; | |
2282 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2283 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2284 for (i = 0; ngx_modules[i]; i++) { |
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2285 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2286 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2287 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2288 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2289 module = ngx_modules[i]->ctx; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2290 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2291 if (module->create_srv_conf) { |
501 | 2292 mconf = module->create_srv_conf(cf); |
2293 if (mconf == NULL) { | |
487 | 2294 return NGX_CONF_ERROR; |
2295 } | |
2296 | |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2297 ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2298 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2299 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2300 if (module->create_loc_conf) { |
501 | 2301 mconf = module->create_loc_conf(cf); |
2302 if (mconf == NULL) { | |
487 | 2303 return NGX_CONF_ERROR; |
2304 } | |
2305 | |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2306 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2307 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2308 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2309 |
487 | 2310 |
2311 /* the server configuration context */ | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2312 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2313 cscf = ctx->srv_conf[ngx_http_core_module.ctx_index]; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2314 cscf->ctx = ctx; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2315 |
487 | 2316 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2317 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; |
487 | 2318 |
501 | 2319 cscfp = ngx_array_push(&cmcf->servers); |
2320 if (cscfp == NULL) { | |
487 | 2321 return NGX_CONF_ERROR; |
2322 } | |
2323 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2324 *cscfp = cscf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2325 |
487 | 2326 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2327 /* parse inside server{} */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2328 |
521 | 2329 pcf = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2330 cf->ctx = ctx; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2331 cf->cmd_type = NGX_HTTP_SRV_CONF; |
485 | 2332 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2333 rv = ngx_conf_parse(cf, NULL); |
485 | 2334 |
521 | 2335 *cf = pcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2336 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2337 return rv; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2338 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2339 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2340 |
487 | 2341 static char * |
2342 ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2343 { |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2344 char *rv; |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2345 u_char *mod; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2346 size_t len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2347 ngx_str_t *value, *name; |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2348 ngx_uint_t i; |
485 | 2349 ngx_conf_t save; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2350 ngx_http_module_t *module; |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2351 ngx_http_conf_ctx_t *ctx, *pctx; |
2027 | 2352 ngx_http_core_loc_conf_t *clcf, *pclcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2353 |
501 | 2354 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2355 if (ctx == NULL) { | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2356 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2357 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2358 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2359 pctx = cf->ctx; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2360 ctx->main_conf = pctx->main_conf; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2361 ctx->srv_conf = pctx->srv_conf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2362 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2363 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2364 if (ctx->loc_conf == NULL) { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2365 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2366 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2367 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2368 for (i = 0; ngx_modules[i]; i++) { |
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2369 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2370 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2371 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2372 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2373 module = ngx_modules[i]->ctx; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2374 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2375 if (module->create_loc_conf) { |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2376 ctx->loc_conf[ngx_modules[i]->ctx_index] = |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2377 module->create_loc_conf(cf); |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2378 if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) { |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2379 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2380 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2381 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2382 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2383 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2384 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2385 clcf->loc_conf = ctx->loc_conf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2386 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
2387 value = cf->args->elts; |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2388 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2389 if (cf->args->nelts == 3) { |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2390 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2391 len = value[1].len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2392 mod = value[1].data; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2393 name = &value[2]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2394 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2395 if (len == 1 && mod[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2396 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2397 clcf->name = *name; |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2398 clcf->exact_match = 1; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2399 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2400 } else if (len == 2 && mod[0] == '^' && mod[1] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2401 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2402 clcf->name = *name; |
467 | 2403 clcf->noregex = 1; |
2404 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2405 } else if (len == 1 && mod[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2406 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2407 if (ngx_http_core_regex_location(cf, clcf, name, 0) != NGX_OK) { |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2408 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2409 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2410 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2411 } else if (len == 2 && mod[0] == '~' && mod[1] == '*') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2412 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2413 if (ngx_http_core_regex_location(cf, clcf, name, 1) != NGX_OK) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2414 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2415 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2416 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2417 } else { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2418 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 2419 "invalid location modifier \"%V\"", &value[1]); |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2420 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2421 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2422 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2423 } else { |
1353 | 2424 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2425 name = &value[1]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2426 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2427 if (name->data[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2428 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2429 clcf->name.len = name->len - 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2430 clcf->name.data = name->data + 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2431 clcf->exact_match = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2432 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2433 } else if (name->data[0] == '^' && name->data[1] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2434 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2435 clcf->name.len = name->len - 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2436 clcf->name.data = name->data + 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2437 clcf->noregex = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2438 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2439 } else if (name->data[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2440 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2441 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2442 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2443 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2444 if (name->data[0] == '*') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2445 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2446 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2447 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2448 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2449 if (ngx_http_core_regex_location(cf, clcf, name, 1) != NGX_OK) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2450 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2451 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2452 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2453 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2454 if (ngx_http_core_regex_location(cf, clcf, name, 0) != NGX_OK) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2455 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2456 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2457 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2458 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2459 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2460 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2461 clcf->name = *name; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2462 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2463 if (name->data[0] == '@') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2464 clcf->named = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2465 } |
1353 | 2466 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2467 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2468 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2469 pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index]; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2470 |
2027 | 2471 if (pclcf->name.len) { |
2472 | |
2473 /* nested location */ | |
2474 | |
485 | 2475 #if 0 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2476 clcf->prev_location = pclcf; |
485 | 2477 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2478 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2479 if (pclcf->exact_match) { |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2480 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 2481 "location \"%V\" could not be inside " |
2482 "the exact location \"%V\"", | |
2483 &clcf->name, &pclcf->name); | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2484 return NGX_CONF_ERROR; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2485 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2486 |
1353 | 2487 if (pclcf->named) { |
2488 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
2489 "location \"%V\" could not be inside " | |
2490 "the named location \"%V\"", | |
2491 &clcf->name, &pclcf->name); | |
2492 return NGX_CONF_ERROR; | |
2493 } | |
2494 | |
2027 | 2495 if (clcf->named) { |
2496 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
2497 "named location \"%V\" must be " | |
2498 "on server level only", | |
2499 &clcf->name); | |
2500 return NGX_CONF_ERROR; | |
2501 } | |
2502 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2503 len = pclcf->name.len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2504 |
455 | 2505 #if (NGX_PCRE) |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2506 if (clcf->regex == NULL |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2507 && ngx_strncmp(clcf->name.data, pclcf->name.data, len) != 0) |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
2508 #else |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2509 if (ngx_strncmp(clcf->name.data, pclcf->name.data, len) != 0) |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
2510 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2511 { |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2512 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 2513 "location \"%V\" is outside location \"%V\"", |
2514 &clcf->name, &pclcf->name); | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2515 return NGX_CONF_ERROR; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2516 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2517 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2518 |
2027 | 2519 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { |
2520 return NGX_CONF_ERROR; | |
2521 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2522 |
485 | 2523 save = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2524 cf->ctx = ctx; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2525 cf->cmd_type = NGX_HTTP_LOC_CONF; |
485 | 2526 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2527 rv = ngx_conf_parse(cf, NULL); |
485 | 2528 |
2529 *cf = save; | |
2530 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2531 return rv; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2532 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2533 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2534 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2535 static ngx_int_t |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2536 ngx_http_core_regex_location(ngx_conf_t *cf, ngx_http_core_loc_conf_t *clcf, |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2537 ngx_str_t *regex, ngx_uint_t caseless) |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2538 { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2539 #if (NGX_PCRE) |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2540 ngx_str_t err; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2541 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2542 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2543 err.len = NGX_MAX_CONF_ERRSTR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2544 err.data = errstr; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2545 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2546 clcf->regex = ngx_regex_compile(regex, caseless ? NGX_REGEX_CASELESS: 0, |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2547 cf->pool, &err); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2548 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2549 if (clcf->regex == NULL) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2550 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2551 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2552 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2553 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2554 clcf->name = *regex; |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
2555 clcf->captures = (ngx_regex_capture_count(clcf->regex) > 0); |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2556 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2557 return NGX_OK; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2558 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2559 #else |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2560 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2561 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2562 "the using of the regex \"%V\" requires PCRE library", |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2563 regex); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2564 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2565 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2566 #endif |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2567 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2568 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2569 |
487 | 2570 static char * |
2571 ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2572 { |
637 | 2573 ngx_http_core_loc_conf_t *lcf = conf; |
2574 | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2575 char *rv; |
485 | 2576 ngx_conf_t save; |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2577 |
637 | 2578 if (lcf->types == NULL) { |
2579 lcf->types = ngx_array_create(cf->pool, 64, sizeof(ngx_hash_key_t)); | |
2580 if (lcf->types == NULL) { | |
2581 return NGX_CONF_ERROR; | |
2582 } | |
2583 } | |
2584 | |
485 | 2585 save = *cf; |
2586 cf->handler = ngx_http_core_type; | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2587 cf->handler_conf = conf; |
485 | 2588 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2589 rv = ngx_conf_parse(cf, NULL); |
485 | 2590 |
2591 *cf = save; | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2592 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2593 return rv; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2594 } |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2595 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2596 |
487 | 2597 static char * |
2598 ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2599 { |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2600 ngx_http_core_loc_conf_t *lcf = conf; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2601 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2602 ngx_str_t *value, *content_type, *old, file; |
2136 | 2603 ngx_uint_t i, n, hash; |
589 | 2604 ngx_hash_key_t *type; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2605 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2606 value = cf->args->elts; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2607 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2608 if (ngx_strcmp(value[0].data, "include") == 0) { |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2609 file = value[1]; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2610 |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2611 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2612 return NGX_CONF_ERROR; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2613 } |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2614 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2615 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2616 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2617 return ngx_conf_parse(cf, &file); |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2618 } |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2619 |
589 | 2620 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t)); |
2621 if (content_type == NULL) { | |
2622 return NGX_CONF_ERROR; | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2623 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2624 |
589 | 2625 *content_type = value[0]; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2626 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2627 for (i = 1; i < cf->args->nelts; i++) { |
589 | 2628 |
2136 | 2629 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); |
589 | 2630 |
2631 type = lcf->types->elts; | |
2632 for (n = 0; n < lcf->types->nelts; n++) { | |
2633 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { | |
2634 old = type[n].value; | |
2635 type[n].value = content_type; | |
2636 | |
2637 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
2638 "duplicate extention \"%V\", " | |
2639 "content type: \"%V\", " | |
2640 "old content type: \"%V\"", | |
2641 &value[i], content_type, old); | |
2642 continue; | |
2643 } | |
2644 } | |
2645 | |
2646 | |
2647 type = ngx_array_push(lcf->types); | |
501 | 2648 if (type == NULL) { |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
2649 return NGX_CONF_ERROR; |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
2650 } |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
2651 |
589 | 2652 type->key = value[i]; |
2136 | 2653 type->key_hash = hash; |
589 | 2654 type->value = content_type; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2655 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2656 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2657 return NGX_CONF_OK; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2658 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2659 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2660 |
509 | 2661 static ngx_int_t |
2662 ngx_http_core_preconfiguration(ngx_conf_t *cf) | |
2663 { | |
2664 return ngx_http_variables_add_core_vars(cf); | |
2665 } | |
2666 | |
2667 | |
487 | 2668 static void * |
2669 ngx_http_core_create_main_conf(ngx_conf_t *cf) | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2670 { |
485 | 2671 ngx_http_core_main_conf_t *cmcf; |
2672 | |
501 | 2673 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t)); |
2674 if (cmcf == NULL) { | |
485 | 2675 return NGX_CONF_ERROR; |
2676 } | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2677 |
499 | 2678 if (ngx_array_init(&cmcf->servers, cf->pool, 4, |
569 | 2679 sizeof(ngx_http_core_srv_conf_t *)) |
651 | 2680 != NGX_OK) |
485 | 2681 { |
2682 return NGX_CONF_ERROR; | |
2683 } | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2684 |
593 | 2685 cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT; |
2686 cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
477 | 2687 |
611 | 2688 cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT; |
2689 cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
2690 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2691 return cmcf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2692 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2693 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2694 |
487 | 2695 static char * |
2696 ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf) | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2697 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2698 ngx_http_core_main_conf_t *cmcf = conf; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2699 |
593 | 2700 if (cmcf->server_names_hash_max_size == NGX_CONF_UNSET_UINT) { |
2701 cmcf->server_names_hash_max_size = 512; | |
477 | 2702 } |
2703 | |
593 | 2704 if (cmcf->server_names_hash_bucket_size == NGX_CONF_UNSET_UINT) { |
2705 cmcf->server_names_hash_bucket_size = ngx_cacheline_size; | |
477 | 2706 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2707 |
593 | 2708 cmcf->server_names_hash_bucket_size = |
2709 ngx_align(cmcf->server_names_hash_bucket_size, ngx_cacheline_size); | |
2710 | |
611 | 2711 |
2712 if (cmcf->variables_hash_max_size == NGX_CONF_UNSET_UINT) { | |
2713 cmcf->variables_hash_max_size = 512; | |
2714 } | |
2715 | |
2716 if (cmcf->variables_hash_bucket_size == NGX_CONF_UNSET_UINT) { | |
2717 cmcf->variables_hash_bucket_size = 64; | |
2718 } | |
2719 | |
2720 cmcf->variables_hash_bucket_size = | |
2721 ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size); | |
2722 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2723 return NGX_CONF_OK; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2724 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2725 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2726 |
487 | 2727 static void * |
2728 ngx_http_core_create_srv_conf(ngx_conf_t *cf) | |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2729 { |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2730 ngx_http_core_srv_conf_t *cscf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2731 |
501 | 2732 cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t)); |
2733 if (cscf == NULL) { | |
487 | 2734 return NGX_CONF_ERROR; |
2735 } | |
2736 | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
2737 /* |
487 | 2738 * set by ngx_pcalloc(): |
479 | 2739 * |
2740 * conf->client_large_buffers.num = 0; | |
2741 */ | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
2742 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2743 if (ngx_array_init(&cscf->listen, cf->temp_pool, 4, |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2744 sizeof(ngx_http_listen_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2745 != NGX_OK) |
487 | 2746 { |
2747 return NGX_CONF_ERROR; | |
2748 } | |
2749 | |
681 | 2750 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, |
593 | 2751 sizeof(ngx_http_server_name_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2752 != NGX_OK) |
487 | 2753 { |
2754 return NGX_CONF_ERROR; | |
2755 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2756 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2757 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2758 cscf->request_pool_size = NGX_CONF_UNSET_SIZE; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2759 cscf->client_header_timeout = NGX_CONF_UNSET_MSEC; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2760 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE; |
511 | 2761 cscf->ignore_invalid_headers = NGX_CONF_UNSET; |
1585 | 2762 cscf->merge_slashes = NGX_CONF_UNSET; |
2256 | 2763 cscf->underscores_in_headers = NGX_CONF_UNSET; |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2764 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2765 return cscf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2766 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2767 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2768 |
487 | 2769 static char * |
2770 ngx_http_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2771 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2772 ngx_http_core_srv_conf_t *prev = parent; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2773 ngx_http_core_srv_conf_t *conf = child; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2774 |
593 | 2775 ngx_http_listen_t *ls; |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2776 struct sockaddr_in *sin; |
593 | 2777 ngx_http_server_name_t *sn; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
2778 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
2779 /* TODO: it does not merge, it inits only */ |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2780 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2781 if (conf->listen.nelts == 0) { |
501 | 2782 ls = ngx_array_push(&conf->listen); |
2783 if (ls == NULL) { | |
487 | 2784 return NGX_CONF_ERROR; |
2785 } | |
2786 | |
523 | 2787 ngx_memzero(ls, sizeof(ngx_http_listen_t)); |
2788 | |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2789 sin = (struct sockaddr_in *) &ls->sockaddr; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2790 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2791 sin->sin_family = AF_INET; |
461 | 2792 #if (NGX_WIN32) |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2793 sin->sin_port = htons(80); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
2794 #else |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2795 sin->sin_port = htons((getuid() == 0) ? 80 : 8000); |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
2796 #endif |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
2797 sin->sin_addr.s_addr = INADDR_ANY; |
569 | 2798 |
2516
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2799 ls->socklen = sizeof(struct sockaddr_in); |
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2800 |
1377
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
1353
diff
changeset
|
2801 ls->conf.backlog = NGX_LISTEN_BACKLOG; |
569 | 2802 ls->conf.rcvbuf = -1; |
2803 ls->conf.sndbuf = -1; | |
2516
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2804 ls->conf.wildcard = 1; |
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2805 |
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2806 (void) ngx_sock_ntop((struct sockaddr *) &ls->sockaddr, ls->conf.addr, |
52ce03b3ad18
fix implicit listen, introduced in r2513
Igor Sysoev <igor@sysoev.ru>
parents:
2512
diff
changeset
|
2807 NGX_SOCKADDR_STRLEN, 1); |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2808 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2809 |
605 | 2810 if (conf->server_name.data == NULL) { |
2011 | 2811 conf->server_name = cf->cycle->hostname; |
605 | 2812 |
501 | 2813 sn = ngx_array_push(&conf->server_names); |
2814 if (sn == NULL) { | |
487 | 2815 return NGX_CONF_ERROR; |
2816 } | |
2817 | |
1580
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
2818 #if (NGX_PCRE) |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
2819 sn->regex = NULL; |
2549
2d34fba7cf06
captures support in server_name
Igor Sysoev <igor@sysoev.ru>
parents:
2548
diff
changeset
|
2820 sn->captures = 0; |
1580
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
2821 #endif |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
2822 sn->core_srv_conf = conf; |
605 | 2823 sn->name.len = conf->server_name.len; |
2824 sn->name.data = conf->server_name.data; | |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
2825 } |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
2826 |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
2827 ngx_conf_merge_size_value(conf->connection_pool_size, |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
2828 prev->connection_pool_size, 256); |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2829 ngx_conf_merge_size_value(conf->request_pool_size, |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
2830 prev->request_pool_size, 4096); |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2831 ngx_conf_merge_msec_value(conf->client_header_timeout, |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2832 prev->client_header_timeout, 60000); |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2833 ngx_conf_merge_size_value(conf->client_header_buffer_size, |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
2834 prev->client_header_buffer_size, 1024); |
436
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2835 ngx_conf_merge_bufs_value(conf->large_client_header_buffers, |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2836 prev->large_client_header_buffers, |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2837 4, ngx_pagesize); |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2838 |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2839 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2840 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2841 "the \"large_client_header_buffers\" size must be " |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2842 "equal to or bigger than \"connection_pool_size\""); |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2843 return NGX_CONF_ERROR; |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2844 } |
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
2845 |
511 | 2846 ngx_conf_merge_value(conf->ignore_invalid_headers, |
2847 prev->ignore_invalid_headers, 1); | |
2848 | |
1585 | 2849 ngx_conf_merge_value(conf->merge_slashes, prev->merge_slashes, 1); |
2850 | |
2256 | 2851 ngx_conf_merge_value(conf->underscores_in_headers, |
2852 prev->underscores_in_headers, 0); | |
2853 | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2854 return NGX_CONF_OK; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
2855 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
2856 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2857 |
487 | 2858 static void * |
2859 ngx_http_core_create_loc_conf(ngx_conf_t *cf) | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
2860 { |
485 | 2861 ngx_http_core_loc_conf_t *lcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2862 |
501 | 2863 lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t)); |
2864 if (lcf == NULL) { | |
487 | 2865 return NGX_CONF_ERROR; |
2866 } | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
2867 |
479 | 2868 /* |
2869 * set by ngx_pcalloc(): | |
2870 * | |
577 | 2871 * lcf->root = { 0, NULL }; |
631 | 2872 * lcf->limit_except = 0; |
577 | 2873 * lcf->post_action = { 0, NULL }; |
479 | 2874 * lcf->types = NULL; |
577 | 2875 * lcf->default_type = { 0, NULL }; |
479 | 2876 * lcf->err_log = NULL; |
2877 * lcf->error_pages = NULL; | |
2407 | 2878 * lcf->try_files = NULL; |
479 | 2879 * lcf->client_body_path = NULL; |
2880 * lcf->regex = NULL; | |
2881 * lcf->exact_match = 0; | |
2882 * lcf->auto_redirect = 0; | |
2883 * lcf->alias = 0; | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2884 * lcf->gzip_proxied = 0; |
479 | 2885 */ |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2886 |
663 | 2887 lcf->client_max_body_size = NGX_CONF_UNSET; |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
2888 lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2889 lcf->client_body_timeout = NGX_CONF_UNSET_MSEC; |
1809
1f8c13eb04b6
fix building by msvc introduced by r1807
Igor Sysoev <igor@sysoev.ru>
parents:
1808
diff
changeset
|
2890 lcf->satisfy = NGX_CONF_UNSET_UINT; |
2361 | 2891 lcf->if_modified_since = NGX_CONF_UNSET_UINT; |
509 | 2892 lcf->internal = NGX_CONF_UNSET; |
633 | 2893 lcf->client_body_in_file_only = NGX_CONF_UNSET; |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
2894 lcf->sendfile = NGX_CONF_UNSET; |
1197 | 2895 lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; |
2129 | 2896 lcf->directio = NGX_CONF_UNSET; |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
2897 lcf->tcp_nopush = NGX_CONF_UNSET; |
452 | 2898 lcf->tcp_nodelay = NGX_CONF_UNSET; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2899 lcf->send_timeout = NGX_CONF_UNSET_MSEC; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2900 lcf->send_lowat = NGX_CONF_UNSET_SIZE; |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
2901 lcf->postpone_output = NGX_CONF_UNSET_SIZE; |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
2902 lcf->limit_rate = NGX_CONF_UNSET_SIZE; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2903 lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC; |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
2904 lcf->keepalive_header = NGX_CONF_UNSET; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2905 lcf->lingering_time = NGX_CONF_UNSET_MSEC; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
2906 lcf->lingering_timeout = NGX_CONF_UNSET_MSEC; |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
2907 lcf->resolver_timeout = NGX_CONF_UNSET_MSEC; |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
2908 lcf->reset_timedout_connection = NGX_CONF_UNSET; |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
2909 lcf->server_name_in_redirect = NGX_CONF_UNSET; |
521 | 2910 lcf->port_in_redirect = NGX_CONF_UNSET; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
2911 lcf->msie_padding = NGX_CONF_UNSET; |
679 | 2912 lcf->msie_refresh = NGX_CONF_UNSET; |
527 | 2913 lcf->log_not_found = NGX_CONF_UNSET; |
2261 | 2914 lcf->log_subrequest = NGX_CONF_UNSET; |
679 | 2915 lcf->recursive_error_pages = NGX_CONF_UNSET; |
1592 | 2916 lcf->server_tokens = NGX_CONF_UNSET; |
589 | 2917 lcf->types_hash_max_size = NGX_CONF_UNSET_UINT; |
2918 lcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2919 |
1454 | 2920 lcf->open_file_cache = NGX_CONF_UNSET_PTR; |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
2921 lcf->open_file_cache_valid = NGX_CONF_UNSET; |
1772 | 2922 lcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT; |
1454 | 2923 lcf->open_file_cache_errors = NGX_CONF_UNSET; |
1457 | 2924 lcf->open_file_cache_events = NGX_CONF_UNSET; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
2925 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2926 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2927 lcf->gzip_vary = NGX_CONF_UNSET; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2928 lcf->gzip_http_version = NGX_CONF_UNSET_UINT; |
1800 | 2929 #if (NGX_PCRE) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2930 lcf->gzip_disable = NGX_CONF_UNSET_PTR; |
2205 | 2931 lcf->gzip_disable_msie6 = 3; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2932 #endif |
1800 | 2933 #endif |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2934 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2935 return lcf; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2936 } |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
2937 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2938 |
589 | 2939 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html"); |
2940 static ngx_str_t ngx_http_core_image_gif_type = ngx_string("image/gif"); | |
2941 static ngx_str_t ngx_http_core_image_jpeg_type = ngx_string("image/jpeg"); | |
2942 | |
2943 static ngx_hash_key_t ngx_http_core_default_types[] = { | |
2944 { ngx_string("html"), 0, &ngx_http_core_text_html_type }, | |
2945 { ngx_string("gif"), 0, &ngx_http_core_image_gif_type }, | |
2946 { ngx_string("jpg"), 0, &ngx_http_core_image_jpeg_type }, | |
2947 { ngx_null_string, 0, NULL } | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2948 }; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2949 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2950 |
487 | 2951 static char * |
589 | 2952 ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
2953 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2954 ngx_http_core_loc_conf_t *prev = parent; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2955 ngx_http_core_loc_conf_t *conf = child; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2956 |
487 | 2957 ngx_uint_t i; |
589 | 2958 ngx_hash_key_t *type; |
2959 ngx_hash_init_t types_hash; | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2960 |
603 | 2961 if (conf->root.data == NULL) { |
2962 | |
625 | 2963 conf->alias = prev->alias; |
603 | 2964 conf->root = prev->root; |
2965 conf->root_lengths = prev->root_lengths; | |
2966 conf->root_values = prev->root_values; | |
2967 | |
2968 if (prev->root.data == NULL) { | |
2969 conf->root.len = sizeof("html") - 1; | |
2970 conf->root.data = (u_char *) "html"; | |
2971 | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2972 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { |
603 | 2973 return NGX_CONF_ERROR; |
2974 } | |
2975 } | |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
2976 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
2977 |
577 | 2978 if (conf->post_action.data == NULL) { |
2979 conf->post_action = prev->post_action; | |
2980 } | |
2981 | |
663 | 2982 ngx_conf_merge_uint_value(conf->types_hash_max_size, |
2983 prev->types_hash_max_size, 1024); | |
2984 | |
2985 ngx_conf_merge_uint_value(conf->types_hash_bucket_size, | |
2986 prev->types_hash_bucket_size, | |
2987 ngx_cacheline_size); | |
589 | 2988 |
2989 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size, | |
2990 ngx_cacheline_size); | |
2991 | |
2992 /* | |
2993 * the special handling the "types" directive in the "http" section | |
2994 * to inherit the http's conf->types_hash to all servers | |
2995 */ | |
2996 | |
2997 if (prev->types && prev->types_hash.buckets == NULL) { | |
2998 | |
2999 types_hash.hash = &prev->types_hash; | |
3000 types_hash.key = ngx_hash_key_lc; | |
3001 types_hash.max_size = conf->types_hash_max_size; | |
3002 types_hash.bucket_size = conf->types_hash_bucket_size; | |
595 | 3003 types_hash.name = "types_hash"; |
589 | 3004 types_hash.pool = cf->pool; |
3005 types_hash.temp_pool = NULL; | |
3006 | |
3007 if (ngx_hash_init(&types_hash, prev->types->elts, prev->types->nelts) | |
3008 != NGX_OK) | |
3009 { | |
3010 return NGX_CONF_ERROR; | |
3011 } | |
3012 } | |
3013 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3014 if (conf->types == NULL) { |
589 | 3015 conf->types = prev->types; |
3016 conf->types_hash = prev->types_hash; | |
3017 } | |
3018 | |
3019 if (conf->types == NULL) { | |
3020 conf->types = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t)); | |
3021 if (conf->types == NULL) { | |
3022 return NGX_CONF_ERROR; | |
3023 } | |
3024 | |
3025 for (i = 0; ngx_http_core_default_types[i].key.len; i++) { | |
3026 type = ngx_array_push(conf->types); | |
3027 if (type == NULL) { | |
487 | 3028 return NGX_CONF_ERROR; |
3029 } | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3030 |
589 | 3031 type->key = ngx_http_core_default_types[i].key; |
3032 type->key_hash = | |
3033 ngx_hash_key_lc(ngx_http_core_default_types[i].key.data, | |
3034 ngx_http_core_default_types[i].key.len); | |
3035 type->value = ngx_http_core_default_types[i].value; | |
3036 } | |
3037 } | |
3038 | |
3039 if (conf->types_hash.buckets == NULL) { | |
3040 | |
3041 types_hash.hash = &conf->types_hash; | |
3042 types_hash.key = ngx_hash_key_lc; | |
3043 types_hash.max_size = conf->types_hash_max_size; | |
3044 types_hash.bucket_size = conf->types_hash_bucket_size; | |
595 | 3045 types_hash.name = "mime_types_hash"; |
589 | 3046 types_hash.pool = cf->pool; |
3047 types_hash.temp_pool = NULL; | |
3048 | |
3049 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) | |
3050 != NGX_OK) | |
3051 { | |
3052 return NGX_CONF_ERROR; | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3053 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3054 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3055 |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3056 if (conf->err_log == NULL) { |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3057 if (prev->err_log) { |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3058 conf->err_log = prev->err_log; |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3059 } else { |
318
56496082668b
nginx-0.0.3-2004-04-16-09:14:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
3060 conf->err_log = cf->cycle->new_log; |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3061 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3062 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3063 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3064 if (conf->error_pages == NULL && prev->error_pages) { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3065 conf->error_pages = prev->error_pages; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3066 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3067 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3068 ngx_conf_merge_str_value(conf->default_type, |
487 | 3069 prev->default_type, "text/plain"); |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3070 |
663 | 3071 ngx_conf_merge_off_value(conf->client_max_body_size, |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
3072 prev->client_max_body_size, 1 * 1024 * 1024); |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
3073 ngx_conf_merge_size_value(conf->client_body_buffer_size, |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
3074 prev->client_body_buffer_size, |
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
3075 (size_t) 2 * ngx_pagesize); |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
160
diff
changeset
|
3076 ngx_conf_merge_msec_value(conf->client_body_timeout, |
253
b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
3077 prev->client_body_timeout, 60000); |
509 | 3078 |
1806 | 3079 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3080 NGX_HTTP_SATISFY_ALL); | |
2361 | 3081 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
2496 | 3082 NGX_HTTP_IMS_EXACT); |
509 | 3083 ngx_conf_merge_value(conf->internal, prev->internal, 0); |
633 | 3084 ngx_conf_merge_value(conf->client_body_in_file_only, |
3085 prev->client_body_in_file_only, 0); | |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
3086 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); |
1197 | 3087 ngx_conf_merge_size_value(conf->sendfile_max_chunk, |
3088 prev->sendfile_max_chunk, 0); | |
2129 | 3089 ngx_conf_merge_off_value(conf->directio, prev->directio, |
3090 NGX_MAX_OFF_T_VALUE); | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
3091 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); |
679 | 3092 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); |
509 | 3093 |
253
b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
3094 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000); |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
3095 ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0); |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
3096 ngx_conf_merge_size_value(conf->postpone_output, prev->postpone_output, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
3097 1460); |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
3098 ngx_conf_merge_size_value(conf->limit_rate, prev->limit_rate, 0); |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3099 ngx_conf_merge_msec_value(conf->keepalive_timeout, |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
3100 prev->keepalive_timeout, 75000); |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
3101 ngx_conf_merge_sec_value(conf->keepalive_header, |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
3102 prev->keepalive_header, 0); |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3103 ngx_conf_merge_msec_value(conf->lingering_time, |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3104 prev->lingering_time, 30000); |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3105 ngx_conf_merge_msec_value(conf->lingering_timeout, |
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3106 prev->lingering_timeout, 5000); |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3107 ngx_conf_merge_msec_value(conf->resolver_timeout, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3108 prev->resolver_timeout, 30000); |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3109 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3110 if (conf->resolver == NULL) { |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3111 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3112 if (prev->resolver == NULL) { |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3113 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3114 /* |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3115 * create dummy resolver in http {} context |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3116 * to inherit it in all servers |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3117 */ |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3118 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3119 prev->resolver = ngx_resolver_create(cf, NULL); |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3120 if (prev->resolver == NULL) { |
1881 | 3121 return NGX_CONF_ERROR; |
1683
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3122 } |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3123 } |
2006
b52cb9bf2064
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1982
diff
changeset
|
3124 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3125 conf->resolver = prev->resolver; |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3126 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3127 |
479 | 3128 ngx_conf_merge_path_value(conf->client_body_temp_path, |
3129 prev->client_body_temp_path, | |
3130 NGX_HTTP_CLIENT_TEMP_PATH, 0, 0, 0, | |
3131 ngx_garbage_collector_temp_handler, cf); | |
3132 | |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
3133 ngx_conf_merge_value(conf->reset_timedout_connection, |
487 | 3134 prev->reset_timedout_connection, 0); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
3135 ngx_conf_merge_value(conf->server_name_in_redirect, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
3136 prev->server_name_in_redirect, 1); |
521 | 3137 ngx_conf_merge_value(conf->port_in_redirect, prev->port_in_redirect, 1); |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
3138 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1); |
679 | 3139 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); |
527 | 3140 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); |
2261 | 3141 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); |
679 | 3142 ngx_conf_merge_value(conf->recursive_error_pages, |
3143 prev->recursive_error_pages, 0); | |
1592 | 3144 ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1); |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
3145 |
1454 | 3146 ngx_conf_merge_ptr_value(conf->open_file_cache, |
1780 | 3147 prev->open_file_cache, NULL); |
1454 | 3148 |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
3149 ngx_conf_merge_sec_value(conf->open_file_cache_valid, |
1780 | 3150 prev->open_file_cache_valid, 60); |
1454 | 3151 |
1772 | 3152 ngx_conf_merge_uint_value(conf->open_file_cache_min_uses, |
1780 | 3153 prev->open_file_cache_min_uses, 1); |
1772 | 3154 |
1454 | 3155 ngx_conf_merge_sec_value(conf->open_file_cache_errors, |
1780 | 3156 prev->open_file_cache_errors, 0); |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
3157 |
1457 | 3158 ngx_conf_merge_sec_value(conf->open_file_cache_events, |
1780 | 3159 prev->open_file_cache_events, 0); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3160 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3161 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3162 ngx_conf_merge_value(conf->gzip_vary, prev->gzip_vary, 0); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3163 ngx_conf_merge_uint_value(conf->gzip_http_version, prev->gzip_http_version, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3164 NGX_HTTP_VERSION_11); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3165 ngx_conf_merge_bitmask_value(conf->gzip_proxied, prev->gzip_proxied, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3166 (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3167 |
1800 | 3168 #if (NGX_PCRE) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3169 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL); |
1800 | 3170 #endif |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3171 |
2205 | 3172 if (conf->gzip_disable_msie6 == 3) { |
3173 conf->gzip_disable_msie6 = | |
3174 (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6; | |
3175 } | |
3176 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3177 #endif |
1457 | 3178 |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3179 return NGX_CONF_OK; |
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3180 } |
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3181 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3182 |
487 | 3183 static char * |
3184 ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3185 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3186 ngx_http_core_srv_conf_t *scf = conf; |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3187 |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3188 ngx_str_t *value, size; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3189 ngx_url_t u; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3190 ngx_uint_t n; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3191 ngx_http_listen_t *ls; |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3192 |
425
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3193 /* |
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3194 * TODO: check duplicate 'listen' directives, |
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3195 * add resolved name to server names ??? |
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3196 */ |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
3197 |
523 | 3198 value = cf->args->elts; |
577 | 3199 |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3200 ngx_memzero(&u, sizeof(ngx_url_t)); |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3201 |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3202 u.url = value[1]; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3203 u.listen = 1; |
906 | 3204 u.default_port = 80; |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3205 |
1559
fe11e2a3946d
use pool instead of ngx_conf_t
Igor Sysoev <igor@sysoev.ru>
parents:
1546
diff
changeset
|
3206 if (ngx_parse_url(cf->pool, &u) != NGX_OK) { |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3207 if (u.err) { |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3208 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3209 "%s in \"%V\" of the \"listen\" directive", |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3210 u.err, &u.url); |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3211 } |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3212 |
577 | 3213 return NGX_CONF_ERROR; |
523 | 3214 } |
3215 | |
501 | 3216 ls = ngx_array_push(&scf->listen); |
3217 if (ls == NULL) { | |
425
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3218 return NGX_CONF_ERROR; |
bd39260a1383
nginx-0.0.10-2004-09-14-19:55:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
3219 } |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3220 |
523 | 3221 ngx_memzero(ls, sizeof(ngx_http_listen_t)); |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3222 |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3223 ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen); |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3224 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3225 ls->socklen = u.socklen; |
1489
56f1ea5baabb
u_char* is enough to keep file name
Igor Sysoev <igor@sysoev.ru>
parents:
1457
diff
changeset
|
3226 ls->file_name = cf->conf_file->file.name.data; |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3227 ls->line = cf->conf_file->line; |
1377
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
1353
diff
changeset
|
3228 ls->conf.backlog = NGX_LISTEN_BACKLOG; |
563 | 3229 ls->conf.rcvbuf = -1; |
3230 ls->conf.sndbuf = -1; | |
2512
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3231 ls->conf.wildcard = u.wildcard; |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3232 |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3233 (void) ngx_sock_ntop((struct sockaddr *) &ls->sockaddr, ls->conf.addr, |
2e91aecb9e57
a prelimiary IPv6 support, HTTP listen
Igor Sysoev <igor@sysoev.ru>
parents:
2503
diff
changeset
|
3234 NGX_SOCKADDR_STRLEN, 1); |
631 | 3235 |
523 | 3236 if (cf->args->nelts == 2) { |
3237 return NGX_CONF_OK; | |
3238 } | |
3239 | |
3240 if (ngx_strcmp(value[2].data, "default") == 0) { | |
3241 ls->conf.default_server = 1; | |
3242 n = 3; | |
589 | 3243 |
523 | 3244 } else { |
3245 n = 2; | |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
3246 } |
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
3247 |
523 | 3248 for ( /* void */ ; n < cf->args->nelts; n++) { |
3249 | |
3250 if (ls->conf.default_server == 0) { | |
3251 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3252 "\"%V\" parameter can be specified for " | |
3253 "the default \"listen\" directive only", | |
3254 &value[n]); | |
3255 return NGX_CONF_ERROR; | |
3256 } | |
3257 | |
3258 if (ngx_strcmp(value[n].data, "bind") == 0) { | |
3259 ls->conf.bind = 1; | |
3260 continue; | |
3261 } | |
3262 | |
563 | 3263 if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) { |
3264 ls->conf.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8); | |
523 | 3265 ls->conf.bind = 1; |
3266 | |
3267 if (ls->conf.backlog == NGX_ERROR || ls->conf.backlog == 0) { | |
3268 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3269 "invalid backlog \"%V\"", &value[n]); | |
3270 return NGX_CONF_ERROR; | |
3271 } | |
3272 | |
3273 continue; | |
3274 } | |
3275 | |
563 | 3276 if (ngx_strncmp(value[n].data, "rcvbuf=", 7) == 0) { |
3277 size.len = value[n].len - 7; | |
3278 size.data = value[n].data + 7; | |
3279 | |
3280 ls->conf.rcvbuf = ngx_parse_size(&size); | |
3281 ls->conf.bind = 1; | |
3282 | |
3283 if (ls->conf.rcvbuf == NGX_ERROR) { | |
3284 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3285 "invalid rcvbuf \"%V\"", &value[n]); | |
3286 return NGX_CONF_ERROR; | |
3287 } | |
3288 | |
3289 continue; | |
3290 } | |
3291 | |
3292 if (ngx_strncmp(value[n].data, "sndbuf=", 7) == 0) { | |
3293 size.len = value[n].len - 7; | |
3294 size.data = value[n].data + 7; | |
3295 | |
3296 ls->conf.sndbuf = ngx_parse_size(&size); | |
3297 ls->conf.bind = 1; | |
3298 | |
3299 if (ls->conf.sndbuf == NGX_ERROR) { | |
3300 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3301 "invalid sndbuf \"%V\"", &value[n]); | |
3302 return NGX_CONF_ERROR; | |
3303 } | |
3304 | |
3305 continue; | |
3306 } | |
3307 | |
3308 if (ngx_strncmp(value[n].data, "accept_filter=", 14) == 0) { | |
523 | 3309 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) |
563 | 3310 ls->conf.accept_filter = (char *) &value[n].data[14]; |
523 | 3311 ls->conf.bind = 1; |
3312 #else | |
3313 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3314 "accept filters \"%V\" are not supported " | |
3315 "on this platform, ignored", | |
3316 &value[n]); | |
3317 #endif | |
3318 continue; | |
3319 } | |
3320 | |
3321 if (ngx_strcmp(value[n].data, "deferred") == 0) { | |
3322 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT) | |
3323 ls->conf.deferred_accept = 1; | |
3324 ls->conf.bind = 1; | |
3325 #else | |
3326 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3327 "the deferred accept is not supported " | |
3328 "on this platform, ignored"); | |
3329 #endif | |
3330 continue; | |
3331 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3332 |
2562 | 3333 if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) { |
3334 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) | |
3335 struct sockaddr *sa; | |
3336 | |
3337 sa = (struct sockaddr *) ls->sockaddr; | |
3338 | |
3339 if (sa->sa_family == AF_INET6) { | |
3340 | |
3341 if (ngx_strcmp(&value[n].data[10], "n") == 0) { | |
3342 ls->conf.ipv6only = 1; | |
3343 | |
3344 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) { | |
3345 ls->conf.ipv6only = 2; | |
3346 | |
3347 } else { | |
3348 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3349 "invalid ipv6only flags \"%s\"", | |
3350 &value[n].data[9]); | |
3351 return NGX_CONF_ERROR; | |
3352 } | |
3353 | |
3354 ls->conf.bind = 1; | |
3355 | |
3356 } else { | |
3357 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3358 "ipv6only is not supported " | |
3359 "on addr \"%s\", ignored", | |
3360 ls->conf.addr); | |
3361 } | |
3362 | |
3363 continue; | |
3364 #else | |
3365 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3366 "bind ipv6only is not supported " | |
3367 "on this platform"); | |
3368 return NGX_CONF_ERROR; | |
3369 #endif | |
3370 } | |
3371 | |
2224 | 3372 if (ngx_strcmp(value[n].data, "ssl") == 0) { |
3373 #if (NGX_HTTP_SSL) | |
3374 ls->conf.ssl = 1; | |
3375 continue; | |
3376 #else | |
3377 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3378 "the \"ssl\" parameter requires " | |
3379 "ngx_http_ssl_module"); | |
3380 return NGX_CONF_ERROR; | |
3381 #endif | |
3382 } | |
3383 | |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
3384 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
523 | 3385 "the invalid \"%V\" parameter", &value[n]); |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
3386 return NGX_CONF_ERROR; |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3387 } |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3388 |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3389 return NGX_CONF_OK; |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3390 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3391 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3392 |
487 | 3393 static char * |
3394 ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3395 { |
593 | 3396 ngx_http_core_srv_conf_t *cscf = conf; |
3397 | |
3398 u_char ch; | |
3399 ngx_str_t *value, name; | |
3400 ngx_uint_t i; | |
3401 ngx_http_server_name_t *sn; | |
369
9c2515d70489
nginx-0.0.7-2004-06-25-18:42:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
3402 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3403 value = cf->args->elts; |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3404 |
593 | 3405 ch = value[1].data[0]; |
3406 | |
2195 | 3407 if (cscf->server_name.data == NULL) { |
3408 if (value[1].len) { | |
3409 name = value[1]; | |
3410 | |
3411 if (ch == '.') { | |
3412 name.len--; | |
3413 name.data++; | |
3414 } | |
3415 | |
3416 cscf->server_name.len = name.len; | |
3417 cscf->server_name.data = ngx_pstrdup(cf->pool, &name); | |
3418 if (cscf->server_name.data == NULL) { | |
3419 return NGX_CONF_ERROR; | |
3420 } | |
3421 | |
3422 } else { | |
3423 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3424 "the first server name must not be empty"); | |
593 | 3425 return NGX_CONF_ERROR; |
3426 } | |
3427 } | |
3428 | |
3429 for (i = 1; i < cf->args->nelts; i++) { | |
3430 | |
3431 ch = value[i].data[0]; | |
3432 | |
2195 | 3433 if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.')) |
593 | 3434 || (ch == '.' && value[i].len < 2)) |
3435 { | |
3436 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3437 "server name \"%V\" is invalid", &value[i]); | |
3438 return NGX_CONF_ERROR; | |
3439 } | |
3440 | |
1157 | 3441 if (ngx_strchr(value[i].data, '/')) { |
3442 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
3443 "server name \"%V\" has strange symbols", | |
3444 &value[i]); | |
3445 } | |
3446 | |
1808 | 3447 if (value[i].len == 1 && ch == '*') { |
3448 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3449 "\"server_name *\" is unsupported, use " | |
3450 "\"server_name_in_redirect off\" instead"); | |
3451 return NGX_CONF_ERROR; | |
3452 } | |
3453 | |
593 | 3454 sn = ngx_array_push(&cscf->server_names); |
501 | 3455 if (sn == NULL) { |
455 | 3456 return NGX_CONF_ERROR; |
3457 } | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3458 |
1387 | 3459 #if (NGX_PCRE) |
3460 sn->regex = NULL; | |
2549
2d34fba7cf06
captures support in server_name
Igor Sysoev <igor@sysoev.ru>
parents:
2548
diff
changeset
|
3461 sn->captures = 0; |
1387 | 3462 #endif |
3463 sn->core_srv_conf = cscf; | |
1781 | 3464 sn->name = value[i]; |
1387 | 3465 |
3466 if (value[i].data[0] != '~') { | |
3467 continue; | |
3468 } | |
3469 | |
3470 #if (NGX_PCRE) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3471 { |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3472 ngx_str_t err; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3473 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3474 |
1387 | 3475 err.len = NGX_MAX_CONF_ERRSTR; |
3476 err.data = errstr; | |
3477 | |
3478 value[i].len--; | |
3479 value[i].data++; | |
3480 | |
2007
b9de93d804ea
*) host in request line has priority
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
3481 sn->regex = ngx_regex_compile(&value[i], 0, cf->pool, &err); |
1387 | 3482 |
3483 if (sn->regex == NULL) { | |
3484 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); | |
3485 return NGX_CONF_ERROR; | |
3486 } | |
3487 | |
2549
2d34fba7cf06
captures support in server_name
Igor Sysoev <igor@sysoev.ru>
parents:
2548
diff
changeset
|
3488 sn->captures = (ngx_regex_capture_count(sn->regex) > 0); |
1781 | 3489 sn->name = value[i]; |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3490 } |
1387 | 3491 #else |
3492 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3493 "the using of the regex \"%V\" " | |
3494 "requires PCRE library", &value[i]); | |
3495 | |
3496 return NGX_CONF_ERROR; | |
3497 #endif | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3498 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3499 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3500 return NGX_CONF_OK; |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3501 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
3502 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
3503 |
487 | 3504 static char * |
3505 ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3506 { |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3507 ngx_http_core_loc_conf_t *lcf = conf; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3508 |
595 | 3509 ngx_str_t *value; |
3510 ngx_uint_t alias, n; | |
3511 ngx_http_script_compile_t sc; | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3512 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3513 alias = (cmd->name.len == sizeof("alias") - 1) ? 1 : 0; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3514 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3515 if (lcf->root.data) { |
300
502b03d9d2a3
nginx-0.0.3-2004-03-31-00:31:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
3516 |
502b03d9d2a3
nginx-0.0.3-2004-03-31-00:31:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
3517 /* the (ngx_uint_t) cast is required by gcc 2.7.2.3 */ |
502b03d9d2a3
nginx-0.0.3-2004-03-31-00:31:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
3518 |
502b03d9d2a3
nginx-0.0.3-2004-03-31-00:31:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
3519 if ((ngx_uint_t) lcf->alias == alias) { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3520 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3521 "\"%V\" directive is duplicate", |
3522 &cmd->name); | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3523 } else { |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3524 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3525 "\"%V\" directive is duplicate, " |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3526 "\"%s\" directive is specified before", |
461 | 3527 &cmd->name, lcf->alias ? "alias" : "root"); |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3528 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3529 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3530 return NGX_CONF_ERROR; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3531 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3532 |
1353 | 3533 if (lcf->named && alias) { |
3534 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3535 "the \"alias\" directive may not be used " | |
3536 "inside named location"); | |
3537 | |
3538 return NGX_CONF_ERROR; | |
3539 } | |
3540 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3541 value = cf->args->elts; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3542 |
1156 | 3543 if (ngx_strstr(value[1].data, "$document_root") |
3544 || ngx_strstr(value[1].data, "${document_root}")) | |
1155
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3545 { |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3546 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3547 "the $document_root variable may not be used " |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3548 "in the \"%V\" directive", |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3549 &cmd->name); |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3550 |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3551 return NGX_CONF_ERROR; |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3552 } |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3553 |
2263
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3554 if (ngx_strstr(value[1].data, "$realpath_root") |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3555 || ngx_strstr(value[1].data, "${realpath_root}")) |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3556 { |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3557 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3558 "the $realpath_root variable may not be used " |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3559 "in the \"%V\" directive", |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3560 &cmd->name); |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3561 |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3562 return NGX_CONF_ERROR; |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3563 } |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3564 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3565 lcf->alias = alias; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3566 lcf->root = value[1]; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3567 |
411
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
3568 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') { |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
3569 lcf->root.len--; |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
3570 } |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
3571 |
667 | 3572 if (lcf->root.data[0] != '$') { |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3573 if (ngx_conf_full_name(cf->cycle, &lcf->root, 0) != NGX_OK) { |
667 | 3574 return NGX_CONF_ERROR; |
3575 } | |
603 | 3576 } |
3577 | |
3578 n = ngx_http_script_variables_count(&lcf->root); | |
595 | 3579 |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3580 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3581 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3582 if (n) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3583 sc.cf = cf; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3584 sc.source = &lcf->root; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3585 sc.lengths = &lcf->root_lengths; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3586 sc.values = &lcf->root_values; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3587 sc.variables = n; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3588 sc.complete_lengths = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3589 sc.complete_values = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3590 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3591 if (ngx_http_script_compile(&sc) != NGX_OK) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3592 return NGX_CONF_ERROR; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3593 } |
595 | 3594 } |
3595 | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3596 #if (NGX_PCRE) |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3597 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3598 if (alias && lcf->regex |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3599 && (ngx_regex_capture_count(lcf->regex) <= 0 || sc.ncaptures == 0)) |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3600 { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3601 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3602 "the \"alias\" directive must use captures " |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3603 "inside location given by regular expression"); |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3604 |
595 | 3605 return NGX_CONF_ERROR; |
3606 } | |
3607 | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3608 #endif |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
3609 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3610 return NGX_CONF_OK; |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3611 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3612 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3613 |
631 | 3614 static ngx_http_method_name_t ngx_methods_names[] = { |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3615 { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3616 { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3617 { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3618 { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3619 { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3620 { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3621 { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3622 { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3623 { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3624 { (u_char *) "PROPFIND" , (uint32_t) ~NGX_HTTP_PROPFIND }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3625 { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3626 { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
3627 { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, |
631 | 3628 { NULL, 0 } |
3629 }; | |
3630 | |
3631 | |
3632 static char * | |
3633 ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
3634 { | |
2027 | 3635 ngx_http_core_loc_conf_t *pclcf = conf; |
631 | 3636 |
3637 char *rv; | |
3638 void *mconf; | |
3639 ngx_str_t *value; | |
3640 ngx_uint_t i; | |
3641 ngx_conf_t save; | |
3642 ngx_http_module_t *module; | |
3643 ngx_http_conf_ctx_t *ctx, *pctx; | |
3644 ngx_http_method_name_t *name; | |
2027 | 3645 ngx_http_core_loc_conf_t *clcf; |
3646 | |
3647 if (pclcf->limit_except) { | |
631 | 3648 return "duplicate"; |
3649 } | |
3650 | |
2027 | 3651 pclcf->limit_except = 0xffffffff; |
631 | 3652 |
3653 value = cf->args->elts; | |
3654 | |
3655 for (i = 1; i < cf->args->nelts; i++) { | |
3656 for (name = ngx_methods_names; name->name; name++) { | |
3657 | |
3658 if (ngx_strcasecmp(value[i].data, name->name) == 0) { | |
2027 | 3659 pclcf->limit_except &= name->method; |
631 | 3660 goto next; |
3661 } | |
3662 } | |
3663 | |
3664 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3665 "invalid method \"%V\"", &value[i]); | |
3666 return NGX_CONF_ERROR; | |
3667 | |
3668 next: | |
3669 continue; | |
3670 } | |
3671 | |
2027 | 3672 if (!(pclcf->limit_except & NGX_HTTP_GET)) { |
3673 pclcf->limit_except &= (uint32_t) ~NGX_HTTP_HEAD; | |
631 | 3674 } |
3675 | |
3676 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); | |
3677 if (ctx == NULL) { | |
3678 return NGX_CONF_ERROR; | |
3679 } | |
3680 | |
3681 pctx = cf->ctx; | |
3682 ctx->main_conf = pctx->main_conf; | |
3683 ctx->srv_conf = pctx->srv_conf; | |
3684 | |
3685 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | |
3686 if (ctx->loc_conf == NULL) { | |
3687 return NGX_CONF_ERROR; | |
3688 } | |
3689 | |
3690 for (i = 0; ngx_modules[i]; i++) { | |
3691 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { | |
3692 continue; | |
3693 } | |
3694 | |
3695 module = ngx_modules[i]->ctx; | |
3696 | |
3697 if (module->create_loc_conf) { | |
3698 | |
3699 mconf = module->create_loc_conf(cf); | |
3700 if (mconf == NULL) { | |
3701 return NGX_CONF_ERROR; | |
3702 } | |
3703 | |
3704 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; | |
3705 } | |
3706 } | |
3707 | |
3708 | |
2027 | 3709 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |
3710 pclcf->limit_except_loc_conf = ctx->loc_conf; | |
3711 clcf->loc_conf = ctx->loc_conf; | |
3712 clcf->name = pclcf->name; | |
3713 clcf->noname = 1; | |
3714 | |
3715 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { | |
631 | 3716 return NGX_CONF_ERROR; |
3717 } | |
3718 | |
3719 save = *cf; | |
3720 cf->ctx = ctx; | |
3721 cf->cmd_type = NGX_HTTP_LMT_CONF; | |
3722 | |
3723 rv = ngx_conf_parse(cf, NULL); | |
3724 | |
3725 *cf = save; | |
3726 | |
3727 return rv; | |
3728 } | |
3729 | |
3730 | |
487 | 3731 static char * |
2129 | 3732 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3733 { | |
3734 ngx_http_core_loc_conf_t *clcf = conf; | |
3735 | |
3736 ngx_str_t *value; | |
3737 | |
3738 if (clcf->directio != NGX_CONF_UNSET) { | |
3739 return "is duplicate"; | |
3740 } | |
3741 | |
3742 value = cf->args->elts; | |
3743 | |
3744 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2277 | 3745 clcf->directio = NGX_OPEN_FILE_DIRECTIO_OFF; |
2129 | 3746 return NGX_CONF_OK; |
3747 } | |
3748 | |
3749 clcf->directio = ngx_parse_offset(&value[1]); | |
3750 if (clcf->directio == (off_t) NGX_ERROR) { | |
3751 return "invalid value"; | |
3752 } | |
3753 | |
3754 return NGX_CONF_OK; | |
3755 } | |
3756 | |
3757 | |
3758 static char * | |
487 | 3759 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3760 { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3761 ngx_http_core_loc_conf_t *lcf = conf; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3762 |
1982
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3763 u_char *args; |
673 | 3764 ngx_int_t overwrite; |
3765 ngx_str_t *value, uri; | |
3766 ngx_uint_t i, n, nvar; | |
3767 ngx_array_t *uri_lengths, *uri_values; | |
3768 ngx_http_err_page_t *err; | |
3769 ngx_http_script_compile_t sc; | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3770 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3771 if (lcf->error_pages == NULL) { |
487 | 3772 lcf->error_pages = ngx_array_create(cf->pool, 4, |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3773 sizeof(ngx_http_err_page_t)); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3774 if (lcf->error_pages == NULL) { |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3775 return NGX_CONF_ERROR; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3776 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3777 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3778 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3779 value = cf->args->elts; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3780 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3781 i = cf->args->nelts - 2; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3782 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3783 if (value[i].data[0] == '=') { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3784 if (i == 1) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3785 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3786 "invalid value \"%V\"", &value[i]); |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3787 return NGX_CONF_ERROR; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3788 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3789 |
555 | 3790 if (value[i].len > 1) { |
3791 overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1); | |
3792 | |
3793 if (overwrite == NGX_ERROR) { | |
3794 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3795 "invalid value \"%V\"", &value[i]); | |
3796 return NGX_CONF_ERROR; | |
3797 } | |
3798 | |
3799 } else { | |
3800 overwrite = 0; | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3801 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3802 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3803 n = 2; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3804 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3805 } else { |
555 | 3806 overwrite = -1; |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3807 n = 1; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3808 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3809 |
673 | 3810 uri = value[cf->args->nelts - 1]; |
3811 uri_lengths = NULL; | |
3812 uri_values = NULL; | |
3813 | |
3814 nvar = ngx_http_script_variables_count(&uri); | |
3815 | |
3816 if (nvar) { | |
3817 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
3818 | |
3819 sc.cf = cf; | |
3820 sc.source = &uri; | |
3821 sc.lengths = &uri_lengths; | |
3822 sc.values = &uri_values; | |
3823 sc.variables = nvar; | |
3824 sc.complete_lengths = 1; | |
3825 sc.complete_values = 1; | |
3826 | |
3827 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
3828 return NGX_CONF_ERROR; | |
3829 } | |
3830 } | |
3831 | |
1982
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3832 args = (u_char *) ngx_strchr(uri.data, '?'); |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3833 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3834 for (i = 1; i < cf->args->nelts - n; i++) { |
501 | 3835 err = ngx_array_push(lcf->error_pages); |
3836 if (err == NULL) { | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3837 return NGX_CONF_ERROR; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3838 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
3839 |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
3840 err->status = ngx_atoi(value[i].data, value[i].len); |
487 | 3841 |
715 | 3842 if (err->status == NGX_ERROR || err->status == 499) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3843 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3844 "invalid value \"%V\"", &value[i]); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3845 return NGX_CONF_ERROR; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3846 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3847 |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
3848 if (err->status < 400 || err->status > 599) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3849 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3850 "value \"%V\" must be between 400 and 599", |
3851 &value[i]); | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3852 return NGX_CONF_ERROR; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3853 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3854 |
1923
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3855 if (overwrite >= 0) { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3856 err->overwrite = overwrite; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3857 |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3858 } else { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3859 switch (err->status) { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3860 case NGX_HTTP_TO_HTTPS: |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3861 case NGX_HTTPS_CERT_ERROR: |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3862 case NGX_HTTPS_NO_CERT: |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3863 err->overwrite = NGX_HTTP_BAD_REQUEST; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3864 break; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3865 |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3866 default: |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3867 err->overwrite = err->status; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3868 break; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3869 } |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
3870 } |
555 | 3871 |
1982
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3872 if (args) { |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3873 err->uri.len = args - uri.data; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3874 err->uri.data = uri.data; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3875 args++; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3876 err->args.len = (uri.data + uri.len) - args; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3877 err->args.data = args; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3878 |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3879 } else { |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3880 err->uri = uri; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3881 err->args.len = 0; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3882 err->args.data = NULL; |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3883 } |
dd388c80f5a2
args support in static error_page
Igor Sysoev <igor@sysoev.ru>
parents:
1957
diff
changeset
|
3884 |
673 | 3885 err->uri_lengths = uri_lengths; |
3886 err->uri_values = uri_values; | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3887 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3888 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3889 return NGX_CONF_OK; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3890 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3891 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3892 |
487 | 3893 static char * |
2407 | 3894 ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3895 { | |
3896 ngx_http_core_loc_conf_t *clcf = conf; | |
3897 | |
3898 ngx_str_t *value; | |
3899 ngx_uint_t i, n; | |
3900 ngx_http_try_file_t *tf; | |
3901 ngx_http_script_compile_t sc; | |
3902 ngx_http_core_main_conf_t *cmcf; | |
3903 | |
3904 if (clcf->try_files) { | |
3905 return "is duplicate"; | |
3906 } | |
3907 | |
3908 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | |
3909 | |
3910 cmcf->try_files = 1; | |
3911 | |
3912 tf = ngx_pcalloc(cf->pool, cf->args->nelts * sizeof(ngx_http_try_file_t)); | |
3913 if (tf == NULL) { | |
3914 return NGX_CONF_ERROR; | |
3915 } | |
3916 | |
3917 clcf->try_files = tf; | |
3918 | |
3919 value = cf->args->elts; | |
3920 | |
3921 for (i = 0; i < cf->args->nelts - 1; i++) { | |
3922 | |
3923 tf[i].name = value[i + 1]; | |
3924 | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
3925 if (tf[i].name.data[tf[i].name.len - 1] == '/') { |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
3926 tf[i].test_dir = 1; |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
3927 tf[i].name.len--; |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
3928 } |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
3929 |
2407 | 3930 n = ngx_http_script_variables_count(&tf[i].name); |
3931 | |
3932 if (n) { | |
3933 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
3934 | |
3935 sc.cf = cf; | |
3936 sc.source = &tf[i].name; | |
3937 sc.lengths = &tf[i].lengths; | |
3938 sc.values = &tf[i].values; | |
3939 sc.variables = n; | |
3940 sc.complete_lengths = 1; | |
3941 sc.complete_values = 1; | |
3942 | |
3943 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
3944 return NGX_CONF_ERROR; | |
3945 } | |
3946 | |
3947 } else { | |
3948 /* add trailing '\0' to length */ | |
3949 tf[i].name.len++; | |
3950 } | |
3951 } | |
3952 | |
3953 return NGX_CONF_OK; | |
3954 } | |
3955 | |
3956 | |
3957 static char * | |
1454 | 3958 ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3959 { | |
3960 ngx_http_core_loc_conf_t *lcf = conf; | |
3961 | |
3962 time_t inactive; | |
3963 ngx_str_t *value, s; | |
3964 ngx_int_t max; | |
3965 ngx_uint_t i; | |
3966 | |
3967 if (lcf->open_file_cache != NGX_CONF_UNSET_PTR) { | |
3968 return "is duplicate"; | |
3969 } | |
3970 | |
3971 value = cf->args->elts; | |
3972 | |
3973 max = 0; | |
3974 inactive = 60; | |
3975 | |
3976 for (i = 1; i < cf->args->nelts; i++) { | |
3977 | |
3978 if (ngx_strncmp(value[i].data, "max=", 4) == 0) { | |
3979 | |
3980 max = ngx_atoi(value[i].data + 4, value[i].len - 4); | |
3981 if (max == NGX_ERROR) { | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
3982 goto failed; |
1454 | 3983 } |
3984 | |
3985 continue; | |
3986 } | |
3987 | |
3988 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) { | |
3989 | |
3990 s.len = value[i].len - 9; | |
3991 s.data = value[i].data + 9; | |
3992 | |
3993 inactive = ngx_parse_time(&s, 1); | |
3994 if (inactive < 0) { | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
3995 goto failed; |
1454 | 3996 } |
3997 | |
3998 continue; | |
3999 } | |
4000 | |
4001 if (ngx_strcmp(value[i].data, "off") == 0) { | |
4002 | |
4003 lcf->open_file_cache = NULL; | |
4004 | |
4005 continue; | |
4006 } | |
4007 | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4008 failed: |
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4009 |
1454 | 4010 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4011 "invalid \"open_file_cache\" parameter \"%V\"", | |
4012 &value[i]); | |
4013 return NGX_CONF_ERROR; | |
4014 } | |
4015 | |
4016 if (lcf->open_file_cache == NULL) { | |
4017 return NGX_CONF_OK; | |
4018 } | |
4019 | |
4020 if (max == 0) { | |
4021 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4022 "\"open_file_cache\" must have \"max\" parameter"); | |
4023 return NGX_CONF_ERROR; | |
4024 } | |
4025 | |
4026 lcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); | |
4027 if (lcf->open_file_cache) { | |
4028 return NGX_CONF_OK; | |
4029 } | |
4030 | |
4031 return NGX_CONF_ERROR; | |
4032 } | |
4033 | |
4034 | |
4035 static char * | |
509 | 4036 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4037 { | |
4038 ngx_http_core_loc_conf_t *lcf = conf; | |
4039 | |
4040 lcf->err_log = ngx_log_create_errlog(cf->cycle, cf->args); | |
4041 if (lcf->err_log == NULL) { | |
4042 return NGX_CONF_ERROR; | |
4043 } | |
4044 | |
4045 return ngx_set_error_log_levels(cf, lcf->err_log); | |
4046 } | |
4047 | |
4048 | |
4049 static char * | |
487 | 4050 ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4051 { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4052 ngx_http_core_loc_conf_t *lcf = conf; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4053 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4054 ngx_str_t *value; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4055 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4056 if (lcf->keepalive_timeout != NGX_CONF_UNSET_MSEC) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4057 return "is duplicate"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4058 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4059 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4060 value = cf->args->elts; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4061 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4062 lcf->keepalive_timeout = ngx_parse_time(&value[1], 0); |
487 | 4063 |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4064 if (lcf->keepalive_timeout == (ngx_msec_t) NGX_ERROR) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4065 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4066 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4067 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4068 if (lcf->keepalive_timeout == (ngx_msec_t) NGX_PARSE_LARGE_TIME) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4069 return "value must be less than 597 hours"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4070 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4071 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4072 if (cf->args->nelts == 2) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4073 return NGX_CONF_OK; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4074 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4075 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4076 lcf->keepalive_header = ngx_parse_time(&value[2], 1); |
487 | 4077 |
429
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4078 if (lcf->keepalive_header == NGX_ERROR) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4079 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4080 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4081 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4082 if (lcf->keepalive_header == NGX_PARSE_LARGE_TIME) { |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4083 return "value must be less than 68 years"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4084 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4085 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4086 return NGX_CONF_OK; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4087 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4088 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4089 |
487 | 4090 static char * |
509 | 4091 ngx_http_core_internal(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4092 { |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4093 ngx_http_core_loc_conf_t *lcf = conf; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4094 |
509 | 4095 if (lcf->internal != NGX_CONF_UNSET) { |
4096 return "is duplicate"; | |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
4097 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4098 |
509 | 4099 lcf->internal = 1; |
4100 | |
4101 return NGX_CONF_OK; | |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4102 } |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4103 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4104 |
487 | 4105 static char * |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4106 ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4107 { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4108 ngx_http_core_loc_conf_t *clcf = conf; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4109 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4110 ngx_url_t u; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4111 ngx_str_t *value; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4112 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4113 if (clcf->resolver) { |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4114 return "is duplicate"; |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4115 } |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4116 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4117 value = cf->args->elts; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4118 |
1675 | 4119 ngx_memzero(&u, sizeof(ngx_url_t)); |
4120 | |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4121 u.host = value[1]; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4122 u.port = 53; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4123 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4124 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4125 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err); |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4126 return NGX_CONF_ERROR; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4127 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4128 |
1913
c0f873458e2b
use cf->cycle->new_log because at merge stage cf->pool->log is old log
Igor Sysoev <igor@sysoev.ru>
parents:
1906
diff
changeset
|
4129 clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]); |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4130 if (clcf->resolver == NULL) { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4131 return NGX_OK; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4132 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4133 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4134 return NGX_CONF_OK; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4135 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4136 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4137 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4138 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4139 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4140 static char * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4141 ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4142 { |
2205 | 4143 ngx_http_core_loc_conf_t *clcf = conf; |
4144 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4145 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4146 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4147 ngx_str_t err, *value; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4148 ngx_uint_t i; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4149 ngx_regex_elt_t *re; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4150 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4151 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4152 if (clcf->gzip_disable == NGX_CONF_UNSET_PTR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4153 clcf->gzip_disable = ngx_array_create(cf->pool, 2, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4154 sizeof(ngx_regex_elt_t)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4155 if (clcf->gzip_disable == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4156 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4157 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4158 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4159 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4160 value = cf->args->elts; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4161 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4162 err.len = NGX_MAX_CONF_ERRSTR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4163 err.data = errstr; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4164 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4165 for (i = 1; i < cf->args->nelts; i++) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4166 |
2205 | 4167 if (ngx_strcmp(value[1].data, "msie6") == 0) { |
4168 clcf->gzip_disable_msie6 = 1; | |
4169 continue; | |
4170 } | |
4171 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4172 re = ngx_array_push(clcf->gzip_disable); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4173 if (re == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4174 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4175 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4176 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4177 re->regex = ngx_regex_compile(&value[i], NGX_REGEX_CASELESS, cf->pool, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4178 &err); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4179 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4180 if (re->regex == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4181 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4182 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4183 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4184 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4185 re->name = value[i].data; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4186 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4187 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4188 return NGX_CONF_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4189 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4190 #else |
2205 | 4191 ngx_str_t *value; |
4192 | |
4193 value = cf->args->elts; | |
4194 | |
4195 if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "msie6") == 0) { | |
4196 clcf->gzip_disable_msie6 = 1; | |
4197 return NGX_CONF_OK; | |
4198 } | |
4199 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4200 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2205 | 4201 "without PCRE library \"gzip_disable\" supports " |
4202 "builtin \"msie6\" mask only"); | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4203 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4204 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4205 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4206 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4207 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4208 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4209 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4210 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4211 static char * |
487 | 4212 ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data) |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4213 { |
473 | 4214 #if (NGX_FREEBSD) |
452 | 4215 ssize_t *np = data; |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4216 |
673 | 4217 if ((u_long) *np >= ngx_freebsd_net_inet_tcp_sendspace) { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4218 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4219 "\"send_lowat\" must be less than %d " |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4220 "(sysctl net.inet.tcp.sendspace)", |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4221 ngx_freebsd_net_inet_tcp_sendspace); |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4222 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4223 return NGX_CONF_ERROR; |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4224 } |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4225 |
469 | 4226 #elif !(NGX_HAVE_SO_SNDLOWAT) |
473 | 4227 ssize_t *np = data; |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4228 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4229 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4230 "\"send_lowat\" is not supported, ignored"); |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4231 |
452 | 4232 *np = 0; |
4233 | |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4234 #endif |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4235 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4236 return NGX_CONF_OK; |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4237 } |
1200 | 4238 |
4239 | |
4240 static char * | |
4241 ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data) | |
4242 { | |
4243 size_t *sp = data; | |
4244 | |
4245 if (*sp < NGX_MIN_POOL_SIZE) { | |
4246 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4247 "pool must be no less than %uz", NGX_MIN_POOL_SIZE); | |
4248 | |
4249 return NGX_CONF_ERROR; | |
4250 } | |
4251 | |
4252 return NGX_CONF_OK; | |
4253 } |