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