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