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