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