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