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