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