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