Mercurial > hg > nginx-quic
annotate src/http/ngx_http_core_module.c @ 4439:5c97978d2717 stable-1.0
Merge of r4379: duplicate words removed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 05 Feb 2012 15:34:20 +0000 |
parents | 2d235c76c59e |
children | 4919fb357a5d |
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 | |
4429 | 1292 of.read_ahead = clcf->read_ahead; |
2407 | 1293 of.directio = clcf->directio; |
1294 of.valid = clcf->open_file_cache_valid; | |
1295 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
|
1296 of.test_only = 1; |
2407 | 1297 of.errors = clcf->open_file_cache_errors; |
1298 of.events = clcf->open_file_cache_events; | |
1299 | |
1300 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) | |
1301 != NGX_OK) | |
1302 { | |
3160
a7637c2c1157
low ENAMETOOLONG logging level
Igor Sysoev <igor@sysoev.ru>
parents:
3122
diff
changeset
|
1303 if (of.err != NGX_ENOENT |
a7637c2c1157
low ENAMETOOLONG logging level
Igor Sysoev <igor@sysoev.ru>
parents:
3122
diff
changeset
|
1304 && of.err != NGX_ENOTDIR |
a7637c2c1157
low ENAMETOOLONG logging level
Igor Sysoev <igor@sysoev.ru>
parents:
3122
diff
changeset
|
1305 && of.err != NGX_ENAMETOOLONG) |
a7637c2c1157
low ENAMETOOLONG logging level
Igor Sysoev <igor@sysoev.ru>
parents:
3122
diff
changeset
|
1306 { |
2407 | 1307 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
|
1308 "%s \"%s\" failed", of.failed, path.data); |
2407 | 1309 } |
1310 | |
1311 continue; | |
1312 } | |
1313 | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
1314 if (of.is_dir && !test_dir) { |
2453
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1315 continue; |
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1316 } |
1e53534e6800
try_files should work with files only
Igor Sysoev <igor@sysoev.ru>
parents:
2436
diff
changeset
|
1317 |
2407 | 1318 path.len -= root; |
1319 path.data += root; | |
1320 | |
1321 if (!alias) { | |
1322 r->uri = path; | |
1323 | |
3533
bb5376f3f585
do not add tested file to a location regex string,
Igor Sysoev <igor@sysoev.ru>
parents:
3532
diff
changeset
|
1324 #if (NGX_PCRE) |
bb5376f3f585
do not add tested file to a location regex string,
Igor Sysoev <igor@sysoev.ru>
parents:
3532
diff
changeset
|
1325 } else if (clcf->regex) { |
bb5376f3f585
do not add tested file to a location regex string,
Igor Sysoev <igor@sysoev.ru>
parents:
3532
diff
changeset
|
1326 if (!test_dir) { |
bb5376f3f585
do not add tested file to a location regex string,
Igor Sysoev <igor@sysoev.ru>
parents:
3532
diff
changeset
|
1327 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
|
1328 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
|
1329 } |
bb5376f3f585
do not add tested file to a location regex string,
Igor Sysoev <igor@sysoev.ru>
parents:
3532
diff
changeset
|
1330 #endif |
2407 | 1331 } else { |
1332 r->uri.len = alias + path.len; | |
1333 r->uri.data = ngx_pnalloc(r->pool, r->uri.len); | |
1334 if (r->uri.data == NULL) { | |
1335 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
1336 return NGX_OK; | |
1337 } | |
1338 | |
1339 p = ngx_copy(r->uri.data, clcf->name.data, alias); | |
1340 ngx_memcpy(p, name, path.len); | |
1341 } | |
1342 | |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1343 ngx_http_set_exten(r); |
2503
7b0711452b34
set content-type for try_files' choice
Igor Sysoev <igor@sysoev.ru>
parents:
2496
diff
changeset
|
1344 |
2407 | 1345 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1346 "try file uri: \"%V\"", &r->uri); | |
1347 | |
1348 r->phase_handler++; | |
1349 return NGX_AGAIN; | |
1350 } | |
1351 | |
1352 /* not reached */ | |
1353 } | |
1354 | |
1355 | |
1356 ngx_int_t | |
681 | 1357 ngx_http_core_content_phase(ngx_http_request_t *r, |
1358 ngx_http_phase_handler_t *ph) | |
1359 { | |
773 | 1360 size_t root; |
681 | 1361 ngx_int_t rc; |
1362 ngx_str_t path; | |
1363 | |
1364 if (r->content_handler) { | |
1365 r->write_event_handler = ngx_http_request_empty_handler; | |
1366 ngx_http_finalize_request(r, r->content_handler(r)); | |
1367 return NGX_OK; | |
1368 } | |
1369 | |
1370 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1371 "content phase: %ui", r->phase_handler); | |
1372 | |
1373 rc = ph->handler(r); | |
1374 | |
1375 if (rc != NGX_DECLINED) { | |
1376 ngx_http_finalize_request(r, rc); | |
1377 return NGX_OK; | |
1378 } | |
1379 | |
1380 /* rc == NGX_DECLINED */ | |
1381 | |
1382 ph++; | |
1383 | |
1384 if (ph->checker) { | |
1385 r->phase_handler++; | |
1386 return NGX_AGAIN; | |
1387 } | |
1388 | |
1389 /* no content handler was found */ | |
1390 | |
3527 | 1391 if (r->uri.data[r->uri.len - 1] == '/') { |
681 | 1392 |
773 | 1393 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { |
681 | 1394 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
|
1395 "directory index of \"%s\" is forbidden", path.data); |
681 | 1396 } |
1397 | |
1398 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); | |
1399 return NGX_OK; | |
1400 } | |
1401 | |
1402 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found"); | |
1403 | |
1404 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); | |
535 | 1405 return NGX_OK; |
1406 } | |
1407 | |
1408 | |
1409 void | |
1410 ngx_http_update_location_config(ngx_http_request_t *r) | |
1411 { | |
1412 ngx_http_core_loc_conf_t *clcf; | |
1413 | |
1414 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1415 | |
631 | 1416 if (r->method & clcf->limit_except) { |
1417 r->loc_conf = clcf->limit_except_loc_conf; | |
1418 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1419 } | |
1420 | |
643 | 1421 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
|
1422 r->connection->log->file = clcf->error_log->file; |
1148 | 1423 |
643 | 1424 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
|
1425 r->connection->log->log_level = clcf->error_log->log_level; |
643 | 1426 } |
535 | 1427 } |
1428 | |
1429 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { | |
1430 r->connection->sendfile = 1; | |
1431 | |
1432 } else { | |
1433 r->connection->sendfile = 0; | |
1434 } | |
1435 | |
633 | 1436 if (clcf->client_body_in_file_only) { |
1437 r->request_body_in_file_only = 1; | |
1438 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
|
1439 r->request_body_in_clean_file = |
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
1440 clcf->client_body_in_file_only == NGX_HTTP_REQUEST_BODY_FILE_CLEAN; |
637 | 1441 r->request_body_file_log_level = NGX_LOG_NOTICE; |
1442 | |
1443 } else { | |
1444 r->request_body_file_log_level = NGX_LOG_WARN; | |
633 | 1445 } |
1446 | |
2845 | 1447 r->request_body_in_single_buf = clcf->client_body_in_single_buffer; |
1448 | |
2888 | 1449 if (r->keepalive) { |
1450 if (clcf->keepalive_timeout == 0) { | |
1451 r->keepalive = 0; | |
1452 | |
1453 } else if (r->connection->requests >= clcf->keepalive_requests) { | |
1454 r->keepalive = 0; | |
3793 | 1455 |
1456 } else if (r->headers_in.msie6 | |
1457 && r->method == NGX_HTTP_POST | |
1458 && (clcf->keepalive_disable | |
1459 & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) | |
1460 { | |
1461 /* | |
1462 * MSIE may wait for some time if an response for | |
1463 * a POST request was sent over a keepalive connection | |
1464 */ | |
1465 r->keepalive = 0; | |
1466 | |
1467 } else if (r->headers_in.safari | |
1468 && (clcf->keepalive_disable | |
1469 & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) | |
1470 { | |
1471 /* | |
1472 * Safari may send a POST request to a closed keepalive | |
1473 * connection and may stall for some time, see | |
1474 * https://bugs.webkit.org/show_bug.cgi?id=5760 | |
1475 */ | |
1476 r->keepalive = 0; | |
2888 | 1477 } |
535 | 1478 } |
1479 | |
1480 if (!clcf->tcp_nopush) { | |
1481 /* disable TCP_NOPUSH/TCP_CORK use */ | |
1482 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; | |
1483 } | |
1484 | |
613 | 1485 if (r->limit_rate == 0) { |
1486 r->limit_rate = clcf->limit_rate; | |
1487 } | |
527 | 1488 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
1489 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
|
1490 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
|
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 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1494 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1495 /* |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1496 * 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
|
1497 * NGX_DONE - auto redirect |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1498 * NGX_AGAIN - inclusive match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1499 * NGX_ERROR - regex error |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1500 * NGX_DECLINED - no match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1501 */ |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1502 |
487 | 1503 static ngx_int_t |
2027 | 1504 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
|
1505 { |
2027 | 1506 ngx_int_t rc; |
1507 ngx_http_core_loc_conf_t *pclcf; | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1508 #if (NGX_PCRE) |
3325 | 1509 ngx_int_t n; |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1510 ngx_uint_t noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1511 ngx_http_core_loc_conf_t *clcf, **clcfp; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1512 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1513 noregex = 0; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1514 #endif |
2027 | 1515 |
1516 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1517 | |
1518 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); | |
1519 | |
1520 if (rc == NGX_AGAIN) { | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1521 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1522 #if (NGX_PCRE) |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1523 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
|
1524 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1525 noregex = clcf->noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1526 #endif |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1527 |
2027 | 1528 /* look up nested locations */ |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1529 |
2027 | 1530 rc = ngx_http_core_find_location(r); |
1531 } | |
1532 | |
1533 if (rc == NGX_OK || rc == NGX_DONE) { | |
1534 return rc; | |
1535 } | |
1536 | |
1537 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ | |
1538 | |
1539 #if (NGX_PCRE) | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1540 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1541 if (noregex == 0 && pclcf->regex_locations) { |
2027 | 1542 |
1543 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { | |
1544 | |
1545 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1546 "test location: ~ \"%V\"", &(*clcfp)->name); | |
1547 | |
3325 | 1548 n = ngx_http_regex_exec(r, (*clcfp)->regex, &r->uri); |
1549 | |
1550 if (n == NGX_OK) { | |
1551 r->loc_conf = (*clcfp)->loc_conf; | |
1552 | |
1553 /* look up nested locations */ | |
1554 | |
1555 rc = ngx_http_core_find_location(r); | |
1556 | |
1557 return (rc == NGX_ERROR) ? rc : NGX_OK; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1558 } |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1559 |
3325 | 1560 if (n == NGX_DECLINED) { |
2027 | 1561 continue; |
1562 } | |
1563 | |
3325 | 1564 return NGX_ERROR; |
2027 | 1565 } |
1566 } | |
1386
3c6da0610f19
fix building by bcc without PCRE
Igor Sysoev <igor@sysoev.ru>
parents:
1377
diff
changeset
|
1567 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1568 |
2027 | 1569 return rc; |
1570 } | |
1571 | |
1572 | |
1573 /* | |
1574 * NGX_OK - exact match | |
1575 * NGX_DONE - auto redirect | |
1576 * NGX_AGAIN - inclusive match | |
1577 * NGX_DECLINED - no match | |
1578 */ | |
1579 | |
1580 static ngx_int_t | |
1581 ngx_http_core_find_static_location(ngx_http_request_t *r, | |
1582 ngx_http_location_tree_node_t *node) | |
1583 { | |
1584 u_char *uri; | |
1585 size_t len, n; | |
1586 ngx_int_t rc, rv; | |
1587 | |
1588 len = r->uri.len; | |
1589 uri = r->uri.data; | |
1590 | |
1591 rv = NGX_DECLINED; | |
1592 | |
1593 for ( ;; ) { | |
1594 | |
1595 if (node == NULL) { | |
1596 return rv; | |
485 | 1597 } |
1598 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1599 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2027 | 1600 "test location: \"%*s\"", node->len, node->name); |
1601 | |
1602 n = (len <= (size_t) node->len) ? len : node->len; | |
1603 | |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
2085
diff
changeset
|
1604 rc = ngx_filename_cmp(uri, node->name, n); |
2027 | 1605 |
1606 if (rc != 0) { | |
1607 node = (rc < 0) ? node->left : node->right; | |
1608 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1609 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1610 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1611 |
2027 | 1612 if (len > (size_t) node->len) { |
1613 | |
1614 if (node->inclusive) { | |
1615 | |
1616 r->loc_conf = node->inclusive->loc_conf; | |
1617 rv = NGX_AGAIN; | |
1618 | |
1619 node = node->tree; | |
1620 uri += n; | |
1621 len -= n; | |
485 | 1622 |
1623 continue; | |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1624 } |
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1625 |
2027 | 1626 /* exact only */ |
1627 | |
1628 node = node->right; | |
1629 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1630 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1631 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1632 |
2027 | 1633 if (len == (size_t) node->len) { |
1634 | |
3636
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1635 if (node->exact) { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1636 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
|
1637 return NGX_OK; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1638 |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1639 } else { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1640 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
|
1641 return NGX_AGAIN; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1642 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1643 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1644 |
2027 | 1645 /* len < node->len */ |
1646 | |
1647 if (len + 1 == (size_t) node->len && node->auto_redirect) { | |
1648 | |
1649 r->loc_conf = (node->exact) ? node->exact->loc_conf: | |
1650 node->inclusive->loc_conf; | |
1651 rv = NGX_DONE; | |
1652 } | |
1653 | |
1654 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
|
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 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1658 |
2138 | 1659 void * |
1660 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) | |
1661 { | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1662 u_char c, *lowcase; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1663 size_t len; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1664 ngx_uint_t i, hash; |
2138 | 1665 |
3372
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1666 if (types_hash->size == 0) { |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1667 return (void *) 4; |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1668 } |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1669 |
2138 | 1670 if (r->headers_out.content_type.len == 0) { |
1671 return NULL; | |
1672 } | |
1673 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1674 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
|
1675 |
2138 | 1676 if (r->headers_out.content_type_lowcase == NULL) { |
1677 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1678 lowcase = ngx_pnalloc(r->pool, len); |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1679 if (lowcase == NULL) { |
2138 | 1680 return NULL; |
1681 } | |
1682 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1683 r->headers_out.content_type_lowcase = lowcase; |
2138 | 1684 |
1685 hash = 0; | |
1686 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1687 for (i = 0; i < len; i++) { |
2138 | 1688 c = ngx_tolower(r->headers_out.content_type.data[i]); |
1689 hash = ngx_hash(hash, c); | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1690 lowcase[i] = c; |
2138 | 1691 } |
1692 | |
1693 r->headers_out.content_type_hash = hash; | |
1694 } | |
1695 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1696 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
|
1697 r->headers_out.content_type_lowcase, len); |
2138 | 1698 } |
1699 | |
1700 | |
487 | 1701 ngx_int_t |
1702 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
|
1703 { |
2136 | 1704 u_char c, *exten; |
589 | 1705 ngx_str_t *type; |
649 | 1706 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
|
1707 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
|
1708 |
673 | 1709 if (r->headers_out.content_type.len) { |
1710 return NGX_OK; | |
1711 } | |
1712 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1713 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
|
1714 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1715 if (r->exten.len) { |
485 | 1716 |
649 | 1717 hash = 0; |
1718 | |
1719 for (i = 0; i < r->exten.len; i++) { | |
1720 c = r->exten.data[i]; | |
1721 | |
1722 if (c >= 'A' && c <= 'Z') { | |
1723 | |
2136 | 1724 exten = ngx_pnalloc(r->pool, r->exten.len); |
1725 if (exten == NULL) { | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1726 return NGX_ERROR; |
485 | 1727 } |
1728 | |
2136 | 1729 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); |
485 | 1730 |
1731 r->exten.data = exten; | |
649 | 1732 |
1733 break; | |
485 | 1734 } |
1735 | |
649 | 1736 hash = ngx_hash(hash, c); |
485 | 1737 } |
1738 | |
649 | 1739 type = ngx_hash_find(&clcf->types_hash, hash, |
589 | 1740 r->exten.data, r->exten.len); |
1741 | |
1742 if (type) { | |
657 | 1743 r->headers_out.content_type_len = type->len; |
589 | 1744 r->headers_out.content_type = *type; |
657 | 1745 |
589 | 1746 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
|
1747 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1748 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1749 |
657 | 1750 r->headers_out.content_type_len = clcf->default_type.len; |
589 | 1751 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
|
1752 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1753 return NGX_OK; |
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 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1756 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1757 void |
487 | 1758 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
|
1759 { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1760 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
|
1761 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
1762 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
|
1763 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1764 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
|
1765 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { |
649 | 1766 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1767 r->exten.len = r->uri.len - i - 1; |
649 | 1768 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
|
1769 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1770 return; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1771 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1772 } 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
|
1773 return; |
216
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 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1776 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1777 return; |
216
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 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1780 |
487 | 1781 ngx_int_t |
3632 | 1782 ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, |
1783 ngx_str_t *ct, ngx_http_complex_value_t *cv) | |
1784 { | |
1785 ngx_int_t rc; | |
1786 ngx_str_t val; | |
1787 ngx_buf_t *b; | |
1788 ngx_chain_t out; | |
1789 | |
4247
b79dbadb3d5e
Merging r4147, r4148, r4149, r4150, r4207:
Igor Sysoev <igor@sysoev.ru>
parents:
4246
diff
changeset
|
1790 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
|
1791 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
b79dbadb3d5e
Merging r4147, r4148, r4149, r4150, r4207:
Igor Sysoev <igor@sysoev.ru>
parents:
4246
diff
changeset
|
1792 } |
b79dbadb3d5e
Merging r4147, r4148, r4149, r4150, r4207:
Igor Sysoev <igor@sysoev.ru>
parents:
4246
diff
changeset
|
1793 |
3632 | 1794 r->headers_out.status = status; |
1795 | |
1796 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { | |
1797 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1798 } | |
1799 | |
1800 if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) { | |
1801 | |
4247
b79dbadb3d5e
Merging r4147, r4148, r4149, r4150, r4207:
Igor Sysoev <igor@sysoev.ru>
parents:
4246
diff
changeset
|
1802 ngx_http_clear_location(r); |
b79dbadb3d5e
Merging r4147, r4148, r4149, r4150, r4207:
Igor Sysoev <igor@sysoev.ru>
parents:
4246
diff
changeset
|
1803 |
3632 | 1804 r->headers_out.location = ngx_list_push(&r->headers_out.headers); |
1805 if (r->headers_out.location == NULL) { | |
1806 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1807 } | |
1808 | |
1809 r->headers_out.location->hash = 1; | |
1810 ngx_str_set(&r->headers_out.location->key, "Location"); | |
1811 r->headers_out.location->value = val; | |
1812 | |
1813 return status; | |
1814 } | |
1815 | |
1816 r->headers_out.content_length_n = val.len; | |
1817 | |
1818 if (ct) { | |
1819 r->headers_out.content_type_len = ct->len; | |
1820 r->headers_out.content_type = *ct; | |
1821 | |
1822 } else { | |
1823 if (ngx_http_set_content_type(r) != NGX_OK) { | |
1824 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1825 } | |
1826 } | |
1827 | |
1828 if (r->method == NGX_HTTP_HEAD || (r != r->main && val.len == 0)) { | |
1829 return ngx_http_send_header(r); | |
1830 } | |
1831 | |
1832 b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); | |
1833 if (b == NULL) { | |
1834 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1835 } | |
1836 | |
1837 b->pos = val.data; | |
1838 b->last = val.data + val.len; | |
1839 b->memory = val.len ? 1 : 0; | |
1840 b->last_buf = (r == r->main) ? 1 : 0; | |
1841 b->last_in_chain = 1; | |
1842 | |
1843 out.buf = b; | |
1844 out.next = NULL; | |
1845 | |
1846 rc = ngx_http_send_header(r); | |
1847 | |
1848 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { | |
1849 return rc; | |
1850 } | |
1851 | |
1852 return ngx_http_output_filter(r, &out); | |
1853 } | |
1854 | |
1855 | |
1856 ngx_int_t | |
557 | 1857 ngx_http_send_header(ngx_http_request_t *r) |
1858 { | |
1859 if (r->err_status) { | |
1860 r->headers_out.status = r->err_status; | |
1861 r->headers_out.status_line.len = 0; | |
1862 } | |
1863 | |
1864 return ngx_http_top_header_filter(r); | |
1865 } | |
1866 | |
1867 | |
1868 ngx_int_t | |
1869 ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in) | |
1870 { | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1871 ngx_int_t rc; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1872 ngx_connection_t *c; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1873 |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1874 c = r->connection; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1875 |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1876 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
583 | 1877 "http output filter \"%V?%V\"", &r->uri, &r->args); |
557 | 1878 |
1879 rc = ngx_http_top_body_filter(r, in); | |
1880 | |
1881 if (rc == NGX_ERROR) { | |
1882 /* NGX_ERROR may be returned by any filter */ | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1883 c->error = 1; |
557 | 1884 } |
1885 | |
1886 return rc; | |
1887 } | |
1888 | |
1889 | |
1890 u_char * | |
1891 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | |
773 | 1892 size_t *root_length, size_t reserved) |
557 | 1893 { |
623 | 1894 u_char *last; |
1895 size_t alias; | |
1896 ngx_http_core_loc_conf_t *clcf; | |
557 | 1897 |
1898 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1899 | |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
1900 alias = clcf->alias; |
557 | 1901 |
603 | 1902 if (alias && !r->valid_location) { |
1903 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
|
1904 "\"alias\" cannot be used in location \"%V\" " |
603 | 1905 "where URI was rewritten", &clcf->name); |
1906 return NULL; | |
1907 } | |
1908 | |
595 | 1909 if (clcf->root_lengths == NULL) { |
1910 | |
773 | 1911 *root_length = clcf->root.len; |
595 | 1912 |
2565
456e453eb84a
fix reserved mapped uri length if alias has captures
Igor Sysoev <igor@sysoev.ru>
parents:
2564
diff
changeset
|
1913 path->len = clcf->root.len + reserved + r->uri.len - alias + 1; |
595 | 1914 |
2049 | 1915 path->data = ngx_pnalloc(r->pool, path->len); |
595 | 1916 if (path->data == NULL) { |
1917 return NULL; | |
1918 } | |
1919 | |
1920 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | |
623 | 1921 |
1922 } else { | |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1923 |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1924 #if (NGX_PCRE) |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1925 ngx_uint_t captures; |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1926 |
3325 | 1927 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
|
1928 |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1929 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
|
1930 : r->uri.len - alias + 1; |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1931 #else |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1932 reserved += r->uri.len - alias + 1; |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1933 #endif |
2572
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1934 |
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1935 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, |
671 | 1936 clcf->root_values->elts) |
667 | 1937 == NULL) |
1938 { | |
1939 return NULL; | |
1940 } | |
1941 | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1942 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0) != NGX_OK) { |
623 | 1943 return NULL; |
1944 } | |
1945 | |
773 | 1946 *root_length = path->len - reserved; |
1947 last = path->data + *root_length; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1948 |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1949 #if (NGX_PCRE) |
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1950 if (captures) { |
3534
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1951 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
|
1952 *last = '\0'; |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1953 return last; |
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 |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1956 alias = 0; |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1957 } |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1958 #endif |
595 | 1959 } |
1960 | |
623 | 1961 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
557 | 1962 |
1963 return last; | |
1964 } | |
1965 | |
1966 | |
1967 ngx_int_t | |
539 | 1968 ngx_http_auth_basic_user(ngx_http_request_t *r) |
1969 { | |
1970 ngx_str_t auth, encoded; | |
1971 ngx_uint_t len; | |
1972 | |
1973 if (r->headers_in.user.len == 0 && r->headers_in.user.data != NULL) { | |
1974 return NGX_DECLINED; | |
1975 } | |
1976 | |
1977 if (r->headers_in.authorization == NULL) { | |
1978 r->headers_in.user.data = (u_char *) ""; | |
1979 return NGX_DECLINED; | |
1980 } | |
1981 | |
1982 encoded = r->headers_in.authorization->value; | |
1983 | |
1984 if (encoded.len < sizeof("Basic ") - 1 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1985 || ngx_strncasecmp(encoded.data, (u_char *) "Basic ", |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1986 sizeof("Basic ") - 1) |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1987 != 0) |
539 | 1988 { |
1989 r->headers_in.user.data = (u_char *) ""; | |
1990 return NGX_DECLINED; | |
1991 } | |
1992 | |
1993 encoded.len -= sizeof("Basic ") - 1; | |
1994 encoded.data += sizeof("Basic ") - 1; | |
1995 | |
1996 while (encoded.len && encoded.data[0] == ' ') { | |
1997 encoded.len--; | |
1998 encoded.data++; | |
1999 } | |
2000 | |
2001 if (encoded.len == 0) { | |
2002 r->headers_in.user.data = (u_char *) ""; | |
2003 return NGX_DECLINED; | |
2004 } | |
577 | 2005 |
539 | 2006 auth.len = ngx_base64_decoded_length(encoded.len); |
2049 | 2007 auth.data = ngx_pnalloc(r->pool, auth.len + 1); |
539 | 2008 if (auth.data == NULL) { |
2009 return NGX_ERROR; | |
2010 } | |
2011 | |
2012 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) { | |
2013 r->headers_in.user.data = (u_char *) ""; | |
2014 return NGX_DECLINED; | |
2015 } | |
577 | 2016 |
539 | 2017 auth.data[auth.len] = '\0'; |
577 | 2018 |
2019 for (len = 0; len < auth.len; len++) { | |
539 | 2020 if (auth.data[len] == ':') { |
2021 break; | |
2022 } | |
2023 } | |
577 | 2024 |
573 | 2025 if (len == 0 || len == auth.len) { |
539 | 2026 r->headers_in.user.data = (u_char *) ""; |
2027 return NGX_DECLINED; | |
2028 } | |
2029 | |
2030 r->headers_in.user.len = len; | |
2031 r->headers_in.user.data = auth.data; | |
2032 r->headers_in.passwd.len = auth.len - len - 1; | |
2033 r->headers_in.passwd.data = &auth.data[len + 1]; | |
2034 | |
2035 return NGX_OK; | |
2036 } | |
2037 | |
2038 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2039 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2040 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2041 ngx_int_t |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2042 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
|
2043 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2044 time_t date, expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2045 ngx_uint_t p; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2046 ngx_array_t *cc; |
4040
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2047 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
|
2048 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
|
2049 |
3313 | 2050 r->gzip_tested = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2051 |
4040
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2052 if (r != r->main) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2053 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2056 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
|
2057 if (ae == NULL) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2058 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2061 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
|
2062 return NGX_DECLINED; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2063 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2064 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2065 /* |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2066 * 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
|
2067 * MSIE: "gzip, deflate" |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2068 * Firefox: "gzip,deflate" |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2069 * Chrome: "gzip,deflate,sdch" |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2070 * Safari: "gzip, deflate" |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2071 * Opera: "gzip, deflate" |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2074 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
|
2075 && 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
|
2076 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2077 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2080 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
|
2081 |
2205 | 2082 if (r->headers_in.msie6 && clcf->gzip_disable_msie6) { |
2083 return NGX_DECLINED; | |
2084 } | |
2085 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2086 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
|
2087 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2090 if (r->headers_in.via == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2091 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2092 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2093 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2094 p = clcf->gzip_proxied; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2095 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2096 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
|
2097 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2098 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2099 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2100 if (p & NGX_HTTP_GZIP_PROXIED_ANY) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2101 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2102 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2103 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2104 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
|
2105 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2106 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2107 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2108 e = r->headers_out.expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2109 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2110 if (e) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2111 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2112 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
|
2113 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2116 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
|
2117 if (expires == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2118 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2121 d = r->headers_out.date; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2122 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2123 if (d) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2124 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
|
2125 if (date == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2126 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2129 } else { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2130 date = ngx_time(); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2131 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2132 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2133 if (expires < date) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2134 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2135 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2136 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2137 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2140 cc = &r->headers_out.cache_control; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2141 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2142 if (cc->elts) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2143 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2144 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
|
2145 && 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
|
2146 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2147 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2148 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2149 goto ok; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2152 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
|
2153 && 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
|
2154 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2155 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2156 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2157 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2158 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2159 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2160 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
|
2161 && 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
|
2162 NULL) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2163 >= 0) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2164 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2165 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2166 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2167 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2168 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2171 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
|
2172 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2173 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2174 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2175 if ((p & NGX_HTTP_GZIP_PROXIED_NO_ETAG) && r->headers_out.etag) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2176 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2177 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2178 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2179 ok: |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2180 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2181 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2182 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2183 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
|
2184 |
1801
a4cb9c04e7f2
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1800
diff
changeset
|
2185 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
|
2186 &r->headers_in.user_agent->value, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2187 r->connection->log) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2188 != NGX_DECLINED) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2189 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2190 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2194 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2195 |
3313 | 2196 r->gzip_ok = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2197 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2198 return NGX_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2199 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2200 |
4040
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 /* |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2203 * 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
|
2204 * "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
|
2205 * 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
|
2206 * "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
|
2207 */ |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2208 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2209 static ngx_int_t |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2210 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
|
2211 { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2212 u_char *p, *start, *last; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2213 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2214 start = ae->data; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2215 last = start + ae->len; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2216 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2217 for ( ;; ) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2218 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
|
2219 if (p == NULL) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2220 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2223 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
|
2224 break; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2225 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2226 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2227 start = p + 4; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2230 p += 4; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2231 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2232 while (p < last) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2233 switch(*p++) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2234 case ',': |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2235 return NGX_OK; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2236 case ';': |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2237 goto quantity; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2238 case ' ': |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2239 continue; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2240 default: |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2241 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2245 return NGX_OK; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2246 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2247 quantity: |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2248 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2249 while (p < last) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2250 switch(*p++) { |
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 case 'Q': |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2253 goto equal; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2254 case ' ': |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2255 continue; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2256 default: |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2257 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2261 return NGX_OK; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2262 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2263 equal: |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2264 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2265 if (p + 2 > last || *p++ != '=') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2266 return NGX_DECLINED; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2269 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
|
2270 return NGX_DECLINED; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2271 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2272 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2273 return NGX_OK; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2277 ngx_uint_t |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2278 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
|
2279 { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2280 u_char c; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2281 ngx_uint_t n, q; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2282 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2283 c = *p++; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2284 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2285 if (c != '0' && c != '1') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2286 return 0; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2289 q = (c - '0') * 100; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2290 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2291 if (p == last) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2292 return q; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2295 c = *p++; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2296 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2297 if (c == ',' || c == ' ') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2298 return q; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2301 if (c != '.') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2302 return 0; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2303 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2304 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2305 n = 0; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2306 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2307 while (p < last) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2308 c = *p++; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2309 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2310 if (c == ',' || c == ' ') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2311 break; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2314 if (c >= '0' && c <= '9') { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2315 q += c - '0'; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2316 n++; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2317 continue; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2320 return 0; |
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 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2323 if (q > 100 || n > 3) { |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2324 return 0; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2325 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2326 |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2327 return q; |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2328 } |
0094c8636d5f
Merge of r3979, r3980, r3981, r3983, r3987, r3994, r3995:
Igor Sysoev <igor@sysoev.ru>
parents:
3897
diff
changeset
|
2329 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2330 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2331 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2332 |
539 | 2333 ngx_int_t |
509 | 2334 ngx_http_subrequest(ngx_http_request_t *r, |
758
86bb73dc8d40
fix <!--#include virtual=... wait="yes" -->
Igor Sysoev <igor@sysoev.ru>
parents:
716
diff
changeset
|
2335 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
|
2336 ngx_http_post_subrequest_t *ps, ngx_uint_t flags) |
509 | 2337 { |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2338 ngx_time_t *tp; |
583 | 2339 ngx_connection_t *c; |
509 | 2340 ngx_http_request_t *sr; |
2341 ngx_http_core_srv_conf_t *cscf; | |
2342 ngx_http_postponed_request_t *pr, *p; | |
2343 | |
657 | 2344 r->main->subrequests--; |
2345 | |
2346 if (r->main->subrequests == 0) { | |
2347 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2348 "subrequests cycle while processing \"%V\"", uri); |
838 | 2349 r->main->subrequests = 1; |
657 | 2350 return NGX_ERROR; |
2351 } | |
2352 | |
509 | 2353 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t)); |
2354 if (sr == NULL) { | |
645 | 2355 return NGX_ERROR; |
509 | 2356 } |
2357 | |
2358 sr->signature = NGX_HTTP_MODULE; | |
583 | 2359 |
2360 c = r->connection; | |
2361 sr->connection = c; | |
509 | 2362 |
2363 sr->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); | |
2364 if (sr->ctx == NULL) { | |
645 | 2365 return NGX_ERROR; |
509 | 2366 } |
2367 | |
2368 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | |
581 | 2369 sizeof(ngx_table_elt_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2370 != NGX_OK) |
509 | 2371 { |
645 | 2372 return NGX_ERROR; |
509 | 2373 } |
2374 | |
2375 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | |
2376 sr->main_conf = cscf->ctx->main_conf; | |
2377 sr->srv_conf = cscf->ctx->srv_conf; | |
2378 sr->loc_conf = cscf->ctx->loc_conf; | |
2379 | |
2380 sr->pool = r->pool; | |
2381 | |
2382 sr->headers_in = r->headers_in; | |
2383 | |
577 | 2384 ngx_http_clear_content_length(sr); |
2385 ngx_http_clear_accept_ranges(sr); | |
2386 ngx_http_clear_last_modified(sr); | |
509 | 2387 |
2388 sr->request_body = r->request_body; | |
2389 | |
2390 sr->method = NGX_HTTP_GET; | |
2391 sr->http_version = r->http_version; | |
2392 | |
2393 sr->request_line = r->request_line; | |
2394 sr->uri = *uri; | |
573 | 2395 |
509 | 2396 if (args) { |
2397 sr->args = *args; | |
2398 } | |
573 | 2399 |
583 | 2400 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2401 "http subrequest \"%V?%V\"", uri, &sr->args); | |
2402 | |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2403 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
|
2404 sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0; |
573 | 2405 |
509 | 2406 sr->unparsed_uri = r->unparsed_uri; |
1857
18c20c38ad6d
update GET method text in an subrequest
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
2407 sr->method_name = ngx_http_core_get_method; |
509 | 2408 sr->http_protocol = r->http_protocol; |
2409 | |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2410 ngx_http_set_exten(sr); |
509 | 2411 |
553 | 2412 sr->main = r->main; |
509 | 2413 sr->parent = r; |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2414 sr->post_subrequest = ps; |
509 | 2415 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
|
2416 sr->write_event_handler = ngx_http_handler; |
509 | 2417 |
2423 | 2418 if (c->data == r && r->postponed == NULL) { |
583 | 2419 c->data = sr; |
509 | 2420 } |
2421 | |
2422 sr->variables = r->variables; | |
2423 | |
2424 sr->log_handler = r->log_handler; | |
2425 | |
2426 pr = ngx_palloc(r->pool, sizeof(ngx_http_postponed_request_t)); | |
2427 if (pr == NULL) { | |
645 | 2428 return NGX_ERROR; |
509 | 2429 } |
2430 | |
2431 pr->request = sr; | |
2432 pr->out = NULL; | |
2433 pr->next = NULL; | |
2434 | |
2435 if (r->postponed) { | |
2436 for (p = r->postponed; p->next; p = p->next) { /* void */ } | |
2437 p->next = pr; | |
2438 | |
2439 } else { | |
2440 r->postponed = pr; | |
2441 } | |
2442 | |
2443 sr->internal = 1; | |
2444 | |
543 | 2445 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
|
2446 sr->expect_tested = 1; |
513 | 2447 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; |
2448 | |
651 | 2449 sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1; |
2450 | |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2451 tp = ngx_timeofday(); |
3897 | 2452 sr->start_sec = tp->sec; |
2453 sr->start_msec = tp->msec; | |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2454 |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2455 r->main->subrequests++; |
3049 | 2456 r->main->count++; |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2457 |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2458 *psr = sr; |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2459 |
3064 | 2460 return ngx_http_post_request(sr, NULL); |
509 | 2461 } |
2462 | |
2463 | |
2464 ngx_int_t | |
487 | 2465 ngx_http_internal_redirect(ngx_http_request_t *r, |
2466 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
|
2467 { |
487 | 2468 ngx_http_core_srv_conf_t *cscf; |
2469 | |
677 | 2470 r->uri_changes--; |
2471 | |
2472 if (r->uri_changes == 0) { | |
2473 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2474 "rewrite or internal redirection cycle " |
4246
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
2475 "while internally redirecting to \"%V\"", uri); |
679 | 2476 |
3114
1c4fcfe57af1
fix request counter for rewrite or internal redirection cycle,
Igor Sysoev <igor@sysoev.ru>
parents:
3078
diff
changeset
|
2477 r->main->count++; |
677 | 2478 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2479 return NGX_DONE; | |
2480 } | |
2481 | |
461 | 2482 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
|
2483 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2484 if (args) { |
461 | 2485 r->args = *args; |
509 | 2486 |
2487 } else { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
2488 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
|
2489 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2490 |
583 | 2491 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2492 "internal redirect: \"%V?%V\"", uri, &r->args); | |
2493 | |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2494 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
|
2495 |
675 | 2496 /* clear the modules contexts */ |
2497 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
|
2498 |
487 | 2499 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2500 r->loc_conf = cscf->ctx->loc_conf; | |
2501 | |
535 | 2502 ngx_http_update_location_config(r); |
2503 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2504 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2505 r->cache = NULL; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2506 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2507 |
509 | 2508 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
|
2509 r->add_uri_to_alias = 0; |
3049 | 2510 r->main->count++; |
509 | 2511 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2512 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
|
2513 |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
2514 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
|
2515 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2516 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2517 |
1353 | 2518 ngx_int_t |
2519 ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name) | |
2520 { | |
2521 ngx_http_core_srv_conf_t *cscf; | |
2522 ngx_http_core_loc_conf_t **clcfp; | |
2523 ngx_http_core_main_conf_t *cmcf; | |
2524 | |
3049 | 2525 r->main->count++; |
2526 | |
1353 | 2527 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2528 | |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2529 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
|
2530 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2531 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
|
2532 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2533 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
|
2534 "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
|
2535 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2536 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
|
2537 || 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
|
2538 { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2539 continue; |
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 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2542 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
|
2543 "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
|
2544 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
|
2545 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2546 r->internal = 1; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2547 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
|
2548 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
|
2549 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2550 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
|
2551 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2552 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
|
2553 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2554 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
|
2555 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2556 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
|
2557 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2558 return NGX_DONE; |
1353 | 2559 } |
2560 } | |
2561 | |
2562 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1591 | 2563 "could not find named location \"%V\"", name); |
1353 | 2564 |
2565 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
2027 | 2566 |
1353 | 2567 return NGX_DONE; |
2568 } | |
2569 | |
2570 | |
569 | 2571 ngx_http_cleanup_t * |
2572 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
|
2573 { |
569 | 2574 ngx_http_cleanup_t *cln; |
2575 | |
2576 r = r->main; | |
2577 | |
2578 cln = ngx_palloc(r->pool, sizeof(ngx_http_cleanup_t)); | |
2579 if (cln == NULL) { | |
2580 return NULL; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2581 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2582 |
569 | 2583 if (size) { |
2584 cln->data = ngx_palloc(r->pool, size); | |
2585 if (cln->data == NULL) { | |
2586 return NULL; | |
2587 } | |
2588 | |
2589 } else { | |
2590 cln->data = NULL; | |
2591 } | |
2592 | |
2593 cln->handler = NULL; | |
2594 cln->next = r->cleanup; | |
2595 | |
2596 r->cleanup = cln; | |
2597 | |
2598 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2599 "http cleanup add: %p", cln); | |
2600 | |
2601 return cln; | |
144
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 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2604 |
487 | 2605 static char * |
2606 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
|
2607 { |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2608 char *rv; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2609 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
|
2610 ngx_uint_t i; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2611 ngx_conf_t pcf; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2612 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
|
2613 struct sockaddr_in *sin; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2614 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
|
2615 ngx_http_listen_opt_t lsopt; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2616 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
|
2617 ngx_http_core_main_conf_t *cmcf; |
487 | 2618 |
501 | 2619 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2620 if (ctx == NULL) { | |
487 | 2621 return NGX_CONF_ERROR; |
2622 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2623 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2624 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
|
2625 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
|
2626 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2627 /* 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
|
2628 |
487 | 2629 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2630 if (ctx->srv_conf == NULL) { | |
2631 return NGX_CONF_ERROR; | |
2632 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2633 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2634 /* 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
|
2635 |
487 | 2636 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2637 if (ctx->loc_conf == NULL) { | |
2638 return NGX_CONF_ERROR; | |
2639 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2640 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2641 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
|
2642 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
|
2643 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2644 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2645 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2646 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
|
2647 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2648 if (module->create_srv_conf) { |
501 | 2649 mconf = module->create_srv_conf(cf); |
2650 if (mconf == NULL) { | |
487 | 2651 return NGX_CONF_ERROR; |
2652 } | |
2653 | |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2654 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
|
2655 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2656 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2657 if (module->create_loc_conf) { |
501 | 2658 mconf = module->create_loc_conf(cf); |
2659 if (mconf == NULL) { | |
487 | 2660 return NGX_CONF_ERROR; |
2661 } | |
2662 | |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2663 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
|
2664 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2665 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2666 |
487 | 2667 |
2668 /* 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
|
2669 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2670 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
|
2671 cscf->ctx = ctx; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2672 |
487 | 2673 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2674 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; |
487 | 2675 |
501 | 2676 cscfp = ngx_array_push(&cmcf->servers); |
2677 if (cscfp == NULL) { | |
487 | 2678 return NGX_CONF_ERROR; |
2679 } | |
2680 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2681 *cscfp = cscf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2682 |
487 | 2683 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2684 /* parse inside server{} */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2685 |
521 | 2686 pcf = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2687 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
|
2688 cf->cmd_type = NGX_HTTP_SRV_CONF; |
485 | 2689 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2690 rv = ngx_conf_parse(cf, NULL); |
485 | 2691 |
521 | 2692 *cf = pcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2693 |
3775
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2694 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
|
2695 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
|
2696 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2697 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
|
2698 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2699 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
|
2700 #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
|
2701 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
|
2702 #else |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2703 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
|
2704 #endif |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2705 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
|
2706 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2707 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
|
2708 |
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.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
|
2710 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
|
2711 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
|
2712 #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
|
2713 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
|
2714 #endif |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2715 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
|
2716 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2717 (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
|
2718 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
|
2719 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2720 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
|
2721 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
|
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 } |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2724 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2725 return rv; |
44
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 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2728 |
487 | 2729 static char * |
2730 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
|
2731 { |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2732 char *rv; |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2733 u_char *mod; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2734 size_t len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2735 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
|
2736 ngx_uint_t i; |
485 | 2737 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
|
2738 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
|
2739 ngx_http_conf_ctx_t *ctx, *pctx; |
2027 | 2740 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
|
2741 |
501 | 2742 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2743 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
|
2744 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
|
2745 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2746 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2747 pctx = cf->ctx; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2748 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
|
2749 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
|
2750 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2751 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
|
2752 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
|
2753 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
|
2754 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2755 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2756 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
|
2757 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
|
2758 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2759 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2760 |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2761 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
|
2762 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2763 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
|
2764 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
|
2765 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
|
2766 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
|
2767 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2768 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2769 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2770 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2771 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2772 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
|
2773 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
|
2774 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
2775 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
|
2776 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2777 if (cf->args->nelts == 3) { |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2778 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2779 len = value[1].len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2780 mod = value[1].data; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2781 name = &value[2]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2782 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2783 if (len == 1 && mod[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2784 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2785 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
|
2786 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
|
2787 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2788 } 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
|
2789 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2790 clcf->name = *name; |
467 | 2791 clcf->noregex = 1; |
2792 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2793 } else if (len == 1 && mod[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2794 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2795 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
|
2796 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
|
2797 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2798 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2799 } 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
|
2800 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2801 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
|
2802 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2803 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2804 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2805 } else { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2806 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 2807 "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
|
2808 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
|
2809 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2810 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2811 } else { |
1353 | 2812 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2813 name = &value[1]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2814 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2815 if (name->data[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2816 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2817 clcf->name.len = name->len - 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2818 clcf->name.data = name->data + 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2819 clcf->exact_match = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2820 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2821 } 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
|
2822 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2823 clcf->name.len = name->len - 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2824 clcf->name.data = name->data + 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2825 clcf->noregex = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2826 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2827 } else if (name->data[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2828 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2829 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2830 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2831 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2832 if (name->data[0] == '*') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2833 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2834 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2835 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2836 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2837 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
|
2838 return NGX_CONF_ERROR; |
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 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2841 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2842 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
|
2843 return NGX_CONF_ERROR; |
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 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2847 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2848 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2849 clcf->name = *name; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2850 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2851 if (name->data[0] == '@') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2852 clcf->named = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2853 } |
1353 | 2854 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2855 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2856 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2857 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
|
2858 |
2027 | 2859 if (pclcf->name.len) { |
2860 | |
2861 /* nested location */ | |
2862 | |
485 | 2863 #if 0 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2864 clcf->prev_location = pclcf; |
485 | 2865 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2866 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2867 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
|
2868 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
|
2869 "location \"%V\" cannot be inside " |
461 | 2870 "the exact location \"%V\"", |
2871 &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
|
2872 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
|
2873 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2874 |
1353 | 2875 if (pclcf->named) { |
2876 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
|
2877 "location \"%V\" cannot be inside " |
1353 | 2878 "the named location \"%V\"", |
2879 &clcf->name, &pclcf->name); | |
2880 return NGX_CONF_ERROR; | |
2881 } | |
2882 | |
2027 | 2883 if (clcf->named) { |
2884 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
|
2885 "named location \"%V\" can be " |
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
2886 "on the server level only", |
2027 | 2887 &clcf->name); |
2888 return NGX_CONF_ERROR; | |
2889 } | |
2890 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2891 len = pclcf->name.len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2892 |
455 | 2893 #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
|
2894 if (clcf->regex == NULL |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2895 && 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
|
2896 #else |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2897 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
|
2898 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2899 { |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2900 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 2901 "location \"%V\" is outside location \"%V\"", |
2902 &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
|
2903 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
|
2904 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
2905 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2906 |
2027 | 2907 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { |
2908 return NGX_CONF_ERROR; | |
2909 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2910 |
485 | 2911 save = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2912 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
|
2913 cf->cmd_type = NGX_HTTP_LOC_CONF; |
485 | 2914 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2915 rv = ngx_conf_parse(cf, NULL); |
485 | 2916 |
2917 *cf = save; | |
2918 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2919 return rv; |
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 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2922 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2923 static ngx_int_t |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2924 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
|
2925 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
|
2926 { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2927 #if (NGX_PCRE) |
3325 | 2928 ngx_regex_compile_t rc; |
2929 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
2930 | |
2931 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); | |
2932 | |
2933 rc.pattern = *regex; | |
2934 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
2935 rc.err.data = errstr; | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2936 |
2981
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
2937 #if (NGX_HAVE_CASELESS_FILESYSTEM) |
3325 | 2938 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
|
2939 #else |
8854f4eb2839
fix caseless locations, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3388
diff
changeset
|
2940 rc.options = caseless; |
2981
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
2941 #endif |
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
2942 |
3325 | 2943 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
|
2944 if (clcf->regex == NULL) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2945 return NGX_ERROR; |
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 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2948 clcf->name = *regex; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2949 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2950 return NGX_OK; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2951 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2952 #else |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2953 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2954 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
|
2955 "using regex \"%V\" requires PCRE library", |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2956 regex); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2957 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2958 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2959 #endif |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2960 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2961 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
2962 |
487 | 2963 static char * |
2964 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
|
2965 { |
3318 | 2966 ngx_http_core_loc_conf_t *clcf = conf; |
637 | 2967 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2968 char *rv; |
485 | 2969 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
|
2970 |
3318 | 2971 if (clcf->types == NULL) { |
2972 clcf->types = ngx_array_create(cf->pool, 64, sizeof(ngx_hash_key_t)); | |
2973 if (clcf->types == NULL) { | |
637 | 2974 return NGX_CONF_ERROR; |
2975 } | |
2976 } | |
2977 | |
485 | 2978 save = *cf; |
2979 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
|
2980 cf->handler_conf = conf; |
485 | 2981 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2982 rv = ngx_conf_parse(cf, NULL); |
485 | 2983 |
2984 *cf = save; | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2985 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2986 return rv; |
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 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
2989 |
487 | 2990 static char * |
2991 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
|
2992 { |
3318 | 2993 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
|
2994 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2995 ngx_str_t *value, *content_type, *old, file; |
2136 | 2996 ngx_uint_t i, n, hash; |
589 | 2997 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
|
2998 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
2999 value = cf->args->elts; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3000 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3001 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
|
3002 if (cf->args->nelts != 2) { |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3003 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
|
3004 "invalid number of arguments" |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3005 " in \"include\" directive"); |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3006 return NGX_CONF_ERROR; |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3007 } |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3008 file = value[1]; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3009 |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3010 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
|
3011 return NGX_CONF_ERROR; |
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 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3014 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
|
3015 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3016 return ngx_conf_parse(cf, &file); |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3017 } |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3018 |
589 | 3019 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t)); |
3020 if (content_type == NULL) { | |
3021 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
|
3022 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3023 |
589 | 3024 *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
|
3025 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3026 for (i = 1; i < cf->args->nelts; i++) { |
589 | 3027 |
2136 | 3028 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); |
589 | 3029 |
3318 | 3030 type = clcf->types->elts; |
3031 for (n = 0; n < clcf->types->nelts; n++) { | |
589 | 3032 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { |
3033 old = type[n].value; | |
3034 type[n].value = content_type; | |
3035 | |
3036 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
|
3037 "duplicate extension \"%V\", " |
589 | 3038 "content type: \"%V\", " |
4246
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
3039 "previous content type: \"%V\"", |
589 | 3040 &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
|
3041 goto next; |
589 | 3042 } |
3043 } | |
3044 | |
3045 | |
3318 | 3046 type = ngx_array_push(clcf->types); |
501 | 3047 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
|
3048 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
|
3049 } |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
3050 |
589 | 3051 type->key = value[i]; |
2136 | 3052 type->key_hash = hash; |
589 | 3053 type->value = content_type; |
4241
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3054 |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3055 next: |
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3056 continue; |
88
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 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3059 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
|
3060 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3061 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3062 |
509 | 3063 static ngx_int_t |
3064 ngx_http_core_preconfiguration(ngx_conf_t *cf) | |
3065 { | |
3066 return ngx_http_variables_add_core_vars(cf); | |
3067 } | |
3068 | |
3069 | |
487 | 3070 static void * |
3071 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
|
3072 { |
485 | 3073 ngx_http_core_main_conf_t *cmcf; |
3074 | |
501 | 3075 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t)); |
3076 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
|
3077 return NULL; |
485 | 3078 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3079 |
499 | 3080 if (ngx_array_init(&cmcf->servers, cf->pool, 4, |
569 | 3081 sizeof(ngx_http_core_srv_conf_t *)) |
651 | 3082 != NGX_OK) |
485 | 3083 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3084 return NULL; |
485 | 3085 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3086 |
593 | 3087 cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT; |
3088 cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
477 | 3089 |
611 | 3090 cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT; |
3091 cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3092 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3093 return cmcf; |
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 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3096 |
487 | 3097 static char * |
3098 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
|
3099 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3100 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
|
3101 |
593 | 3102 if (cmcf->server_names_hash_max_size == NGX_CONF_UNSET_UINT) { |
3103 cmcf->server_names_hash_max_size = 512; | |
477 | 3104 } |
3105 | |
593 | 3106 if (cmcf->server_names_hash_bucket_size == NGX_CONF_UNSET_UINT) { |
3107 cmcf->server_names_hash_bucket_size = ngx_cacheline_size; | |
477 | 3108 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3109 |
593 | 3110 cmcf->server_names_hash_bucket_size = |
3111 ngx_align(cmcf->server_names_hash_bucket_size, ngx_cacheline_size); | |
3112 | |
611 | 3113 |
3114 if (cmcf->variables_hash_max_size == NGX_CONF_UNSET_UINT) { | |
3115 cmcf->variables_hash_max_size = 512; | |
3116 } | |
3117 | |
3118 if (cmcf->variables_hash_bucket_size == NGX_CONF_UNSET_UINT) { | |
3119 cmcf->variables_hash_bucket_size = 64; | |
3120 } | |
3121 | |
3122 cmcf->variables_hash_bucket_size = | |
3123 ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size); | |
3124 | |
3345
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3125 if (cmcf->ncaptures) { |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3126 cmcf->ncaptures = (cmcf->ncaptures + 1) * 3; |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3127 } |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3128 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3129 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
|
3130 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3131 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3132 |
487 | 3133 static void * |
3134 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
|
3135 { |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3136 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
|
3137 |
501 | 3138 cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t)); |
3139 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
|
3140 return NULL; |
487 | 3141 } |
3142 | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3143 /* |
487 | 3144 * set by ngx_pcalloc(): |
479 | 3145 * |
3146 * conf->client_large_buffers.num = 0; | |
3147 */ | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3148 |
681 | 3149 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, |
593 | 3150 sizeof(ngx_http_server_name_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3151 != NGX_OK) |
487 | 3152 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3153 return NULL; |
487 | 3154 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3155 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3156 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
|
3157 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
|
3158 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
|
3159 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE; |
511 | 3160 cscf->ignore_invalid_headers = NGX_CONF_UNSET; |
1585 | 3161 cscf->merge_slashes = NGX_CONF_UNSET; |
2256 | 3162 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
|
3163 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3164 return cscf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3165 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3166 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3167 |
487 | 3168 static char * |
3169 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
|
3170 { |
98
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 *prev = parent; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3172 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
|
3173 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3174 ngx_str_t name; |
593 | 3175 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
|
3176 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
3177 /* 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
|
3178 |
3259
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3179 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
|
3180 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
|
3181 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
|
3182 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
|
3183 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
|
3184 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
|
3185 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
|
3186 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
|
3187 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
|
3188 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
|
3189 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
|
3190 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3191 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
|
3192 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
|
3193 "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
|
3194 "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
|
3195 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
|
3196 } |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3197 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3198 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
|
3199 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
|
3200 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3201 ngx_conf_merge_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
|
3202 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3203 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
|
3204 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
|
3205 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3206 if (conf->server_names.nelts == 0) { |
4246
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
3207 /* the array has 4 empty preallocated elements, so push cannot fail */ |
501 | 3208 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
|
3209 #if (NGX_PCRE) |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3210 sn->regex = NULL; |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3211 #endif |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
3212 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
|
3213 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
|
3214 } |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
3215 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3216 sn = conf->server_names.elts; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3217 name = sn[0].name; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3218 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3219 #if (NGX_PCRE) |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3220 if (sn->regex) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3221 name.len++; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3222 name.data--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3223 } else |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3224 #endif |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3225 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3226 if (name.data[0] == '.') { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3227 name.len--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3228 name.data++; |
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 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3231 conf->server_name.len = name.len; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3232 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
|
3233 if (conf->server_name.data == NULL) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3234 return NGX_CONF_ERROR; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3235 } |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3236 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3237 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
|
3238 } |
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
|
3239 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3240 |
487 | 3241 static void * |
3242 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
|
3243 { |
3318 | 3244 ngx_http_core_loc_conf_t *clcf; |
3245 | |
3246 clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t)); | |
3247 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
|
3248 return NULL; |
487 | 3249 } |
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
|
3250 |
479 | 3251 /* |
3252 * set by ngx_pcalloc(): | |
3253 * | |
3318 | 3254 * clcf->root = { 0, NULL }; |
3255 * clcf->limit_except = 0; | |
3256 * clcf->post_action = { 0, NULL }; | |
3257 * clcf->types = NULL; | |
3258 * clcf->default_type = { 0, NULL }; | |
3259 * clcf->error_log = NULL; | |
3260 * clcf->error_pages = NULL; | |
3261 * clcf->try_files = NULL; | |
3262 * clcf->client_body_path = NULL; | |
3263 * clcf->regex = NULL; | |
3264 * clcf->exact_match = 0; | |
3265 * clcf->auto_redirect = 0; | |
3266 * clcf->alias = 0; | |
3267 * clcf->gzip_proxied = 0; | |
4356 | 3268 * clcf->keepalive_disable = 0; |
479 | 3269 */ |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3270 |
3318 | 3271 clcf->client_max_body_size = NGX_CONF_UNSET; |
3272 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | |
3273 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | |
3274 clcf->satisfy = NGX_CONF_UNSET_UINT; | |
3275 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
|
3276 clcf->max_ranges = NGX_CONF_UNSET_UINT; |
3318 | 3277 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3278 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | |
3279 clcf->internal = NGX_CONF_UNSET; | |
3280 clcf->sendfile = NGX_CONF_UNSET; | |
3281 clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; | |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
3282 #if (NGX_HAVE_FILE_AIO) |
3318 | 3283 clcf->aio = NGX_CONF_UNSET; |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
3284 #endif |
3318 | 3285 clcf->read_ahead = NGX_CONF_UNSET_SIZE; |
3286 clcf->directio = NGX_CONF_UNSET; | |
3287 clcf->directio_alignment = NGX_CONF_UNSET; | |
3288 clcf->tcp_nopush = NGX_CONF_UNSET; | |
3289 clcf->tcp_nodelay = NGX_CONF_UNSET; | |
3290 clcf->send_timeout = NGX_CONF_UNSET_MSEC; | |
3291 clcf->send_lowat = NGX_CONF_UNSET_SIZE; | |
3292 clcf->postpone_output = NGX_CONF_UNSET_SIZE; | |
3293 clcf->limit_rate = NGX_CONF_UNSET_SIZE; | |
3294 clcf->limit_rate_after = NGX_CONF_UNSET_SIZE; | |
3295 clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC; | |
3296 clcf->keepalive_header = NGX_CONF_UNSET; | |
3297 clcf->keepalive_requests = NGX_CONF_UNSET_UINT; | |
4042
d9b486dbf7e5
Merge of r3982, r3984, r3985, r3991:
Igor Sysoev <igor@sysoev.ru>
parents:
4040
diff
changeset
|
3298 clcf->lingering_close = NGX_CONF_UNSET_UINT; |
3318 | 3299 clcf->lingering_time = NGX_CONF_UNSET_MSEC; |
3300 clcf->lingering_timeout = NGX_CONF_UNSET_MSEC; | |
3301 clcf->resolver_timeout = NGX_CONF_UNSET_MSEC; | |
3302 clcf->reset_timedout_connection = NGX_CONF_UNSET; | |
3303 clcf->server_name_in_redirect = NGX_CONF_UNSET; | |
3304 clcf->port_in_redirect = NGX_CONF_UNSET; | |
3305 clcf->msie_padding = NGX_CONF_UNSET; | |
3306 clcf->msie_refresh = NGX_CONF_UNSET; | |
3307 clcf->log_not_found = NGX_CONF_UNSET; | |
3308 clcf->log_subrequest = NGX_CONF_UNSET; | |
3309 clcf->recursive_error_pages = NGX_CONF_UNSET; | |
3310 clcf->server_tokens = NGX_CONF_UNSET; | |
3484 | 3311 clcf->chunked_transfer_encoding = NGX_CONF_UNSET; |
3318 | 3312 clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; |
3313 clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3314 | |
3315 clcf->open_file_cache = NGX_CONF_UNSET_PTR; | |
3316 clcf->open_file_cache_valid = NGX_CONF_UNSET; | |
3317 clcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT; | |
3318 clcf->open_file_cache_errors = NGX_CONF_UNSET; | |
3319 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
|
3320 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3321 #if (NGX_HTTP_GZIP) |
3318 | 3322 clcf->gzip_vary = NGX_CONF_UNSET; |
3323 clcf->gzip_http_version = NGX_CONF_UNSET_UINT; | |
1800 | 3324 #if (NGX_PCRE) |
3318 | 3325 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
|
3326 #endif |
3318 | 3327 clcf->gzip_disable_msie6 = 3; |
3773 | 3328 #if (NGX_HTTP_DEGRADATION) |
3329 clcf->gzip_disable_degradation = 3; | |
3330 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3331 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3332 |
3318 | 3333 return clcf; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3334 } |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3335 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3336 |
589 | 3337 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html"); |
3338 static ngx_str_t ngx_http_core_image_gif_type = ngx_string("image/gif"); | |
3339 static ngx_str_t ngx_http_core_image_jpeg_type = ngx_string("image/jpeg"); | |
3340 | |
3341 static ngx_hash_key_t ngx_http_core_default_types[] = { | |
3342 { ngx_string("html"), 0, &ngx_http_core_text_html_type }, | |
3343 { ngx_string("gif"), 0, &ngx_http_core_image_gif_type }, | |
3344 { ngx_string("jpg"), 0, &ngx_http_core_image_jpeg_type }, | |
3345 { 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
|
3346 }; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3347 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3348 |
487 | 3349 static char * |
589 | 3350 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
|
3351 { |
98
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 *prev = parent; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3353 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
|
3354 |
487 | 3355 ngx_uint_t i; |
589 | 3356 ngx_hash_key_t *type; |
3357 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
|
3358 |
603 | 3359 if (conf->root.data == NULL) { |
3360 | |
625 | 3361 conf->alias = prev->alias; |
603 | 3362 conf->root = prev->root; |
3363 conf->root_lengths = prev->root_lengths; | |
3364 conf->root_values = prev->root_values; | |
3365 | |
3366 if (prev->root.data == NULL) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
3367 ngx_str_set(&conf->root, "html"); |
603 | 3368 |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3369 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { |
603 | 3370 return NGX_CONF_ERROR; |
3371 } | |
3372 } | |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3373 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3374 |
577 | 3375 if (conf->post_action.data == NULL) { |
3376 conf->post_action = prev->post_action; | |
3377 } | |
3378 | |
663 | 3379 ngx_conf_merge_uint_value(conf->types_hash_max_size, |
3380 prev->types_hash_max_size, 1024); | |
3381 | |
3382 ngx_conf_merge_uint_value(conf->types_hash_bucket_size, | |
3383 prev->types_hash_bucket_size, | |
3384 ngx_cacheline_size); | |
589 | 3385 |
3386 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size, | |
3387 ngx_cacheline_size); | |
3388 | |
3389 /* | |
4241
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3390 * the special handling of the "types" directive in the "http" section |
589 | 3391 * to inherit the http's conf->types_hash to all servers |
3392 */ | |
3393 | |
3394 if (prev->types && prev->types_hash.buckets == NULL) { | |
3395 | |
3396 types_hash.hash = &prev->types_hash; | |
3397 types_hash.key = ngx_hash_key_lc; | |
3398 types_hash.max_size = conf->types_hash_max_size; | |
3399 types_hash.bucket_size = conf->types_hash_bucket_size; | |
595 | 3400 types_hash.name = "types_hash"; |
589 | 3401 types_hash.pool = cf->pool; |
3402 types_hash.temp_pool = NULL; | |
3403 | |
3404 if (ngx_hash_init(&types_hash, prev->types->elts, prev->types->nelts) | |
3405 != NGX_OK) | |
3406 { | |
3407 return NGX_CONF_ERROR; | |
3408 } | |
3409 } | |
3410 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3411 if (conf->types == NULL) { |
589 | 3412 conf->types = prev->types; |
3413 conf->types_hash = prev->types_hash; | |
3414 } | |
3415 | |
3416 if (conf->types == NULL) { | |
4241
6afb20bf2ad5
Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Igor Sysoev <igor@sysoev.ru>
parents:
4162
diff
changeset
|
3417 conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t)); |
589 | 3418 if (conf->types == NULL) { |
3419 return NGX_CONF_ERROR; | |
3420 } | |
3421 | |
3422 for (i = 0; ngx_http_core_default_types[i].key.len; i++) { | |
3423 type = ngx_array_push(conf->types); | |
3424 if (type == NULL) { | |
487 | 3425 return NGX_CONF_ERROR; |
3426 } | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3427 |
589 | 3428 type->key = ngx_http_core_default_types[i].key; |
3429 type->key_hash = | |
3430 ngx_hash_key_lc(ngx_http_core_default_types[i].key.data, | |
3431 ngx_http_core_default_types[i].key.len); | |
3432 type->value = ngx_http_core_default_types[i].value; | |
3433 } | |
3434 } | |
3435 | |
3436 if (conf->types_hash.buckets == NULL) { | |
3437 | |
3438 types_hash.hash = &conf->types_hash; | |
3439 types_hash.key = ngx_hash_key_lc; | |
3440 types_hash.max_size = conf->types_hash_max_size; | |
3441 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
|
3442 types_hash.name = "types_hash"; |
589 | 3443 types_hash.pool = cf->pool; |
3444 types_hash.temp_pool = NULL; | |
3445 | |
3446 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) | |
3447 != NGX_OK) | |
3448 { | |
3449 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
|
3450 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3451 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3452 |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3453 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
|
3454 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
|
3455 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
|
3456 } else { |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3457 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
|
3458 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3459 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3460 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3461 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
|
3462 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
|
3463 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3464 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3465 ngx_conf_merge_str_value(conf->default_type, |
487 | 3466 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
|
3467 |
663 | 3468 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
|
3469 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
|
3470 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
|
3471 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
|
3472 (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
|
3473 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
|
3474 prev->client_body_timeout, 60000); |
509 | 3475 |
4356 | 3476 ngx_conf_merge_bitmask_value(conf->keepalive_disable, |
3477 prev->keepalive_disable, | |
3478 (NGX_CONF_BITMASK_SET | |
3479 |NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 | |
3480 |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)); | |
1806 | 3481 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3482 NGX_HTTP_SATISFY_ALL); | |
2361 | 3483 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
2496 | 3484 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
|
3485 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
|
3486 NGX_MAX_INT32_VALUE); |
2841
faafc084a7a4
fix client_body_in_file_only type
Igor Sysoev <igor@sysoev.ru>
parents:
2820
diff
changeset
|
3487 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
|
3488 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
|
3489 NGX_HTTP_REQUEST_BODY_FILE_OFF); |
2845 | 3490 ngx_conf_merge_value(conf->client_body_in_single_buffer, |
3491 prev->client_body_in_single_buffer, 0); | |
509 | 3492 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
|
3493 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); |
1197 | 3494 ngx_conf_merge_size_value(conf->sendfile_max_chunk, |
3495 prev->sendfile_max_chunk, 0); | |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
3496 #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
|
3497 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
|
3498 #endif |
3178 | 3499 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); |
2129 | 3500 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
|
3501 NGX_OPEN_FILE_DIRECTIO_OFF); |
3053 | 3502 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, |
3503 512); | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
3504 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); |
679 | 3505 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); |
509 | 3506 |
253
b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
3507 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
|
3508 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
|
3509 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
|
3510 1460); |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
3511 ngx_conf_merge_size_value(conf->limit_rate, prev->limit_rate, 0); |
2907 | 3512 ngx_conf_merge_size_value(conf->limit_rate_after, prev->limit_rate_after, |
3513 0); | |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3514 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
|
3515 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
|
3516 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
|
3517 prev->keepalive_header, 0); |
2888 | 3518 ngx_conf_merge_uint_value(conf->keepalive_requests, |
3519 prev->keepalive_requests, 100); | |
4042
d9b486dbf7e5
Merge of r3982, r3984, r3985, r3991:
Igor Sysoev <igor@sysoev.ru>
parents:
4040
diff
changeset
|
3520 ngx_conf_merge_uint_value(conf->lingering_close, |
d9b486dbf7e5
Merge of r3982, r3984, r3985, r3991:
Igor Sysoev <igor@sysoev.ru>
parents:
4040
diff
changeset
|
3521 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
|
3522 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
|
3523 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
|
3524 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
|
3525 prev->lingering_timeout, 5000); |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3526 ngx_conf_merge_msec_value(conf->resolver_timeout, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3527 prev->resolver_timeout, 30000); |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3528 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3529 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
|
3530 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3531 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
|
3532 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3533 /* |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3534 * 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
|
3535 * 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
|
3536 */ |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3537 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3538 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
|
3539 if (prev->resolver == NULL) { |
1881 | 3540 return NGX_CONF_ERROR; |
1683
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3541 } |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3542 } |
2006
b52cb9bf2064
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1982
diff
changeset
|
3543 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3544 conf->resolver = prev->resolver; |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3545 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3546 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3547 if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path, |
479 | 3548 prev->client_body_temp_path, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3549 &ngx_http_client_temp_path) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3550 != NGX_OK) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3551 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3552 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3553 } |
479 | 3554 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
3555 ngx_conf_merge_value(conf->reset_timedout_connection, |
487 | 3556 prev->reset_timedout_connection, 0); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
3557 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
|
3558 prev->server_name_in_redirect, 0); |
521 | 3559 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
|
3560 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1); |
679 | 3561 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); |
527 | 3562 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); |
2261 | 3563 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); |
679 | 3564 ngx_conf_merge_value(conf->recursive_error_pages, |
3565 prev->recursive_error_pages, 0); | |
1592 | 3566 ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1); |
3484 | 3567 ngx_conf_merge_value(conf->chunked_transfer_encoding, |
3568 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
|
3569 |
1454 | 3570 ngx_conf_merge_ptr_value(conf->open_file_cache, |
1780 | 3571 prev->open_file_cache, NULL); |
1454 | 3572 |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
3573 ngx_conf_merge_sec_value(conf->open_file_cache_valid, |
1780 | 3574 prev->open_file_cache_valid, 60); |
1454 | 3575 |
1772 | 3576 ngx_conf_merge_uint_value(conf->open_file_cache_min_uses, |
1780 | 3577 prev->open_file_cache_min_uses, 1); |
1772 | 3578 |
1454 | 3579 ngx_conf_merge_sec_value(conf->open_file_cache_errors, |
1780 | 3580 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
|
3581 |
1457 | 3582 ngx_conf_merge_sec_value(conf->open_file_cache_events, |
1780 | 3583 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
|
3584 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3585 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3586 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
|
3587 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
|
3588 NGX_HTTP_VERSION_11); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3589 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
|
3590 (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
|
3591 |
1800 | 3592 #if (NGX_PCRE) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3593 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL); |
1800 | 3594 #endif |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3595 |
2205 | 3596 if (conf->gzip_disable_msie6 == 3) { |
3597 conf->gzip_disable_msie6 = | |
3598 (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6; | |
3599 } | |
3600 | |
3773 | 3601 #if (NGX_HTTP_DEGRADATION) |
3602 | |
3603 if (conf->gzip_disable_degradation == 3) { | |
3604 conf->gzip_disable_degradation = | |
3605 (prev->gzip_disable_degradation == 3) ? | |
3606 0 : prev->gzip_disable_degradation; | |
3607 } | |
3608 | |
3609 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3610 #endif |
1457 | 3611 |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3612 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
|
3613 } |
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3614 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3615 |
487 | 3616 static char * |
3617 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
|
3618 { |
3217 | 3619 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
|
3620 |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3621 ngx_str_t *value, size; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3622 ngx_url_t u; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3623 ngx_uint_t n; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3624 ngx_http_listen_opt_t lsopt; |
3217 | 3625 |
3626 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
|
3627 |
523 | 3628 value = cf->args->elts; |
577 | 3629 |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3630 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
|
3631 |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3632 u.url = value[1]; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3633 u.listen = 1; |
906 | 3634 u.default_port = 80; |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3635 |
1559
fe11e2a3946d
use pool instead of ngx_conf_t
Igor Sysoev <igor@sysoev.ru>
parents:
1546
diff
changeset
|
3636 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
|
3637 if (u.err) { |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3638 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
|
3639 "%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
|
3640 u.err, &u.url); |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3641 } |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3642 |
577 | 3643 return NGX_CONF_ERROR; |
523 | 3644 } |
3645 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3646 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
|
3647 |
3395
4e15548b29d4
fix building by gcc 4.4 with -O2/3/s:
Igor Sysoev <igor@sysoev.ru>
parents:
3390
diff
changeset
|
3648 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
|
3649 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3650 lsopt.socklen = u.socklen; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3651 lsopt.backlog = NGX_LISTEN_BACKLOG; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3652 lsopt.rcvbuf = -1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3653 lsopt.sndbuf = -1; |
3676 | 3654 #if (NGX_HAVE_SETFIB) |
3655 lsopt.setfib = -1; | |
3656 #endif | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3657 lsopt.wildcard = u.wildcard; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3658 |
3395
4e15548b29d4
fix building by gcc 4.4 with -O2/3/s:
Igor Sysoev <igor@sysoev.ru>
parents:
3390
diff
changeset
|
3659 (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
|
3660 NGX_SOCKADDR_STRLEN, 1); |
631 | 3661 |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
3662 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
|
3663 |
3225
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
3664 if (ngx_strcmp(value[n].data, "default_server") == 0 |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
3665 || ngx_strcmp(value[n].data, "default") == 0) |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
3666 { |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
3667 lsopt.default_server = 1; |
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
3668 continue; |
523 | 3669 } |
3670 | |
3671 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
|
3672 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3673 lsopt.bind = 1; |
523 | 3674 continue; |
3675 } | |
3676 | |
3676 | 3677 #if (NGX_HAVE_SETFIB) |
3678 if (ngx_strncmp(value[n].data, "setfib=", 7) == 0) { | |
3679 lsopt.setfib = ngx_atoi(value[n].data + 7, value[n].len - 7); | |
3680 | |
3687 | 3681 if (lsopt.setfib == NGX_ERROR) { |
3676 | 3682 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3683 "invalid setfib \"%V\"", &value[n]); | |
3684 return NGX_CONF_ERROR; | |
3685 } | |
3686 | |
3687 continue; | |
3688 } | |
3689 #endif | |
563 | 3690 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
|
3691 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
|
3692 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3693 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3694 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3695 if (lsopt.backlog == NGX_ERROR || lsopt.backlog == 0) { |
523 | 3696 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3697 "invalid backlog \"%V\"", &value[n]); | |
3698 return NGX_CONF_ERROR; | |
3699 } | |
3700 | |
3701 continue; | |
3702 } | |
3703 | |
563 | 3704 if (ngx_strncmp(value[n].data, "rcvbuf=", 7) == 0) { |
3705 size.len = value[n].len - 7; | |
3706 size.data = value[n].data + 7; | |
3707 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3708 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
|
3709 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3710 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3711 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3712 if (lsopt.rcvbuf == NGX_ERROR) { |
563 | 3713 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3714 "invalid rcvbuf \"%V\"", &value[n]); | |
3715 return NGX_CONF_ERROR; | |
3716 } | |
3717 | |
3718 continue; | |
3719 } | |
3720 | |
3721 if (ngx_strncmp(value[n].data, "sndbuf=", 7) == 0) { | |
3722 size.len = value[n].len - 7; | |
3723 size.data = value[n].data + 7; | |
3724 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3725 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
|
3726 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3727 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3728 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3729 if (lsopt.sndbuf == NGX_ERROR) { |
563 | 3730 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3731 "invalid sndbuf \"%V\"", &value[n]); | |
3732 return NGX_CONF_ERROR; | |
3733 } | |
3734 | |
3735 continue; | |
3736 } | |
3737 | |
3738 if (ngx_strncmp(value[n].data, "accept_filter=", 14) == 0) { | |
523 | 3739 #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
|
3740 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
|
3741 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3742 lsopt.bind = 1; |
523 | 3743 #else |
3744 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3745 "accept filters \"%V\" are not supported " | |
3746 "on this platform, ignored", | |
3747 &value[n]); | |
3748 #endif | |
3749 continue; | |
3750 } | |
3751 | |
3752 if (ngx_strcmp(value[n].data, "deferred") == 0) { | |
3753 #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
|
3754 lsopt.deferred_accept = 1; |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
3755 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3756 lsopt.bind = 1; |
523 | 3757 #else |
3758 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3759 "the deferred accept is not supported " | |
3760 "on this platform, ignored"); | |
3761 #endif | |
3762 continue; | |
3763 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3764 |
2562 | 3765 if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) { |
3766 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) | |
3767 struct sockaddr *sa; | |
3768 | |
3395
4e15548b29d4
fix building by gcc 4.4 with -O2/3/s:
Igor Sysoev <igor@sysoev.ru>
parents:
3390
diff
changeset
|
3769 sa = &lsopt.u.sockaddr; |
2562 | 3770 |
3771 if (sa->sa_family == AF_INET6) { | |
3772 | |
3773 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
|
3774 lsopt.ipv6only = 1; |
2562 | 3775 |
3776 } 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
|
3777 lsopt.ipv6only = 2; |
2562 | 3778 |
3779 } else { | |
3780 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3781 "invalid ipv6only flags \"%s\"", | |
3782 &value[n].data[9]); | |
3783 return NGX_CONF_ERROR; | |
3784 } | |
3785 | |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
3786 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3787 lsopt.bind = 1; |
2562 | 3788 |
3789 } else { | |
3790 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3791 "ipv6only is not supported " | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3792 "on addr \"%s\", ignored", lsopt.addr); |
2562 | 3793 } |
3794 | |
3795 continue; | |
3796 #else | |
3797 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
|
3798 "ipv6only is not supported " |
2562 | 3799 "on this platform"); |
3800 return NGX_CONF_ERROR; | |
3801 #endif | |
3802 } | |
3803 | |
2224 | 3804 if (ngx_strcmp(value[n].data, "ssl") == 0) { |
3805 #if (NGX_HTTP_SSL) | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3806 lsopt.ssl = 1; |
2224 | 3807 continue; |
3808 #else | |
3809 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3810 "the \"ssl\" parameter requires " | |
3811 "ngx_http_ssl_module"); | |
3812 return NGX_CONF_ERROR; | |
3813 #endif | |
3814 } | |
3815 | |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
3816 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
|
3817 "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
|
3818 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
|
3819 } |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3820 |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3821 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { |
3217 | 3822 return NGX_CONF_OK; |
3823 } | |
3824 | |
3825 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
|
3826 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3827 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3828 |
487 | 3829 static char * |
3830 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
|
3831 { |
593 | 3832 ngx_http_core_srv_conf_t *cscf = conf; |
3833 | |
3834 u_char ch; | |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3835 ngx_str_t *value; |
593 | 3836 ngx_uint_t i; |
3837 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
|
3838 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3839 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
|
3840 |
593 | 3841 for (i = 1; i < cf->args->nelts; i++) { |
3842 | |
3843 ch = value[i].data[0]; | |
3844 | |
2195 | 3845 if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.')) |
593 | 3846 || (ch == '.' && value[i].len < 2)) |
3847 { | |
3848 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3849 "server name \"%V\" is invalid", &value[i]); | |
3850 return NGX_CONF_ERROR; | |
3851 } | |
3852 | |
1157 | 3853 if (ngx_strchr(value[i].data, '/')) { |
3854 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
|
3855 "server name \"%V\" has suspicious symbols", |
1157 | 3856 &value[i]); |
3857 } | |
3858 | |
593 | 3859 sn = ngx_array_push(&cscf->server_names); |
501 | 3860 if (sn == NULL) { |
455 | 3861 return NGX_CONF_ERROR; |
3862 } | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3863 |
1387 | 3864 #if (NGX_PCRE) |
3865 sn->regex = NULL; | |
3866 #endif | |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
3867 sn->server = cscf; |
3855 | 3868 |
3869 if (ngx_strcasecmp(value[i].data, (u_char *) "$hostname") == 0) { | |
3870 sn->name = cf->cycle->hostname; | |
3871 | |
3872 } else { | |
3873 sn->name = value[i]; | |
3874 } | |
1387 | 3875 |
3876 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
|
3877 ngx_strlow(sn->name.data, sn->name.data, sn->name.len); |
1387 | 3878 continue; |
3879 } | |
3880 | |
3881 #if (NGX_PCRE) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
3882 { |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3883 u_char *p; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3884 ngx_regex_compile_t rc; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3885 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
|
3886 |
3122
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
3887 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
|
3888 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
|
3889 "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
|
3890 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
|
3891 } |
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
3892 |
1387 | 3893 value[i].len--; |
3894 value[i].data++; | |
3895 | |
3325 | 3896 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
3897 | |
3898 rc.pattern = value[i]; | |
3899 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
3900 rc.err.data = errstr; | |
3901 | |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3902 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
|
3903 if (*p >= 'A' && *p <= 'Z') { |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3904 rc.options = NGX_REGEX_CASELESS; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3905 break; |
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 } |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
3908 |
3325 | 3909 sn->regex = ngx_http_regex_compile(cf, &rc); |
1387 | 3910 if (sn->regex == NULL) { |
3911 return NGX_CONF_ERROR; | |
3912 } | |
3913 | |
1781 | 3914 sn->name = value[i]; |
3325 | 3915 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
|
3916 } |
1387 | 3917 #else |
3918 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
|
3919 "using regex \"%V\" " |
1387 | 3920 "requires PCRE library", &value[i]); |
3921 | |
3922 return NGX_CONF_ERROR; | |
3923 #endif | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3924 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3925 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
3926 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
|
3927 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
3928 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
3929 |
487 | 3930 static char * |
3931 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
|
3932 { |
3318 | 3933 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
|
3934 |
595 | 3935 ngx_str_t *value; |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
3936 ngx_int_t alias; |
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
3937 ngx_uint_t n; |
595 | 3938 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
|
3939 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3940 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
|
3941 |
3318 | 3942 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
|
3943 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
3944 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
|
3945 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3946 "\"%V\" directive is duplicate", |
3947 &cmd->name); | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3948 } else { |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3949 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3950 "\"%V\" directive is duplicate, " |
4246
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
3951 "\"%s\" directive was specified earlier", |
3318 | 3952 &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
|
3953 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3954 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3955 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
|
3956 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3957 |
3318 | 3958 if (clcf->named && alias) { |
1353 | 3959 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
|
3960 "the \"alias\" directive cannot be used " |
d3568507db51
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Igor Sysoev <igor@sysoev.ru>
parents:
4241
diff
changeset
|
3961 "inside the named location"); |
1353 | 3962 |
3963 return NGX_CONF_ERROR; | |
3964 } | |
3965 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3966 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
|
3967 |
1156 | 3968 if (ngx_strstr(value[1].data, "$document_root") |
3969 || 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
|
3970 { |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3971 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
|
3972 "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
|
3973 "in the \"%V\" directive", |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3974 &cmd->name); |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3975 |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3976 return NGX_CONF_ERROR; |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3977 } |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
3978 |
2263
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3979 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
|
3980 || 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
|
3981 { |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3982 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
|
3983 "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
|
3984 "in the \"%V\" directive", |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3985 &cmd->name); |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3986 |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3987 return NGX_CONF_ERROR; |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3988 } |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
3989 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
3990 clcf->alias = alias ? clcf->name.len : 0; |
3318 | 3991 clcf->root = value[1]; |
3992 | |
3993 if (!alias && clcf->root.data[clcf->root.len - 1] == '/') { | |
3994 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
|
3995 } |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
3996 |
3318 | 3997 if (clcf->root.data[0] != '$') { |
3998 if (ngx_conf_full_name(cf->cycle, &clcf->root, 0) != NGX_OK) { | |
667 | 3999 return NGX_CONF_ERROR; |
4000 } | |
603 | 4001 } |
4002 | |
3318 | 4003 n = ngx_http_script_variables_count(&clcf->root); |
595 | 4004 |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4005 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
|
4006 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
|
4007 |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4008 #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
|
4009 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
|
4010 n = 1; |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4011 } |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4012 #endif |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4013 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4014 if (n) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4015 sc.cf = cf; |
3318 | 4016 sc.source = &clcf->root; |
4017 sc.lengths = &clcf->root_lengths; | |
4018 sc.values = &clcf->root_values; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4019 sc.complete_lengths = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4020 sc.complete_values = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4021 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4022 if (ngx_http_script_compile(&sc) != NGX_OK) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4023 return NGX_CONF_ERROR; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4024 } |
595 | 4025 } |
4026 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4027 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
|
4028 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4029 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4030 |
631 | 4031 static ngx_http_method_name_t ngx_methods_names[] = { |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4032 { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4033 { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4034 { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4035 { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4036 { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4037 { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4038 { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4039 { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4040 { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4041 { (u_char *) "PROPFIND" , (uint32_t) ~NGX_HTTP_PROPFIND }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4042 { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4043 { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
4044 { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, |
3613 | 4045 { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH }, |
631 | 4046 { NULL, 0 } |
4047 }; | |
4048 | |
4049 | |
4050 static char * | |
4051 ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4052 { | |
2027 | 4053 ngx_http_core_loc_conf_t *pclcf = conf; |
631 | 4054 |
4055 char *rv; | |
4056 void *mconf; | |
4057 ngx_str_t *value; | |
4058 ngx_uint_t i; | |
4059 ngx_conf_t save; | |
4060 ngx_http_module_t *module; | |
4061 ngx_http_conf_ctx_t *ctx, *pctx; | |
4062 ngx_http_method_name_t *name; | |
2027 | 4063 ngx_http_core_loc_conf_t *clcf; |
4064 | |
4065 if (pclcf->limit_except) { | |
631 | 4066 return "duplicate"; |
4067 } | |
4068 | |
2027 | 4069 pclcf->limit_except = 0xffffffff; |
631 | 4070 |
4071 value = cf->args->elts; | |
4072 | |
4073 for (i = 1; i < cf->args->nelts; i++) { | |
4074 for (name = ngx_methods_names; name->name; name++) { | |
4075 | |
4076 if (ngx_strcasecmp(value[i].data, name->name) == 0) { | |
2027 | 4077 pclcf->limit_except &= name->method; |
631 | 4078 goto next; |
4079 } | |
4080 } | |
4081 | |
4082 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4083 "invalid method \"%V\"", &value[i]); | |
4084 return NGX_CONF_ERROR; | |
4085 | |
4086 next: | |
4087 continue; | |
4088 } | |
4089 | |
2027 | 4090 if (!(pclcf->limit_except & NGX_HTTP_GET)) { |
4091 pclcf->limit_except &= (uint32_t) ~NGX_HTTP_HEAD; | |
631 | 4092 } |
4093 | |
4094 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); | |
4095 if (ctx == NULL) { | |
4096 return NGX_CONF_ERROR; | |
4097 } | |
4098 | |
4099 pctx = cf->ctx; | |
4100 ctx->main_conf = pctx->main_conf; | |
4101 ctx->srv_conf = pctx->srv_conf; | |
4102 | |
4103 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | |
4104 if (ctx->loc_conf == NULL) { | |
4105 return NGX_CONF_ERROR; | |
4106 } | |
4107 | |
4108 for (i = 0; ngx_modules[i]; i++) { | |
4109 if (ngx_modules[i]->type != NGX_HTTP_MODULE) { | |
4110 continue; | |
4111 } | |
4112 | |
4113 module = ngx_modules[i]->ctx; | |
4114 | |
4115 if (module->create_loc_conf) { | |
4116 | |
4117 mconf = module->create_loc_conf(cf); | |
4118 if (mconf == NULL) { | |
4119 return NGX_CONF_ERROR; | |
4120 } | |
4121 | |
4122 ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; | |
4123 } | |
4124 } | |
4125 | |
4126 | |
2027 | 4127 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |
4128 pclcf->limit_except_loc_conf = ctx->loc_conf; | |
4129 clcf->loc_conf = ctx->loc_conf; | |
4130 clcf->name = pclcf->name; | |
4131 clcf->noname = 1; | |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3721
diff
changeset
|
4132 clcf->lmt_excpt = 1; |
2027 | 4133 |
4134 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { | |
631 | 4135 return NGX_CONF_ERROR; |
4136 } | |
4137 | |
4138 save = *cf; | |
4139 cf->ctx = ctx; | |
4140 cf->cmd_type = NGX_HTTP_LMT_CONF; | |
4141 | |
4142 rv = ngx_conf_parse(cf, NULL); | |
4143 | |
4144 *cf = save; | |
4145 | |
4146 return rv; | |
4147 } | |
4148 | |
4149 | |
487 | 4150 static char * |
2129 | 4151 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4152 { | |
4153 ngx_http_core_loc_conf_t *clcf = conf; | |
4154 | |
4155 ngx_str_t *value; | |
4156 | |
4157 if (clcf->directio != NGX_CONF_UNSET) { | |
4158 return "is duplicate"; | |
4159 } | |
4160 | |
4161 value = cf->args->elts; | |
4162 | |
4163 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2277 | 4164 clcf->directio = NGX_OPEN_FILE_DIRECTIO_OFF; |
2129 | 4165 return NGX_CONF_OK; |
4166 } | |
4167 | |
4168 clcf->directio = ngx_parse_offset(&value[1]); | |
4169 if (clcf->directio == (off_t) NGX_ERROR) { | |
4170 return "invalid value"; | |
4171 } | |
4172 | |
4173 return NGX_CONF_OK; | |
4174 } | |
4175 | |
4176 | |
4177 static char * | |
487 | 4178 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
|
4179 { |
3318 | 4180 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
|
4181 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4182 u_char *p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4183 ngx_int_t overwrite; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4184 ngx_str_t *value, uri, args; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4185 ngx_uint_t i, n; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4186 ngx_http_err_page_t *err; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4187 ngx_http_complex_value_t cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4188 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
|
4189 |
3318 | 4190 if (clcf->error_pages == NULL) { |
4191 clcf->error_pages = ngx_array_create(cf->pool, 4, | |
4192 sizeof(ngx_http_err_page_t)); | |
4193 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
|
4194 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
|
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 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4198 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
|
4199 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4200 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
|
4201 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4202 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
|
4203 if (i == 1) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4204 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4205 "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
|
4206 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
|
4207 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4208 |
555 | 4209 if (value[i].len > 1) { |
4210 overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1); | |
4211 | |
4212 if (overwrite == NGX_ERROR) { | |
4213 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4214 "invalid value \"%V\"", &value[i]); | |
4215 return NGX_CONF_ERROR; | |
4216 } | |
4217 | |
4218 } else { | |
4219 overwrite = 0; | |
323
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 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4222 n = 2; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4223 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4224 } else { |
555 | 4225 overwrite = -1; |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4226 n = 1; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4227 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4228 |
673 | 4229 uri = value[cf->args->nelts - 1]; |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4230 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4231 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
|
4232 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4233 ccv.cf = cf; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4234 ccv.value = &uri; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4235 ccv.complex_value = &cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4236 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4237 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
|
4238 return NGX_CONF_ERROR; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4239 } |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4240 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
4241 ngx_str_null(&args); |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4242 |
2685
6c8a5165ed2a
fix r2590: error_page made an external redirect without query string
Igor Sysoev <igor@sysoev.ru>
parents:
2607
diff
changeset
|
4243 if (cv.lengths == NULL && uri.data[0] == '/') { |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4244 p = (u_char *) ngx_strchr(uri.data, '?'); |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4245 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4246 if (p) { |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4247 cv.value.len = p - uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4248 cv.value.data = uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4249 p++; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4250 args.len = (uri.data + uri.len) - p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4251 args.data = p; |
673 | 4252 } |
4253 } | |
4254 | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4255 for (i = 1; i < cf->args->nelts - n; i++) { |
3318 | 4256 err = ngx_array_push(clcf->error_pages); |
501 | 4257 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
|
4258 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
|
4259 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4260 |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
4261 err->status = ngx_atoi(value[i].data, value[i].len); |
487 | 4262 |
715 | 4263 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
|
4264 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4265 "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
|
4266 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
|
4267 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4268 |
3401
9e7926763f87
allow to handle 301/302 in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3395
diff
changeset
|
4269 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
|
4270 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
|
4271 "value \"%V\" must be between 300 and 599", |
461 | 4272 &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
|
4273 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
|
4274 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4275 |
3781
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4276 err->overwrite = overwrite; |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4277 |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4278 if (overwrite == -1) { |
1923
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4279 switch (err->status) { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4280 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
|
4281 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
|
4282 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
|
4283 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
|
4284 default: |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4285 break; |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4286 } |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4287 } |
555 | 4288 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4289 err->value = cv; |
2591 | 4290 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
|
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 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4293 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
|
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 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4296 |
487 | 4297 static char * |
2407 | 4298 ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4299 { | |
4300 ngx_http_core_loc_conf_t *clcf = conf; | |
4301 | |
4302 ngx_str_t *value; | |
2695 | 4303 ngx_int_t code; |
2407 | 4304 ngx_uint_t i, n; |
4305 ngx_http_try_file_t *tf; | |
4306 ngx_http_script_compile_t sc; | |
4307 ngx_http_core_main_conf_t *cmcf; | |
4308 | |
4309 if (clcf->try_files) { | |
4310 return "is duplicate"; | |
4311 } | |
4312 | |
4313 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); | |
4314 | |
4315 cmcf->try_files = 1; | |
4316 | |
4317 tf = ngx_pcalloc(cf->pool, cf->args->nelts * sizeof(ngx_http_try_file_t)); | |
4318 if (tf == NULL) { | |
4319 return NGX_CONF_ERROR; | |
4320 } | |
4321 | |
4322 clcf->try_files = tf; | |
4323 | |
4324 value = cf->args->elts; | |
4325 | |
4326 for (i = 0; i < cf->args->nelts - 1; i++) { | |
4327 | |
4328 tf[i].name = value[i + 1]; | |
4329 | |
2458
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
4330 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
|
4331 tf[i].test_dir = 1; |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
4332 tf[i].name.len--; |
2584
91e287d78d90
fix directory test in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2579
diff
changeset
|
4333 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
|
4334 } |
43dcf8cc2cb1
allow directories in try_files
Igor Sysoev <igor@sysoev.ru>
parents:
2453
diff
changeset
|
4335 |
2407 | 4336 n = ngx_http_script_variables_count(&tf[i].name); |
4337 | |
4338 if (n) { | |
4339 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
4340 | |
4341 sc.cf = cf; | |
4342 sc.source = &tf[i].name; | |
4343 sc.lengths = &tf[i].lengths; | |
4344 sc.values = &tf[i].values; | |
4345 sc.variables = n; | |
4346 sc.complete_lengths = 1; | |
4347 sc.complete_values = 1; | |
4348 | |
4349 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
4350 return NGX_CONF_ERROR; | |
4351 } | |
4352 | |
4353 } else { | |
4354 /* add trailing '\0' to length */ | |
4355 tf[i].name.len++; | |
4356 } | |
4357 } | |
4358 | |
2695 | 4359 if (tf[i - 1].name.data[0] == '=') { |
4360 | |
4361 code = ngx_atoi(tf[i - 1].name.data + 1, tf[i - 1].name.len - 2); | |
4362 | |
4363 if (code == NGX_ERROR) { | |
4364 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4365 "invalid code \"%*s\"", | |
4366 tf[i - 1].name.len - 1, tf[i - 1].name.data); | |
4367 return NGX_CONF_ERROR; | |
4368 } | |
4369 | |
4370 tf[i].code = code; | |
4371 } | |
4372 | |
2407 | 4373 return NGX_CONF_OK; |
4374 } | |
4375 | |
4376 | |
4377 static char * | |
1454 | 4378 ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4379 { | |
3318 | 4380 ngx_http_core_loc_conf_t *clcf = conf; |
1454 | 4381 |
4382 time_t inactive; | |
4383 ngx_str_t *value, s; | |
4384 ngx_int_t max; | |
4385 ngx_uint_t i; | |
4386 | |
3318 | 4387 if (clcf->open_file_cache != NGX_CONF_UNSET_PTR) { |
1454 | 4388 return "is duplicate"; |
4389 } | |
4390 | |
4391 value = cf->args->elts; | |
4392 | |
4393 max = 0; | |
4394 inactive = 60; | |
4395 | |
4396 for (i = 1; i < cf->args->nelts; i++) { | |
4397 | |
4398 if (ngx_strncmp(value[i].data, "max=", 4) == 0) { | |
4399 | |
4400 max = ngx_atoi(value[i].data + 4, value[i].len - 4); | |
4357 | 4401 if (max <= 0) { |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4402 goto failed; |
1454 | 4403 } |
4404 | |
4405 continue; | |
4406 } | |
4407 | |
4408 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) { | |
4409 | |
4410 s.len = value[i].len - 9; | |
4411 s.data = value[i].data + 9; | |
4412 | |
4413 inactive = ngx_parse_time(&s, 1); | |
4414 if (inactive < 0) { | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4415 goto failed; |
1454 | 4416 } |
4417 | |
4418 continue; | |
4419 } | |
4420 | |
4421 if (ngx_strcmp(value[i].data, "off") == 0) { | |
4422 | |
3318 | 4423 clcf->open_file_cache = NULL; |
1454 | 4424 |
4425 continue; | |
4426 } | |
4427 | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4428 failed: |
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4429 |
1454 | 4430 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4431 "invalid \"open_file_cache\" parameter \"%V\"", | |
4432 &value[i]); | |
4433 return NGX_CONF_ERROR; | |
4434 } | |
4435 | |
3318 | 4436 if (clcf->open_file_cache == NULL) { |
1454 | 4437 return NGX_CONF_OK; |
4438 } | |
4439 | |
4440 if (max == 0) { | |
4441 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
|
4442 "\"open_file_cache\" must have the \"max\" parameter"); |
1454 | 4443 return NGX_CONF_ERROR; |
4444 } | |
4445 | |
3318 | 4446 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); |
4447 if (clcf->open_file_cache) { | |
1454 | 4448 return NGX_CONF_OK; |
4449 } | |
4450 | |
4451 return NGX_CONF_ERROR; | |
4452 } | |
4453 | |
4454 | |
4455 static char * | |
509 | 4456 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4457 { | |
3318 | 4458 ngx_http_core_loc_conf_t *clcf = conf; |
509 | 4459 |
2749
ccaf43725ff6
change ngx_log_create_errlog() interface
Igor Sysoev <igor@sysoev.ru>
parents:
2701
diff
changeset
|
4460 ngx_str_t *value; |
ccaf43725ff6
change ngx_log_create_errlog() interface
Igor Sysoev <igor@sysoev.ru>
parents:
2701
diff
changeset
|
4461 |
3318 | 4462 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
|
4463 return "is duplicate"; |
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
4464 } |
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
4465 |
2749
ccaf43725ff6
change ngx_log_create_errlog() interface
Igor Sysoev <igor@sysoev.ru>
parents:
2701
diff
changeset
|
4466 value = cf->args->elts; |
ccaf43725ff6
change ngx_log_create_errlog() interface
Igor Sysoev <igor@sysoev.ru>
parents:
2701
diff
changeset
|
4467 |
3318 | 4468 clcf->error_log = ngx_log_create(cf->cycle, &value[1]); |
4469 if (clcf->error_log == NULL) { | |
509 | 4470 return NGX_CONF_ERROR; |
4471 } | |
4472 | |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
4473 if (cf->args->nelts == 2) { |
3318 | 4474 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
|
4475 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
|
4476 } |
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
4477 |
3318 | 4478 return ngx_log_set_levels(cf, clcf->error_log); |
509 | 4479 } |
4480 | |
4481 | |
4482 static char * | |
487 | 4483 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
|
4484 { |
3318 | 4485 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
|
4486 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4487 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
|
4488 |
3318 | 4489 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
|
4490 return "is duplicate"; |
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 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4493 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
|
4494 |
3318 | 4495 clcf->keepalive_timeout = ngx_parse_time(&value[1], 0); |
4496 | |
4497 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
|
4498 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4499 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4500 |
3318 | 4501 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
|
4502 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
|
4503 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4504 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4505 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
|
4506 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
|
4507 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4508 |
3318 | 4509 clcf->keepalive_header = ngx_parse_time(&value[2], 1); |
4510 | |
4511 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
|
4512 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4513 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4514 |
3318 | 4515 if (clcf->keepalive_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
|
4516 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
|
4517 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4518 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4519 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
|
4520 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4521 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4522 |
487 | 4523 static char * |
509 | 4524 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
|
4525 { |
3318 | 4526 ngx_http_core_loc_conf_t *clcf = conf; |
4527 | |
4528 if (clcf->internal != NGX_CONF_UNSET) { | |
509 | 4529 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
|
4530 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4531 |
3318 | 4532 clcf->internal = 1; |
509 | 4533 |
4534 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
|
4535 } |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4536 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4537 |
487 | 4538 static char * |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4539 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
|
4540 { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4541 ngx_http_core_loc_conf_t *clcf = conf; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4542 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4543 ngx_url_t u; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4544 ngx_str_t *value; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4545 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4546 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
|
4547 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
|
4548 } |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
4549 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4550 value = cf->args->elts; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4551 |
1675 | 4552 ngx_memzero(&u, sizeof(ngx_url_t)); |
4553 | |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4554 u.host = value[1]; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4555 u.port = 53; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4556 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4557 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
|
4558 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
|
4559 return NGX_CONF_ERROR; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4560 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4561 |
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
|
4562 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
|
4563 if (clcf->resolver == NULL) { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4564 return NGX_OK; |
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 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4567 return NGX_CONF_OK; |
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 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4570 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4571 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4572 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4573 static char * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4574 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
|
4575 { |
2205 | 4576 ngx_http_core_loc_conf_t *clcf = conf; |
4577 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4578 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4579 |
3325 | 4580 ngx_str_t *value; |
4581 ngx_uint_t i; | |
4582 ngx_regex_elt_t *re; | |
4583 ngx_regex_compile_t rc; | |
4584 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
|
4585 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4586 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
|
4587 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
|
4588 sizeof(ngx_regex_elt_t)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4589 if (clcf->gzip_disable == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4590 return NGX_CONF_ERROR; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4594 value = cf->args->elts; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4595 |
3325 | 4596 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
4597 | |
4598 rc.pool = cf->pool; | |
4599 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
4600 rc.err.data = errstr; | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4601 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4602 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
|
4603 |
3754
5f58badd13ed
gzip_disable msie6 ignored other patterns
Igor Sysoev <igor@sysoev.ru>
parents:
3753
diff
changeset
|
4604 if (ngx_strcmp(value[i].data, "msie6") == 0) { |
2205 | 4605 clcf->gzip_disable_msie6 = 1; |
4606 continue; | |
4607 } | |
4608 | |
3773 | 4609 #if (NGX_HTTP_DEGRADATION) |
4610 | |
4611 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
4612 clcf->gzip_disable_degradation = 1; | |
4613 continue; | |
4614 } | |
4615 | |
4616 #endif | |
4617 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4618 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
|
4619 if (re == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4620 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4621 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4622 |
3753
9da3a04fc845
gzip_disable compiled always the first pattern only
Igor Sysoev <igor@sysoev.ru>
parents:
3752
diff
changeset
|
4623 rc.pattern = value[i]; |
3325 | 4624 rc.options = NGX_REGEX_CASELESS; |
4625 | |
4626 if (ngx_regex_compile(&rc) != NGX_OK) { | |
4627 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
|
4628 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4629 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4630 |
3325 | 4631 re->regex = rc.regex; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4632 re->name = value[i].data; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4635 return NGX_CONF_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4636 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4637 #else |
3773 | 4638 ngx_str_t *value; |
4639 ngx_uint_t i; | |
2205 | 4640 |
4641 value = cf->args->elts; | |
4642 | |
3773 | 4643 for (i = 1; i < cf->args->nelts; i++) { |
4644 if (ngx_strcmp(value[i].data, "msie6") == 0) { | |
4645 clcf->gzip_disable_msie6 = 1; | |
4646 continue; | |
4647 } | |
4648 | |
4649 #if (NGX_HTTP_DEGRADATION) | |
4650 | |
4651 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
4652 clcf->gzip_disable_degradation = 1; | |
4653 continue; | |
4654 } | |
4655 | |
4656 #endif | |
4657 | |
4658 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4659 "without PCRE library \"gzip_disable\" supports " | |
4660 "builtin \"msie6\" and \"degradation\" mask only"); | |
4661 | |
4662 return NGX_CONF_ERROR; | |
2205 | 4663 } |
4664 | |
3773 | 4665 return NGX_CONF_OK; |
4666 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4667 #endif |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4670 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4671 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
4672 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
4673 static char * |
487 | 4674 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
|
4675 { |
473 | 4676 #if (NGX_FREEBSD) |
452 | 4677 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
|
4678 |
673 | 4679 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
|
4680 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
|
4681 "\"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
|
4682 "(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
|
4683 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
|
4684 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4685 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
|
4686 } |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4687 |
469 | 4688 #elif !(NGX_HAVE_SO_SNDLOWAT) |
473 | 4689 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
|
4690 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4691 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
|
4692 "\"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
|
4693 |
452 | 4694 *np = 0; |
4695 | |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4696 #endif |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4697 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
4698 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
|
4699 } |
1200 | 4700 |
4701 | |
4702 static char * | |
4703 ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data) | |
4704 { | |
4705 size_t *sp = data; | |
4706 | |
4707 if (*sp < NGX_MIN_POOL_SIZE) { | |
4708 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3388 | 4709 "the pool size must be no less than %uz", |
4710 NGX_MIN_POOL_SIZE); | |
4711 return NGX_CONF_ERROR; | |
4712 } | |
4713 | |
4714 if (*sp % NGX_POOL_ALIGNMENT) { | |
4715 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4716 "the pool size must be a multiple of %uz", | |
4717 NGX_POOL_ALIGNMENT); | |
1200 | 4718 return NGX_CONF_ERROR; |
4719 } | |
4720 | |
4721 return NGX_CONF_OK; | |
4722 } |