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