Mercurial > hg > nginx
annotate src/http/ngx_http_core_module.c @ 8036:f739c8142fb2
Upstream: multiple WWW-Authenticate headers (ticket #485).
When using proxy_intercept_errors and an error page for error 401
(Unauthorized), multiple WWW-Authenticate headers from the upstream server
response are now properly copied to the response.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 30 May 2022 21:25:53 +0300 |
parents | d26db4f82d7d |
children | 711737177b77 |
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 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
24 static ngx_int_t ngx_http_core_auth_delay(ngx_http_request_t *r); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
25 static void ngx_http_core_auth_delay_handler(ngx_http_request_t *r); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
26 |
2027 | 27 static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r); |
28 static ngx_int_t ngx_http_core_find_static_location(ngx_http_request_t *r, | |
29 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
|
30 |
509 | 31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf, |
487 | 37 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
|
38 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
|
39 static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf, |
487 | 40 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
|
41 |
485 | 42 static char *ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 43 void *dummy); |
485 | 44 static char *ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 45 void *dummy); |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
46 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
|
47 ngx_http_core_loc_conf_t *clcf, ngx_str_t *regex, ngx_uint_t caseless); |
485 | 48 |
49 static char *ngx_http_core_types(ngx_conf_t *cf, ngx_command_t *cmd, | |
487 | 50 void *conf); |
485 | 51 static char *ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, |
487 | 52 void *conf); |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 |
485 | 54 static char *ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 55 void *conf); |
485 | 56 static char *ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 57 void *conf); |
485 | 58 static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
631 | 59 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, |
60 void *conf); | |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
61 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
|
62 void *conf); |
2129 | 63 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, |
64 void *conf); | |
485 | 65 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 66 void *conf); |
1454 | 67 static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, |
68 void *conf); | |
485 | 69 static char *ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 70 void *conf); |
485 | 71 static char *ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, |
487 | 72 void *conf); |
509 | 73 static char *ngx_http_core_internal(ngx_conf_t *cf, ngx_command_t *cmd, |
74 void *conf); | |
1674 | 75 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
|
76 void *conf); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
77 #if (NGX_HTTP_GZIP) |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 void *conf); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
82 #endif |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
83 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
|
84 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
|
85 int recursive); |
4495
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
86 #if (NGX_HAVE_OPENAT) |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
87 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
|
88 void *conf); |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
89 #endif |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
90 |
485 | 91 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data); |
1200 | 92 static char *ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data); |
485 | 93 |
94 static ngx_conf_post_t ngx_http_core_lowat_post = | |
1199 | 95 { 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
|
96 |
1200 | 97 static ngx_conf_post_handler_pt ngx_http_core_pool_size_p = |
98 ngx_http_core_pool_size; | |
99 | |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 |
1073 | 101 static ngx_conf_enum_t ngx_http_core_request_body_in_file[] = { |
102 { ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF }, | |
103 { ngx_string("on"), NGX_HTTP_REQUEST_BODY_FILE_ON }, | |
1075
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
104 { ngx_string("clean"), NGX_HTTP_REQUEST_BODY_FILE_CLEAN }, |
1073 | 105 { ngx_null_string, 0 } |
106 }; | |
107 | |
108 | |
1806 | 109 static ngx_conf_enum_t ngx_http_core_satisfy[] = { |
110 { ngx_string("all"), NGX_HTTP_SATISFY_ALL }, | |
111 { ngx_string("any"), NGX_HTTP_SATISFY_ANY }, | |
112 { ngx_null_string, 0 } | |
113 }; | |
114 | |
115 | |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
116 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
|
117 { ngx_string("off"), NGX_HTTP_LINGERING_OFF }, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
118 { ngx_string("on"), NGX_HTTP_LINGERING_ON }, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
119 { ngx_string("always"), NGX_HTTP_LINGERING_ALWAYS }, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
120 { ngx_null_string, 0 } |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
121 }; |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
122 |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
123 |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
124 static ngx_conf_enum_t ngx_http_core_server_tokens[] = { |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
125 { ngx_string("off"), NGX_HTTP_SERVER_TOKENS_OFF }, |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
126 { ngx_string("on"), NGX_HTTP_SERVER_TOKENS_ON }, |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
127 { ngx_string("build"), NGX_HTTP_SERVER_TOKENS_BUILD }, |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
128 { ngx_null_string, 0 } |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
129 }; |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
130 |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
131 |
2361 | 132 static ngx_conf_enum_t ngx_http_core_if_modified_since[] = { |
2496 | 133 { ngx_string("off"), NGX_HTTP_IMS_OFF }, |
134 { ngx_string("exact"), NGX_HTTP_IMS_EXACT }, | |
135 { ngx_string("before"), NGX_HTTP_IMS_BEFORE }, | |
2361 | 136 { ngx_null_string, 0 } |
137 }; | |
138 | |
139 | |
4266
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
140 static ngx_conf_bitmask_t ngx_http_core_keepalive_disable[] = { |
3793 | 141 { ngx_string("none"), NGX_HTTP_KEEPALIVE_DISABLE_NONE }, |
142 { ngx_string("msie6"), NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 }, | |
143 { ngx_string("safari"), NGX_HTTP_KEEPALIVE_DISABLE_SAFARI }, | |
144 { ngx_null_string, 0 } | |
145 }; | |
146 | |
147 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
148 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
|
149 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
|
150 }; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
151 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
152 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
153 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
154 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
155 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
|
156 { 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
|
157 { 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
|
158 { ngx_null_string, 0 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
159 }; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
160 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
161 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
162 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
|
163 { 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
|
164 { 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
|
165 { 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
|
166 { 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
|
167 { 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
|
168 { 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
|
169 { 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
|
170 { 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
|
171 { 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
|
172 { ngx_null_string, 0 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
173 }; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
174 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
175 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
176 static ngx_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
|
177 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
|
178 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
|
179 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
180 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
181 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
182 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
183 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
|
184 |
611 | 185 { ngx_string("variables_hash_max_size"), |
186 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
187 ngx_conf_set_num_slot, | |
188 NGX_HTTP_MAIN_CONF_OFFSET, | |
189 offsetof(ngx_http_core_main_conf_t, variables_hash_max_size), | |
190 NULL }, | |
191 | |
192 { ngx_string("variables_hash_bucket_size"), | |
193 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | |
194 ngx_conf_set_num_slot, | |
195 NGX_HTTP_MAIN_CONF_OFFSET, | |
196 offsetof(ngx_http_core_main_conf_t, variables_hash_bucket_size), | |
197 NULL }, | |
198 | |
593 | 199 { ngx_string("server_names_hash_max_size"), |
477 | 200 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
201 ngx_conf_set_num_slot, | |
202 NGX_HTTP_MAIN_CONF_OFFSET, | |
593 | 203 offsetof(ngx_http_core_main_conf_t, server_names_hash_max_size), |
477 | 204 NULL }, |
205 | |
593 | 206 { ngx_string("server_names_hash_bucket_size"), |
477 | 207 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
208 ngx_conf_set_num_slot, | |
209 NGX_HTTP_MAIN_CONF_OFFSET, | |
593 | 210 offsetof(ngx_http_core_main_conf_t, server_names_hash_bucket_size), |
477 | 211 NULL }, |
212 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
213 { 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
|
214 NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
485 | 215 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
|
216 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
217 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
218 NULL }, |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
219 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
220 { 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
|
221 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
|
222 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
|
223 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
|
224 offsetof(ngx_http_core_srv_conf_t, connection_pool_size), |
1200 | 225 &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
|
226 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
227 { ngx_string("request_pool_size"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 offsetof(ngx_http_core_srv_conf_t, request_pool_size), |
1200 | 232 &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
|
233 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
234 { ngx_string("client_header_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
235 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
236 ngx_conf_set_msec_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
237 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
238 offsetof(ngx_http_core_srv_conf_t, client_header_timeout), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
239 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
240 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
241 { ngx_string("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
|
242 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
243 ngx_conf_set_size_slot, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
244 NGX_HTTP_SRV_CONF_OFFSET, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
245 offsetof(ngx_http_core_srv_conf_t, 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
|
246 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
247 |
436
9549fc9508e5
nginx-0.0.11-2004-09-23-10:32:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
248 { 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 NULL }, |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
60
diff
changeset
|
254 |
511 | 255 { ngx_string("ignore_invalid_headers"), |
256 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
257 ngx_conf_set_flag_slot, | |
258 NGX_HTTP_SRV_CONF_OFFSET, | |
259 offsetof(ngx_http_core_srv_conf_t, ignore_invalid_headers), | |
260 NULL }, | |
261 | |
1585 | 262 { ngx_string("merge_slashes"), |
263 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
264 ngx_conf_set_flag_slot, | |
265 NGX_HTTP_SRV_CONF_OFFSET, | |
266 offsetof(ngx_http_core_srv_conf_t, merge_slashes), | |
267 NULL }, | |
268 | |
2256 | 269 { ngx_string("underscores_in_headers"), |
270 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, | |
271 ngx_conf_set_flag_slot, | |
272 NGX_HTTP_SRV_CONF_OFFSET, | |
273 offsetof(ngx_http_core_srv_conf_t, underscores_in_headers), | |
274 NULL }, | |
275 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
276 { 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
|
277 NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE12, |
485 | 278 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
|
279 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
|
280 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
281 NULL }, |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
282 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
283 { ngx_string("listen"), |
523 | 284 NGX_HTTP_SRV_CONF|NGX_CONF_1MORE, |
485 | 285 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
|
286 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
|
287 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
288 NULL }, |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
289 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
290 { 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
|
291 NGX_HTTP_SRV_CONF|NGX_CONF_1MORE, |
485 | 292 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
|
293 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
|
294 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
295 NULL }, |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
296 |
589 | 297 { ngx_string("types_hash_max_size"), |
298 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
299 ngx_conf_set_num_slot, | |
300 NGX_HTTP_LOC_CONF_OFFSET, | |
301 offsetof(ngx_http_core_loc_conf_t, types_hash_max_size), | |
302 NULL }, | |
303 | |
304 { ngx_string("types_hash_bucket_size"), | |
305 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
306 ngx_conf_set_num_slot, | |
307 NGX_HTTP_LOC_CONF_OFFSET, | |
308 offsetof(ngx_http_core_loc_conf_t, types_hash_bucket_size), | |
309 NULL }, | |
310 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
311 { ngx_string("types"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
312 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
|
313 |NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
485 | 314 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
|
315 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
|
316 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
317 NULL }, |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
318 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
319 { 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 NULL }, |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
325 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
326 { ngx_string("root"), |
509 | 327 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
328 |NGX_CONF_TAKE1, | |
485 | 329 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
|
330 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
|
331 0, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
332 NULL }, |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
333 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
334 { ngx_string("alias"), |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
335 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
485 | 336 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
|
337 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
|
338 0, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
339 NULL }, |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
340 |
631 | 341 { ngx_string("limit_except"), |
342 NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_1MORE, | |
343 ngx_http_core_limit_except, | |
344 NGX_HTTP_LOC_CONF_OFFSET, | |
345 0, | |
346 NULL }, | |
347 | |
293
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
348 { 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
|
349 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
663 | 350 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
|
351 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
|
352 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
|
353 NULL }, |
ec3c049681fd
nginx-0.0.3-2004-03-19-08:25:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
354 |
303
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
355 { 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 NULL }, |
00c5660d2707
nginx-0.0.3-2004-04-01-20:20:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
361 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
362 { ngx_string("client_body_timeout"), |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
363 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
|
364 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
|
365 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
|
366 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
|
367 NULL }, |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
160
diff
changeset
|
368 |
479 | 369 { ngx_string("client_body_temp_path"), |
370 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, | |
371 ngx_conf_set_path_slot, | |
372 NGX_HTTP_LOC_CONF_OFFSET, | |
373 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
|
374 NULL }, |
479 | 375 |
633 | 376 { ngx_string("client_body_in_file_only"), |
2843
eb461016d980
update two previous commits again
Igor Sysoev <igor@sysoev.ru>
parents:
2842
diff
changeset
|
377 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
1073 | 378 ngx_conf_set_enum_slot, |
633 | 379 NGX_HTTP_LOC_CONF_OFFSET, |
380 offsetof(ngx_http_core_loc_conf_t, client_body_in_file_only), | |
1073 | 381 &ngx_http_core_request_body_in_file }, |
633 | 382 |
2845 | 383 { ngx_string("client_body_in_single_buffer"), |
384 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
385 ngx_conf_set_flag_slot, | |
386 NGX_HTTP_LOC_CONF_OFFSET, | |
387 offsetof(ngx_http_core_loc_conf_t, client_body_in_single_buffer), | |
388 NULL }, | |
389 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
390 { ngx_string("sendfile"), |
1070
b54a1e283d6d
allow "sendfile" in "if" context
Igor Sysoev <igor@sysoev.ru>
parents:
1028
diff
changeset
|
391 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
|
392 |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
|
393 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
|
394 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
|
395 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
|
396 NULL }, |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
397 |
1197 | 398 { ngx_string("sendfile_max_chunk"), |
399 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
400 ngx_conf_set_size_slot, | |
401 NGX_HTTP_LOC_CONF_OFFSET, | |
402 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), | |
403 NULL }, | |
404 | |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
405 { ngx_string("subrequest_output_buffer_size"), |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
406 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
407 ngx_conf_set_size_slot, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
408 NGX_HTTP_LOC_CONF_OFFSET, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
409 offsetof(ngx_http_core_loc_conf_t, subrequest_output_buffer_size), |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
410 NULL }, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
411 |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
412 { ngx_string("aio"), |
3065 | 413 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
|
414 ngx_http_core_set_aio, |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
415 NGX_HTTP_LOC_CONF_OFFSET, |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
416 0, |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
417 NULL }, |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
3050
diff
changeset
|
418 |
6443
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
419 { ngx_string("aio_write"), |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
420 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
421 ngx_conf_set_flag_slot, |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
422 NGX_HTTP_LOC_CONF_OFFSET, |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
423 offsetof(ngx_http_core_loc_conf_t, aio_write), |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
424 NULL }, |
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
425 |
3178 | 426 { ngx_string("read_ahead"), |
427 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
428 ngx_conf_set_size_slot, | |
429 NGX_HTTP_LOC_CONF_OFFSET, | |
430 offsetof(ngx_http_core_loc_conf_t, read_ahead), | |
431 NULL }, | |
432 | |
2129 | 433 { ngx_string("directio"), |
434 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
435 ngx_http_core_directio, | |
436 NGX_HTTP_LOC_CONF_OFFSET, | |
437 0, | |
438 NULL }, | |
439 | |
3053 | 440 { ngx_string("directio_alignment"), |
441 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
442 ngx_conf_set_off_slot, | |
443 NGX_HTTP_LOC_CONF_OFFSET, | |
444 offsetof(ngx_http_core_loc_conf_t, directio_alignment), | |
445 NULL }, | |
446 | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
447 { 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 NULL }, |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
453 |
452 | 454 { ngx_string("tcp_nodelay"), |
455 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
456 ngx_conf_set_flag_slot, | |
457 NGX_HTTP_LOC_CONF_OFFSET, | |
458 offsetof(ngx_http_core_loc_conf_t, tcp_nodelay), | |
459 NULL }, | |
460 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
461 { 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 NULL }, |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
467 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
468 { 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
|
469 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
|
470 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
|
471 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
|
472 offsetof(ngx_http_core_loc_conf_t, send_lowat), |
485 | 473 &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
|
474 |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
475 { 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 NULL }, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
481 |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
482 { ngx_string("limit_rate"), |
485 | 483 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
484 |NGX_CONF_TAKE1, | |
7504
c19ca381b2e6
Variables support in limit_rate and limit_rate_after (ticket #293).
Ruslan Ermilov <ru@nginx.com>
parents:
7478
diff
changeset
|
485 ngx_http_set_complex_value_size_slot, |
391
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
486 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
|
487 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
|
488 NULL }, |
b670db10cbbd
nginx-0.0.7-2004-07-14-20:01:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
489 |
2907 | 490 { ngx_string("limit_rate_after"), |
491 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF | |
492 |NGX_CONF_TAKE1, | |
7504
c19ca381b2e6
Variables support in limit_rate and limit_rate_after (ticket #293).
Ruslan Ermilov <ru@nginx.com>
parents:
7478
diff
changeset
|
493 ngx_http_set_complex_value_size_slot, |
2907 | 494 NGX_HTTP_LOC_CONF_OFFSET, |
495 offsetof(ngx_http_core_loc_conf_t, limit_rate_after), | |
496 NULL }, | |
497 | |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
498 { ngx_string("keepalive_time"), |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
499 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
500 ngx_conf_set_msec_slot, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
501 NGX_HTTP_LOC_CONF_OFFSET, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
502 offsetof(ngx_http_core_loc_conf_t, keepalive_time), |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
503 NULL }, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
504 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
505 { 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
|
506 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
485 | 507 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
|
508 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
|
509 0, |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
510 NULL }, |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
511 |
2888 | 512 { ngx_string("keepalive_requests"), |
513 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
514 ngx_conf_set_num_slot, | |
515 NGX_HTTP_LOC_CONF_OFFSET, | |
516 offsetof(ngx_http_core_loc_conf_t, keepalive_requests), | |
517 NULL }, | |
518 | |
3793 | 519 { ngx_string("keepalive_disable"), |
4266
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
520 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
|
521 ngx_conf_set_bitmask_slot, |
3793 | 522 NGX_HTTP_LOC_CONF_OFFSET, |
523 offsetof(ngx_http_core_loc_conf_t, keepalive_disable), | |
524 &ngx_http_core_keepalive_disable }, | |
525 | |
1806 | 526 { ngx_string("satisfy"), |
527 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
528 ngx_conf_set_enum_slot, | |
529 NGX_HTTP_LOC_CONF_OFFSET, | |
530 offsetof(ngx_http_core_loc_conf_t, satisfy), | |
531 &ngx_http_core_satisfy }, | |
532 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
533 { ngx_string("auth_delay"), |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
534 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
535 ngx_conf_set_msec_slot, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
536 NGX_HTTP_LOC_CONF_OFFSET, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
537 offsetof(ngx_http_core_loc_conf_t, auth_delay), |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
538 NULL }, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
539 |
509 | 540 { ngx_string("internal"), |
541 NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS, | |
542 ngx_http_core_internal, | |
543 NGX_HTTP_LOC_CONF_OFFSET, | |
544 0, | |
545 NULL }, | |
546 | |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
547 { ngx_string("lingering_close"), |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
548 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
|
549 ngx_conf_set_enum_slot, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
550 NGX_HTTP_LOC_CONF_OFFSET, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
551 offsetof(ngx_http_core_loc_conf_t, lingering_close), |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
552 &ngx_http_core_lingering_close }, |
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
553 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
554 { 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 NULL }, |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
560 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
561 { 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 NULL }, |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
64
diff
changeset
|
567 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
568 { 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 NULL }, |
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
574 |
6852
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
575 { ngx_string("absolute_redirect"), |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
576 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
577 ngx_conf_set_flag_slot, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
578 NGX_HTTP_LOC_CONF_OFFSET, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
579 offsetof(ngx_http_core_loc_conf_t, absolute_redirect), |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
580 NULL }, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
581 |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
582 { ngx_string("server_name_in_redirect"), |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
583 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
|
584 ngx_conf_set_flag_slot, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
585 NGX_HTTP_LOC_CONF_OFFSET, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
586 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
|
587 NULL }, |
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
588 |
521 | 589 { ngx_string("port_in_redirect"), |
590 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
591 ngx_conf_set_flag_slot, | |
592 NGX_HTTP_LOC_CONF_OFFSET, | |
593 offsetof(ngx_http_core_loc_conf_t, port_in_redirect), | |
594 NULL }, | |
595 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
596 { 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 NULL }, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
602 |
679 | 603 { ngx_string("msie_refresh"), |
604 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
605 ngx_conf_set_flag_slot, | |
606 NGX_HTTP_LOC_CONF_OFFSET, | |
607 offsetof(ngx_http_core_loc_conf_t, msie_refresh), | |
608 NULL }, | |
609 | |
527 | 610 { ngx_string("log_not_found"), |
611 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
612 ngx_conf_set_flag_slot, | |
613 NGX_HTTP_LOC_CONF_OFFSET, | |
614 offsetof(ngx_http_core_loc_conf_t, log_not_found), | |
615 NULL }, | |
616 | |
2261 | 617 { ngx_string("log_subrequest"), |
618 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
619 ngx_conf_set_flag_slot, | |
620 NGX_HTTP_LOC_CONF_OFFSET, | |
621 offsetof(ngx_http_core_loc_conf_t, log_subrequest), | |
622 NULL }, | |
623 | |
679 | 624 { ngx_string("recursive_error_pages"), |
625 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
626 ngx_conf_set_flag_slot, | |
627 NGX_HTTP_LOC_CONF_OFFSET, | |
628 offsetof(ngx_http_core_loc_conf_t, recursive_error_pages), | |
629 NULL }, | |
630 | |
1592 | 631 { ngx_string("server_tokens"), |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
632 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
633 ngx_conf_set_enum_slot, |
1592 | 634 NGX_HTTP_LOC_CONF_OFFSET, |
6451
155871d773cc
Backed out server_tokens changes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6443
diff
changeset
|
635 offsetof(ngx_http_core_loc_conf_t, server_tokens), |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
636 &ngx_http_core_server_tokens }, |
1592 | 637 |
2361 | 638 { ngx_string("if_modified_since"), |
639 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
640 ngx_conf_set_enum_slot, | |
641 NGX_HTTP_LOC_CONF_OFFSET, | |
642 offsetof(ngx_http_core_loc_conf_t, if_modified_since), | |
643 &ngx_http_core_if_modified_since }, | |
644 | |
4062 | 645 { ngx_string("max_ranges"), |
646 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
647 ngx_conf_set_num_slot, | |
648 NGX_HTTP_LOC_CONF_OFFSET, | |
649 offsetof(ngx_http_core_loc_conf_t, max_ranges), | |
650 NULL }, | |
651 | |
3484 | 652 { 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
|
653 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
3484 | 654 ngx_conf_set_flag_slot, |
655 NGX_HTTP_LOC_CONF_OFFSET, | |
656 offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding), | |
657 NULL }, | |
658 | |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
659 { ngx_string("etag"), |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
660 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
|
661 ngx_conf_set_flag_slot, |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
662 NGX_HTTP_LOC_CONF_OFFSET, |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
663 offsetof(ngx_http_core_loc_conf_t, etag), |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
664 NULL }, |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
665 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
666 { ngx_string("error_page"), |
509 | 667 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |
668 |NGX_CONF_2MORE, | |
485 | 669 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
|
670 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
|
671 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
672 NULL }, |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
673 |
577 | 674 { ngx_string("post_action"), |
675 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF | |
676 |NGX_CONF_TAKE1, | |
677 ngx_conf_set_str_slot, | |
678 NGX_HTTP_LOC_CONF_OFFSET, | |
679 offsetof(ngx_http_core_loc_conf_t, post_action), | |
680 NULL }, | |
681 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
682 { 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
|
683 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
485 | 684 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
|
685 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
|
686 0, |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
687 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
|
688 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
689 { ngx_string("open_file_cache"), |
1454 | 690 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
691 ngx_http_core_open_file_cache, | |
692 NGX_HTTP_LOC_CONF_OFFSET, | |
693 offsetof(ngx_http_core_loc_conf_t, open_file_cache), | |
694 NULL }, | |
695 | |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
696 { ngx_string("open_file_cache_valid"), |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
697 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
|
698 ngx_conf_set_sec_slot, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
699 NGX_HTTP_LOC_CONF_OFFSET, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
700 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
|
701 NULL }, |
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
702 |
1772 | 703 { ngx_string("open_file_cache_min_uses"), |
704 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
705 ngx_conf_set_num_slot, | |
706 NGX_HTTP_LOC_CONF_OFFSET, | |
707 offsetof(ngx_http_core_loc_conf_t, open_file_cache_min_uses), | |
708 NULL }, | |
709 | |
1454 | 710 { ngx_string("open_file_cache_errors"), |
711 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
712 ngx_conf_set_flag_slot, | |
713 NGX_HTTP_LOC_CONF_OFFSET, | |
714 offsetof(ngx_http_core_loc_conf_t, open_file_cache_errors), | |
715 NULL }, | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
716 |
1457 | 717 { ngx_string("open_file_cache_events"), |
718 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
719 ngx_conf_set_flag_slot, | |
720 NGX_HTTP_LOC_CONF_OFFSET, | |
721 offsetof(ngx_http_core_loc_conf_t, open_file_cache_events), | |
722 NULL }, | |
723 | |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
724 { ngx_string("resolver"), |
4225
016352c19049
Support of several servers in the "resolver" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4210
diff
changeset
|
725 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
|
726 ngx_http_core_resolver, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
727 NGX_HTTP_LOC_CONF_OFFSET, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
728 0, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
729 NULL }, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
730 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
731 { ngx_string("resolver_timeout"), |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
732 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
|
733 ngx_conf_set_msec_slot, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
734 NGX_HTTP_LOC_CONF_OFFSET, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
735 offsetof(ngx_http_core_loc_conf_t, resolver_timeout), |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
736 NULL }, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
737 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
738 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
739 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
740 { ngx_string("gzip_vary"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
741 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
|
742 ngx_conf_set_flag_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
743 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
744 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
|
745 NULL }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
746 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
747 { ngx_string("gzip_http_version"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
748 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
|
749 ngx_conf_set_enum_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
750 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
751 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
|
752 &ngx_http_gzip_http_version }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
753 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
754 { ngx_string("gzip_proxied"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
755 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
|
756 ngx_conf_set_bitmask_slot, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
757 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
758 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
|
759 &ngx_http_gzip_proxied_mask }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
760 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
761 { ngx_string("gzip_disable"), |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
762 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
|
763 ngx_http_gzip_disable, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
764 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
765 0, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
766 NULL }, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
767 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
768 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
769 |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
770 #if (NGX_HAVE_OPENAT) |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
771 |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
772 { 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
|
773 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
|
774 ngx_http_disable_symlinks, |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
775 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
|
776 0, |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
777 NULL }, |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
778 |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
779 #endif |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
780 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
781 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
|
782 }; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
783 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
784 |
667 | 785 static ngx_http_module_t ngx_http_core_module_ctx = { |
509 | 786 ngx_http_core_preconfiguration, /* preconfiguration */ |
6049
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
787 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
|
788 |
91
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_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
|
790 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
|
791 |
91
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_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
|
793 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
|
794 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
795 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
|
796 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
|
797 }; |
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
798 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
799 |
41
59e7c7f30d49
nginx-0.0.1-2002-12-26-19:26:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
800 ngx_module_t ngx_http_core_module = { |
509 | 801 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
|
802 &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
|
803 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
|
804 NGX_HTTP_MODULE, /* module type */ |
541 | 805 NULL, /* init master */ |
509 | 806 NULL, /* init module */ |
541 | 807 NULL, /* init process */ |
808 NULL, /* init thread */ | |
809 NULL, /* exit thread */ | |
810 NULL, /* exit process */ | |
811 NULL, /* exit master */ | |
812 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
|
813 }; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
814 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
815 |
6312
1d696c646d81
Stop emulating a space character after r->method_name.
Ruslan Ermilov <ru@nginx.com>
parents:
6309
diff
changeset
|
816 ngx_str_t ngx_http_core_get_method = { 3, (u_char *) "GET" }; |
1882 | 817 |
818 | |
487 | 819 void |
820 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
|
821 { |
681 | 822 ngx_http_core_main_conf_t *cmcf; |
823 | |
483 | 824 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
|
825 |
675 | 826 if (!r->internal) { |
543 | 827 switch (r->headers_in.connection_type) { |
828 case 0: | |
3846
005d5cf5b403
use boolean expression instead of "if"
Igor Sysoev <igor@sysoev.ru>
parents:
3806
diff
changeset
|
829 r->keepalive = (r->http_version > NGX_HTTP_VERSION_10); |
543 | 830 break; |
831 | |
832 case NGX_HTTP_CONNECTION_CLOSE: | |
833 r->keepalive = 0; | |
834 break; | |
835 | |
836 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
|
837 r->keepalive = 1; |
543 | 838 break; |
839 } | |
840 | |
4930
6f085bfcdb4d
Request body: chunked transfer encoding support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4828
diff
changeset
|
841 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
|
842 || r->headers_in.chunked); |
681 | 843 r->phase_handler = 0; |
844 | |
845 } else { | |
846 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | |
847 r->phase_handler = cmcf->phase_engine.server_rewrite_index; | |
848 } | |
849 | |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
850 r->valid_location = 1; |
3313 | 851 #if (NGX_HTTP_GZIP) |
852 r->gzip_tested = 0; | |
853 r->gzip_ok = 0; | |
854 r->gzip_vary = 0; | |
855 #endif | |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
715
diff
changeset
|
856 |
681 | 857 r->write_event_handler = ngx_http_core_run_phases; |
485 | 858 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
|
859 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
860 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
861 |
681 | 862 void |
487 | 863 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
|
864 { |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
865 ngx_int_t rc; |
681 | 866 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
|
867 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
|
868 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
869 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
|
870 |
681 | 871 ph = cmcf->phase_engine.handlers; |
872 | |
873 while (ph[r->phase_handler].checker) { | |
874 | |
875 rc = ph[r->phase_handler].checker(r, &ph[r->phase_handler]); | |
876 | |
877 if (rc == NGX_OK) { | |
543 | 878 return; |
143
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 } |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
882 |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
883 |
487 | 884 ngx_int_t |
681 | 885 ngx_http_core_generic_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph) |
886 { | |
887 ngx_int_t rc; | |
888 | |
889 /* | |
890 * generic phase checker, | |
3634
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
891 * used by the post read and pre-access phases |
681 | 892 */ |
893 | |
894 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
895 "generic phase: %ui", r->phase_handler); | |
896 | |
897 rc = ph->handler(r); | |
898 | |
899 if (rc == NGX_OK) { | |
900 r->phase_handler = ph->next; | |
901 return NGX_AGAIN; | |
902 } | |
903 | |
904 if (rc == NGX_DECLINED) { | |
905 r->phase_handler++; | |
906 return NGX_AGAIN; | |
907 } | |
908 | |
909 if (rc == NGX_AGAIN || rc == NGX_DONE) { | |
910 return NGX_OK; | |
911 } | |
912 | |
913 /* rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
914 | |
915 ngx_http_finalize_request(r, rc); | |
916 | |
917 return NGX_OK; | |
918 } | |
919 | |
920 | |
921 ngx_int_t | |
3634
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
922 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
|
923 { |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
924 ngx_int_t rc; |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
925 |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
926 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
|
927 "rewrite phase: %ui", r->phase_handler); |
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 rc = ph->handler(r); |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
930 |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
931 if (rc == NGX_DECLINED) { |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
932 r->phase_handler++; |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
933 return NGX_AGAIN; |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
934 } |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
935 |
3797
96f17c930a9e
revert processing NGX_OK and NGX_DONE in rewrite phase changed in r3634
Igor Sysoev <igor@sysoev.ru>
parents:
3793
diff
changeset
|
936 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
|
937 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
|
938 } |
96f17c930a9e
revert processing NGX_OK and NGX_DONE in rewrite phase changed in r3634
Igor Sysoev <igor@sysoev.ru>
parents:
3793
diff
changeset
|
939 |
3806 | 940 /* 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
|
941 |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
942 ngx_http_finalize_request(r, rc); |
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 return NGX_OK; |
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 |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
947 |
40e356cf4176
add files missed in the previuos commit
Igor Sysoev <igor@sysoev.ru>
parents:
3632
diff
changeset
|
948 ngx_int_t |
681 | 949 ngx_http_core_find_config_phase(ngx_http_request_t *r, |
950 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
|
951 { |
1403 | 952 u_char *p; |
953 size_t len; | |
2436
26d9d4a41e91
send "100 Continue" just before reading request body
Igor Sysoev <igor@sysoev.ru>
parents:
2435
diff
changeset
|
954 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
|
955 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
|
956 |
489 | 957 r->content_handler = NULL; |
958 r->uri_changed = 0; | |
959 | |
2027 | 960 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
|
961 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
962 if (rc == NGX_ERROR) { |
681 | 963 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
964 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
|
965 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
966 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
967 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
|
968 |
509 | 969 if (!r->internal && clcf->internal) { |
681 | 970 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); |
971 return NGX_OK; | |
509 | 972 } |
973 | |
555 | 974 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
975 "using configuration \"%s%V\"", | |
976 (clcf->noname ? "*" : (clcf->exact_match ? "=" : "")), | |
977 &clcf->name); | |
978 | |
535 | 979 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
|
980 |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
981 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
663 | 982 "http cl:%O max:%O", |
461 | 983 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
|
984 |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
985 if (r->headers_in.content_length_n != -1 |
673 | 986 && !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
|
987 && clcf->client_max_body_size |
663 | 988 && 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
|
989 { |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
990 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1586 | 991 "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
|
992 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
|
993 |
4973
44fcb9677c3f
Avoid sending "100 Continue" on 413 Request Entity Too Large.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4947
diff
changeset
|
994 r->expect_tested = 1; |
3078
680cab09818d
discard request body before returning 413 error,
Igor Sysoev <igor@sysoev.ru>
parents:
3066
diff
changeset
|
995 (void) ngx_http_discard_request_body(r); |
681 | 996 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); |
997 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
|
998 } |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
999 |
2027 | 1000 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
|
1001 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
|
1002 |
416
b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
415
diff
changeset
|
1003 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
|
1004 if (r->headers_out.location == NULL) { |
681 | 1005 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
1006 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
|
1007 } |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
1008 |
6853
c85dfd99a2dd
Fixed missing "Location" field with some relative redirects.
Ruslan Ermilov <ru@nginx.com>
parents:
6852
diff
changeset
|
1009 r->headers_out.location->hash = 1; |
8031
d26db4f82d7d
All known output headers can be linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1010 r->headers_out.location->next = NULL; |
6853
c85dfd99a2dd
Fixed missing "Location" field with some relative redirects.
Ruslan Ermilov <ru@nginx.com>
parents:
6852
diff
changeset
|
1011 ngx_str_set(&r->headers_out.location->key, "Location"); |
509 | 1012 |
1403 | 1013 if (r->args.len == 0) { |
7848
1bde031b59ff
Location header escaping in redirects (ticket #882).
Ruslan Ermilov <ru@nginx.com>
parents:
7831
diff
changeset
|
1014 r->headers_out.location->value = clcf->escaped_name; |
1403 | 1015 |
1016 } else { | |
7848
1bde031b59ff
Location header escaping in redirects (ticket #882).
Ruslan Ermilov <ru@nginx.com>
parents:
7831
diff
changeset
|
1017 len = clcf->escaped_name.len + 1 + r->args.len; |
2049 | 1018 p = ngx_pnalloc(r->pool, len); |
1403 | 1019 |
1020 if (p == NULL) { | |
6986
0cdee26605f3
Cleaned up r->headers_out.headers allocation error handling.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6977
diff
changeset
|
1021 ngx_http_clear_location(r); |
1403 | 1022 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
1023 return NGX_OK; | |
1024 } | |
1025 | |
1026 r->headers_out.location->value.len = len; | |
1027 r->headers_out.location->value.data = p; | |
1028 | |
7848
1bde031b59ff
Location header escaping in redirects (ticket #882).
Ruslan Ermilov <ru@nginx.com>
parents:
7831
diff
changeset
|
1029 p = ngx_cpymem(p, clcf->escaped_name.data, clcf->escaped_name.len); |
1403 | 1030 *p++ = '?'; |
1031 ngx_memcpy(p, r->args.data, r->args.len); | |
1032 } | |
190
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
1033 |
681 | 1034 ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY); |
1035 return NGX_OK; | |
1036 } | |
1037 | |
1038 r->phase_handler++; | |
1039 return NGX_AGAIN; | |
1040 } | |
1041 | |
1042 | |
1043 ngx_int_t | |
1044 ngx_http_core_post_rewrite_phase(ngx_http_request_t *r, | |
1045 ngx_http_phase_handler_t *ph) | |
1046 { | |
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
|
1047 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
|
1048 |
681 | 1049 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1050 "post rewrite phase: %ui", r->phase_handler); | |
1051 | |
1052 if (!r->uri_changed) { | |
1053 r->phase_handler++; | |
1054 return NGX_AGAIN; | |
1055 } | |
1056 | |
1057 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1058 "uri changes: %d", r->uri_changes); | |
1059 | |
1060 /* | |
1061 * gcc before 3.3 compiles the broken code for | |
1062 * if (r->uri_changes-- == 0) | |
1063 * if the r->uri_changes is defined as | |
1064 * unsigned uri_changes:4 | |
1065 */ | |
1066 | |
1067 r->uri_changes--; | |
1068 | |
1069 if (r->uri_changes == 0) { | |
1070 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1071 "rewrite or internal redirection cycle " | |
1072 "while processing \"%V\"", &r->uri); | |
1073 | |
1074 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
1075 return NGX_OK; | |
1076 } | |
1077 | |
1078 r->phase_handler = ph->next; | |
1079 | |
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
|
1080 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
|
1081 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
|
1082 |
681 | 1083 return NGX_AGAIN; |
1084 } | |
1085 | |
1086 | |
1087 ngx_int_t | |
1088 ngx_http_core_access_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph) | |
1089 { | |
1090 ngx_int_t rc; | |
1091 ngx_http_core_loc_conf_t *clcf; | |
1092 | |
1093 if (r != r->main) { | |
1094 r->phase_handler = ph->next; | |
1095 return NGX_AGAIN; | |
1096 } | |
1097 | |
1098 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1099 "access phase: %ui", r->phase_handler); | |
1100 | |
1101 rc = ph->handler(r); | |
1102 | |
1103 if (rc == NGX_DECLINED) { | |
1104 r->phase_handler++; | |
1105 return NGX_AGAIN; | |
1106 } | |
1107 | |
1108 if (rc == NGX_AGAIN || rc == NGX_DONE) { | |
1109 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
|
1110 } |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
1111 |
681 | 1112 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1113 | |
1806 | 1114 if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) { |
681 | 1115 |
1116 if (rc == NGX_OK) { | |
1117 r->phase_handler++; | |
1118 return NGX_AGAIN; | |
1119 } | |
1120 | |
1121 } else { | |
1122 if (rc == NGX_OK) { | |
1123 r->access_code = 0; | |
1124 | |
1125 if (r->headers_out.www_authenticate) { | |
1126 r->headers_out.www_authenticate->hash = 0; | |
1127 } | |
1128 | |
1129 r->phase_handler = ph->next; | |
1130 return NGX_AGAIN; | |
1131 } | |
1132 | |
1133 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
|
1134 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
|
1135 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
|
1136 } |
681 | 1137 |
1138 r->phase_handler++; | |
1139 return NGX_AGAIN; | |
1140 } | |
1141 } | |
1142 | |
1143 /* rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
1144 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1145 if (rc == NGX_HTTP_UNAUTHORIZED) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1146 return ngx_http_core_auth_delay(r); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1147 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1148 |
681 | 1149 ngx_http_finalize_request(r, rc); |
1150 return NGX_OK; | |
1151 } | |
1152 | |
1153 | |
1154 ngx_int_t | |
1155 ngx_http_core_post_access_phase(ngx_http_request_t *r, | |
1156 ngx_http_phase_handler_t *ph) | |
1157 { | |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1158 ngx_int_t access_code; |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1159 |
681 | 1160 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1161 "post access phase: %ui", r->phase_handler); | |
1162 | |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1163 access_code = r->access_code; |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1164 |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1165 if (access_code) { |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1166 r->access_code = 0; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1167 |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1168 if (access_code == NGX_HTTP_FORBIDDEN) { |
681 | 1169 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1170 "access forbidden by rule"); | |
1171 } | |
1172 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1173 if (access_code == NGX_HTTP_UNAUTHORIZED) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1174 return ngx_http_core_auth_delay(r); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1175 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1176 |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1177 ngx_http_finalize_request(r, access_code); |
681 | 1178 return NGX_OK; |
1179 } | |
1180 | |
1181 r->phase_handler++; | |
1182 return NGX_AGAIN; | |
1183 } | |
1184 | |
1185 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1186 static ngx_int_t |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1187 ngx_http_core_auth_delay(ngx_http_request_t *r) |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1188 { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1189 ngx_http_core_loc_conf_t *clcf; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1190 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1191 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1192 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1193 if (clcf->auth_delay == 0) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1194 ngx_http_finalize_request(r, NGX_HTTP_UNAUTHORIZED); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1195 return NGX_OK; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1196 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1197 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1198 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1199 "delaying unauthorized request"); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1200 |
7811
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1201 if (r->connection->read->ready) { |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1202 ngx_post_event(r->connection->read, &ngx_posted_events); |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1203 |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1204 } else { |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1205 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1206 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1207 } |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1208 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1209 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1210 r->read_event_handler = ngx_http_test_reading; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1211 r->write_event_handler = ngx_http_core_auth_delay_handler; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1212 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1213 r->connection->write->delayed = 1; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1214 ngx_add_timer(r->connection->write, clcf->auth_delay); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1215 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1216 /* |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1217 * trigger an additional event loop iteration |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1218 * to ensure constant-time processing |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1219 */ |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1220 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1221 ngx_post_event(r->connection->write, &ngx_posted_next_events); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1222 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1223 return NGX_OK; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1224 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1225 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1226 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1227 static void |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1228 ngx_http_core_auth_delay_handler(ngx_http_request_t *r) |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1229 { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1230 ngx_event_t *wev; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1231 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1232 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1233 "auth delay handler"); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1234 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1235 wev = r->connection->write; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1236 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1237 if (wev->delayed) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1238 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1239 if (ngx_handle_write_event(wev, 0) != NGX_OK) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1240 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1241 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1242 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1243 return; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1244 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1245 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1246 ngx_http_finalize_request(r, NGX_HTTP_UNAUTHORIZED); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1247 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1248 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1249 |
681 | 1250 ngx_int_t |
1251 ngx_http_core_content_phase(ngx_http_request_t *r, | |
1252 ngx_http_phase_handler_t *ph) | |
1253 { | |
773 | 1254 size_t root; |
681 | 1255 ngx_int_t rc; |
1256 ngx_str_t path; | |
1257 | |
1258 if (r->content_handler) { | |
1259 r->write_event_handler = ngx_http_request_empty_handler; | |
1260 ngx_http_finalize_request(r, r->content_handler(r)); | |
1261 return NGX_OK; | |
1262 } | |
1263 | |
1264 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1265 "content phase: %ui", r->phase_handler); | |
1266 | |
1267 rc = ph->handler(r); | |
1268 | |
1269 if (rc != NGX_DECLINED) { | |
1270 ngx_http_finalize_request(r, rc); | |
1271 return NGX_OK; | |
1272 } | |
1273 | |
1274 /* rc == NGX_DECLINED */ | |
1275 | |
1276 ph++; | |
1277 | |
1278 if (ph->checker) { | |
1279 r->phase_handler++; | |
1280 return NGX_AGAIN; | |
1281 } | |
1282 | |
1283 /* no content handler was found */ | |
1284 | |
3527 | 1285 if (r->uri.data[r->uri.len - 1] == '/') { |
681 | 1286 |
773 | 1287 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { |
681 | 1288 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
|
1289 "directory index of \"%s\" is forbidden", path.data); |
681 | 1290 } |
1291 | |
1292 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); | |
1293 return NGX_OK; | |
1294 } | |
1295 | |
1296 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found"); | |
1297 | |
1298 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); | |
535 | 1299 return NGX_OK; |
1300 } | |
1301 | |
1302 | |
1303 void | |
1304 ngx_http_update_location_config(ngx_http_request_t *r) | |
1305 { | |
1306 ngx_http_core_loc_conf_t *clcf; | |
1307 | |
1308 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1309 | |
631 | 1310 if (r->method & clcf->limit_except) { |
1311 r->loc_conf = clcf->limit_except_loc_conf; | |
1312 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1313 } | |
1314 | |
643 | 1315 if (r == r->main) { |
6129
187aa751ad62
Core: the ngx_set_connection_log() macro.
Vladimir Homutov <vl@nginx.com>
parents:
6049
diff
changeset
|
1316 ngx_set_connection_log(r->connection, clcf->error_log); |
535 | 1317 } |
1318 | |
1319 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { | |
1320 r->connection->sendfile = 1; | |
1321 | |
1322 } else { | |
1323 r->connection->sendfile = 0; | |
1324 } | |
1325 | |
633 | 1326 if (clcf->client_body_in_file_only) { |
1327 r->request_body_in_file_only = 1; | |
1328 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
|
1329 r->request_body_in_clean_file = |
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
1330 clcf->client_body_in_file_only == NGX_HTTP_REQUEST_BODY_FILE_CLEAN; |
637 | 1331 r->request_body_file_log_level = NGX_LOG_NOTICE; |
1332 | |
1333 } else { | |
1334 r->request_body_file_log_level = NGX_LOG_WARN; | |
633 | 1335 } |
1336 | |
2845 | 1337 r->request_body_in_single_buf = clcf->client_body_in_single_buffer; |
1338 | |
2888 | 1339 if (r->keepalive) { |
1340 if (clcf->keepalive_timeout == 0) { | |
1341 r->keepalive = 0; | |
1342 | |
1343 } else if (r->connection->requests >= clcf->keepalive_requests) { | |
1344 r->keepalive = 0; | |
3793 | 1345 |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1346 } else if (ngx_current_msec - r->connection->start_time |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1347 > clcf->keepalive_time) |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1348 { |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1349 r->keepalive = 0; |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1350 |
3793 | 1351 } else if (r->headers_in.msie6 |
1352 && r->method == NGX_HTTP_POST | |
1353 && (clcf->keepalive_disable | |
1354 & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) | |
1355 { | |
1356 /* | |
1357 * MSIE may wait for some time if an response for | |
1358 * a POST request was sent over a keepalive connection | |
1359 */ | |
1360 r->keepalive = 0; | |
1361 | |
1362 } else if (r->headers_in.safari | |
1363 && (clcf->keepalive_disable | |
1364 & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) | |
1365 { | |
1366 /* | |
1367 * Safari may send a POST request to a closed keepalive | |
1368 * connection and may stall for some time, see | |
1369 * https://bugs.webkit.org/show_bug.cgi?id=5760 | |
1370 */ | |
1371 r->keepalive = 0; | |
2888 | 1372 } |
535 | 1373 } |
1374 | |
1375 if (!clcf->tcp_nopush) { | |
1376 /* disable TCP_NOPUSH/TCP_CORK use */ | |
1377 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; | |
1378 } | |
1379 | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
1380 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
|
1381 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
|
1382 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1383 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1384 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1385 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1386 /* |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1387 * 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
|
1388 * NGX_DONE - auto redirect |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1389 * NGX_AGAIN - inclusive match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1390 * NGX_ERROR - regex error |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1391 * NGX_DECLINED - no match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1392 */ |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1393 |
487 | 1394 static ngx_int_t |
2027 | 1395 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
|
1396 { |
2027 | 1397 ngx_int_t rc; |
1398 ngx_http_core_loc_conf_t *pclcf; | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1399 #if (NGX_PCRE) |
3325 | 1400 ngx_int_t n; |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1401 ngx_uint_t noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1402 ngx_http_core_loc_conf_t *clcf, **clcfp; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1403 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1404 noregex = 0; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1405 #endif |
2027 | 1406 |
1407 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1408 | |
1409 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); | |
1410 | |
1411 if (rc == NGX_AGAIN) { | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1412 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1413 #if (NGX_PCRE) |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1414 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
|
1415 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1416 noregex = clcf->noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1417 #endif |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1418 |
2027 | 1419 /* look up nested locations */ |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1420 |
2027 | 1421 rc = ngx_http_core_find_location(r); |
1422 } | |
1423 | |
1424 if (rc == NGX_OK || rc == NGX_DONE) { | |
1425 return rc; | |
1426 } | |
1427 | |
1428 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ | |
1429 | |
1430 #if (NGX_PCRE) | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1431 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1432 if (noregex == 0 && pclcf->regex_locations) { |
2027 | 1433 |
1434 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { | |
1435 | |
1436 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1437 "test location: ~ \"%V\"", &(*clcfp)->name); | |
1438 | |
3325 | 1439 n = ngx_http_regex_exec(r, (*clcfp)->regex, &r->uri); |
1440 | |
1441 if (n == NGX_OK) { | |
1442 r->loc_conf = (*clcfp)->loc_conf; | |
1443 | |
1444 /* look up nested locations */ | |
1445 | |
1446 rc = ngx_http_core_find_location(r); | |
1447 | |
1448 return (rc == NGX_ERROR) ? rc : NGX_OK; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1449 } |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1450 |
3325 | 1451 if (n == NGX_DECLINED) { |
2027 | 1452 continue; |
1453 } | |
1454 | |
3325 | 1455 return NGX_ERROR; |
2027 | 1456 } |
1457 } | |
1386
3c6da0610f19
fix building by bcc without PCRE
Igor Sysoev <igor@sysoev.ru>
parents:
1377
diff
changeset
|
1458 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1459 |
2027 | 1460 return rc; |
1461 } | |
1462 | |
1463 | |
1464 /* | |
1465 * NGX_OK - exact match | |
1466 * NGX_DONE - auto redirect | |
1467 * NGX_AGAIN - inclusive match | |
1468 * NGX_DECLINED - no match | |
1469 */ | |
1470 | |
1471 static ngx_int_t | |
1472 ngx_http_core_find_static_location(ngx_http_request_t *r, | |
1473 ngx_http_location_tree_node_t *node) | |
1474 { | |
1475 u_char *uri; | |
1476 size_t len, n; | |
1477 ngx_int_t rc, rv; | |
1478 | |
1479 len = r->uri.len; | |
1480 uri = r->uri.data; | |
1481 | |
1482 rv = NGX_DECLINED; | |
1483 | |
1484 for ( ;; ) { | |
1485 | |
1486 if (node == NULL) { | |
1487 return rv; | |
485 | 1488 } |
1489 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1490 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6478
3ef7bb882ad4
Fixed logging with variable field width.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6474
diff
changeset
|
1491 "test location: \"%*s\"", |
3ef7bb882ad4
Fixed logging with variable field width.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6474
diff
changeset
|
1492 (size_t) node->len, node->name); |
2027 | 1493 |
1494 n = (len <= (size_t) node->len) ? len : node->len; | |
1495 | |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
2085
diff
changeset
|
1496 rc = ngx_filename_cmp(uri, node->name, n); |
2027 | 1497 |
1498 if (rc != 0) { | |
1499 node = (rc < 0) ? node->left : node->right; | |
1500 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1501 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1502 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1503 |
2027 | 1504 if (len > (size_t) node->len) { |
1505 | |
1506 if (node->inclusive) { | |
1507 | |
1508 r->loc_conf = node->inclusive->loc_conf; | |
1509 rv = NGX_AGAIN; | |
1510 | |
1511 node = node->tree; | |
1512 uri += n; | |
1513 len -= n; | |
485 | 1514 |
1515 continue; | |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1516 } |
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1517 |
2027 | 1518 /* exact only */ |
1519 | |
1520 node = node->right; | |
1521 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1522 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1523 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1524 |
2027 | 1525 if (len == (size_t) node->len) { |
1526 | |
3636
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1527 if (node->exact) { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1528 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
|
1529 return NGX_OK; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1530 |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1531 } else { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1532 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
|
1533 return NGX_AGAIN; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1534 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1535 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1536 |
2027 | 1537 /* len < node->len */ |
1538 | |
1539 if (len + 1 == (size_t) node->len && node->auto_redirect) { | |
1540 | |
1541 r->loc_conf = (node->exact) ? node->exact->loc_conf: | |
1542 node->inclusive->loc_conf; | |
1543 rv = NGX_DONE; | |
1544 } | |
1545 | |
1546 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
|
1547 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1548 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1549 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1550 |
2138 | 1551 void * |
1552 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) | |
1553 { | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1554 u_char c, *lowcase; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1555 size_t len; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1556 ngx_uint_t i, hash; |
2138 | 1557 |
3372
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1558 if (types_hash->size == 0) { |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1559 return (void *) 4; |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1560 } |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1561 |
2138 | 1562 if (r->headers_out.content_type.len == 0) { |
1563 return NULL; | |
1564 } | |
1565 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1566 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
|
1567 |
2138 | 1568 if (r->headers_out.content_type_lowcase == NULL) { |
1569 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1570 lowcase = ngx_pnalloc(r->pool, len); |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1571 if (lowcase == NULL) { |
2138 | 1572 return NULL; |
1573 } | |
1574 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1575 r->headers_out.content_type_lowcase = lowcase; |
2138 | 1576 |
1577 hash = 0; | |
1578 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1579 for (i = 0; i < len; i++) { |
2138 | 1580 c = ngx_tolower(r->headers_out.content_type.data[i]); |
1581 hash = ngx_hash(hash, c); | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1582 lowcase[i] = c; |
2138 | 1583 } |
1584 | |
1585 r->headers_out.content_type_hash = hash; | |
1586 } | |
1587 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1588 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
|
1589 r->headers_out.content_type_lowcase, len); |
2138 | 1590 } |
1591 | |
1592 | |
487 | 1593 ngx_int_t |
1594 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
|
1595 { |
2136 | 1596 u_char c, *exten; |
589 | 1597 ngx_str_t *type; |
649 | 1598 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
|
1599 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
|
1600 |
673 | 1601 if (r->headers_out.content_type.len) { |
1602 return NGX_OK; | |
1603 } | |
1604 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1605 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
|
1606 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1607 if (r->exten.len) { |
485 | 1608 |
649 | 1609 hash = 0; |
1610 | |
1611 for (i = 0; i < r->exten.len; i++) { | |
1612 c = r->exten.data[i]; | |
1613 | |
1614 if (c >= 'A' && c <= 'Z') { | |
1615 | |
2136 | 1616 exten = ngx_pnalloc(r->pool, r->exten.len); |
1617 if (exten == NULL) { | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1618 return NGX_ERROR; |
485 | 1619 } |
1620 | |
2136 | 1621 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); |
485 | 1622 |
1623 r->exten.data = exten; | |
649 | 1624 |
1625 break; | |
485 | 1626 } |
1627 | |
649 | 1628 hash = ngx_hash(hash, c); |
485 | 1629 } |
1630 | |
649 | 1631 type = ngx_hash_find(&clcf->types_hash, hash, |
589 | 1632 r->exten.data, r->exten.len); |
1633 | |
1634 if (type) { | |
657 | 1635 r->headers_out.content_type_len = type->len; |
589 | 1636 r->headers_out.content_type = *type; |
657 | 1637 |
589 | 1638 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
|
1639 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1640 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1641 |
657 | 1642 r->headers_out.content_type_len = clcf->default_type.len; |
589 | 1643 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
|
1644 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1645 return NGX_OK; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1646 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1647 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1648 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1649 void |
487 | 1650 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
|
1651 { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1652 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
|
1653 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
1654 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
|
1655 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1656 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
|
1657 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { |
649 | 1658 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1659 r->exten.len = r->uri.len - i - 1; |
649 | 1660 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
|
1661 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1662 return; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1663 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1664 } 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
|
1665 return; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1666 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1667 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1668 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1669 return; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1670 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1671 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1672 |
487 | 1673 ngx_int_t |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1674 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
|
1675 { |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1676 ngx_table_elt_t *etag; |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1677 ngx_http_core_loc_conf_t *clcf; |
4780 | 1678 |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1679 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
4780 | 1680 |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1681 if (!clcf->etag) { |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1682 return NGX_OK; |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1683 } |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1684 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1685 etag = ngx_list_push(&r->headers_out.headers); |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1686 if (etag == NULL) { |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1687 return NGX_ERROR; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1688 } |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1689 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1690 etag->hash = 1; |
8031
d26db4f82d7d
All known output headers can be linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1691 etag->next = NULL; |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1692 ngx_str_set(&etag->key, "ETag"); |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1693 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1694 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
|
1695 if (etag->value.data == NULL) { |
5825
51fe42cc7876
Fixed ETag memory allocation error handling.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5757
diff
changeset
|
1696 etag->hash = 0; |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1697 return NGX_ERROR; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1698 } |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1699 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1700 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
|
1701 r->headers_out.last_modified_time, |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1702 r->headers_out.content_length_n) |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1703 - etag->value.data; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1704 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1705 r->headers_out.etag = etag; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1706 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1707 return NGX_OK; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1708 } |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1709 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1710 |
5733
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1711 void |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1712 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
|
1713 { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1714 size_t len; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1715 u_char *p; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1716 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
|
1717 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1718 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
|
1719 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1720 if (etag == NULL) { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1721 return; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1722 } |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1723 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1724 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
|
1725 && 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
|
1726 && etag->value.data[1] == '/') |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1727 { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1728 return; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1729 } |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1730 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1731 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
|
1732 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
|
1733 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
|
1734 return; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1735 } |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1736 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1737 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
|
1738 if (p == NULL) { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1739 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
|
1740 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
|
1741 return; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1742 } |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1743 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1744 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
|
1745 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1746 etag->value.data = p; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1747 etag->value.len = len; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1748 } |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1749 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1750 |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1751 ngx_int_t |
3632 | 1752 ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, |
1753 ngx_str_t *ct, ngx_http_complex_value_t *cv) | |
1754 { | |
1755 ngx_int_t rc; | |
1756 ngx_str_t val; | |
1757 ngx_buf_t *b; | |
1758 ngx_chain_t out; | |
1759 | |
7563
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1760 rc = ngx_http_discard_request_body(r); |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1761 |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1762 if (rc != NGX_OK) { |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1763 return rc; |
4148
18f1cb12c6d7
Fix for "return 202" not discarding body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
1764 } |
18f1cb12c6d7
Fix for "return 202" not discarding body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
1765 |
3632 | 1766 r->headers_out.status = status; |
1767 | |
1768 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { | |
1769 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1770 } | |
1771 | |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1772 if (status == NGX_HTTP_MOVED_PERMANENTLY |
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1773 || status == NGX_HTTP_MOVED_TEMPORARILY |
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1774 || status == NGX_HTTP_SEE_OTHER |
6977
be5cfa918bfc
Added support for the "308 Permanent Redirect" (ticket #877).
Simon Leblanc <contact@leblanc-simon.eu>
parents:
6973
diff
changeset
|
1775 || status == NGX_HTTP_TEMPORARY_REDIRECT |
be5cfa918bfc
Added support for the "308 Permanent Redirect" (ticket #877).
Simon Leblanc <contact@leblanc-simon.eu>
parents:
6973
diff
changeset
|
1776 || status == NGX_HTTP_PERMANENT_REDIRECT) |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1777 { |
4206
1a94a56a4e5d
Clear old Location header (if any) while adding a new one.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4204
diff
changeset
|
1778 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
|
1779 |
3632 | 1780 r->headers_out.location = ngx_list_push(&r->headers_out.headers); |
1781 if (r->headers_out.location == NULL) { | |
1782 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1783 } | |
1784 | |
1785 r->headers_out.location->hash = 1; | |
8031
d26db4f82d7d
All known output headers can be linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1786 r->headers_out.location->next = NULL; |
3632 | 1787 ngx_str_set(&r->headers_out.location->key, "Location"); |
1788 r->headers_out.location->value = val; | |
1789 | |
1790 return status; | |
1791 } | |
1792 | |
1793 r->headers_out.content_length_n = val.len; | |
1794 | |
1795 if (ct) { | |
1796 r->headers_out.content_type_len = ct->len; | |
1797 r->headers_out.content_type = *ct; | |
1798 | |
1799 } else { | |
1800 if (ngx_http_set_content_type(r) != NGX_OK) { | |
1801 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1802 } | |
1803 } | |
1804 | |
7761
43a0a9e988be
Removed incorrect optimization of HEAD requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7638
diff
changeset
|
1805 if (r != r->main && val.len == 0) { |
3632 | 1806 return ngx_http_send_header(r); |
1807 } | |
1808 | |
6973
99934aade555
Use ngx_calloc_buf() where appropriate.
Ruslan Ermilov <ru@nginx.com>
parents:
6948
diff
changeset
|
1809 b = ngx_calloc_buf(r->pool); |
3632 | 1810 if (b == NULL) { |
1811 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1812 } | |
1813 | |
1814 b->pos = val.data; | |
1815 b->last = val.data + val.len; | |
1816 b->memory = val.len ? 1 : 0; | |
1817 b->last_buf = (r == r->main) ? 1 : 0; | |
1818 b->last_in_chain = 1; | |
1819 | |
1820 out.buf = b; | |
1821 out.next = NULL; | |
1822 | |
1823 rc = ngx_http_send_header(r); | |
1824 | |
1825 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { | |
1826 return rc; | |
1827 } | |
1828 | |
1829 return ngx_http_output_filter(r, &out); | |
1830 } | |
1831 | |
1832 | |
1833 ngx_int_t | |
557 | 1834 ngx_http_send_header(ngx_http_request_t *r) |
1835 { | |
5925
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1836 if (r->post_action) { |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1837 return NGX_OK; |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1838 } |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1839 |
5334
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1840 if (r->header_sent) { |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1841 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
|
1842 "header already sent"); |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1843 return NGX_ERROR; |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1844 } |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1845 |
557 | 1846 if (r->err_status) { |
1847 r->headers_out.status = r->err_status; | |
1848 r->headers_out.status_line.len = 0; | |
1849 } | |
1850 | |
1851 return ngx_http_top_header_filter(r); | |
1852 } | |
1853 | |
1854 | |
1855 ngx_int_t | |
1856 ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in) | |
1857 { | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1858 ngx_int_t rc; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1859 ngx_connection_t *c; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1860 |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1861 c = r->connection; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1862 |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1863 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
583 | 1864 "http output filter \"%V?%V\"", &r->uri, &r->args); |
557 | 1865 |
1866 rc = ngx_http_top_body_filter(r, in); | |
1867 | |
1868 if (rc == NGX_ERROR) { | |
1869 /* NGX_ERROR may be returned by any filter */ | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1870 c->error = 1; |
557 | 1871 } |
1872 | |
1873 return rc; | |
1874 } | |
1875 | |
1876 | |
1877 u_char * | |
1878 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | |
773 | 1879 size_t *root_length, size_t reserved) |
557 | 1880 { |
623 | 1881 u_char *last; |
1882 size_t alias; | |
1883 ngx_http_core_loc_conf_t *clcf; | |
557 | 1884 |
1885 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1886 | |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
1887 alias = clcf->alias; |
557 | 1888 |
603 | 1889 if (alias && !r->valid_location) { |
1890 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
1891 "\"alias\" cannot be used in location \"%V\" " |
603 | 1892 "where URI was rewritten", &clcf->name); |
1893 return NULL; | |
1894 } | |
1895 | |
595 | 1896 if (clcf->root_lengths == NULL) { |
1897 | |
773 | 1898 *root_length = clcf->root.len; |
595 | 1899 |
2565
456e453eb84a
fix reserved mapped uri length if alias has captures
Igor Sysoev <igor@sysoev.ru>
parents:
2564
diff
changeset
|
1900 path->len = clcf->root.len + reserved + r->uri.len - alias + 1; |
595 | 1901 |
2049 | 1902 path->data = ngx_pnalloc(r->pool, path->len); |
595 | 1903 if (path->data == NULL) { |
1904 return NULL; | |
1905 } | |
1906 | |
1907 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | |
623 | 1908 |
1909 } else { | |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1910 |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1911 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
|
1912 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
|
1913 |
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1914 } else { |
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1915 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
|
1916 } |
2572
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1917 |
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1918 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, |
671 | 1919 clcf->root_values->elts) |
667 | 1920 == NULL) |
1921 { | |
1922 return NULL; | |
1923 } | |
1924 | |
5316
12dd27b74117
Fixed memory leaks in the root and auth_basic_user_file directives.
Valentin Bartenev <vbart@nginx.com>
parents:
5266
diff
changeset
|
1925 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
|
1926 != NGX_OK) |
12dd27b74117
Fixed memory leaks in the root and auth_basic_user_file directives.
Valentin Bartenev <vbart@nginx.com>
parents:
5266
diff
changeset
|
1927 { |
623 | 1928 return NULL; |
1929 } | |
1930 | |
773 | 1931 *root_length = path->len - reserved; |
1932 last = path->data + *root_length; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1933 |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1934 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
|
1935 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
|
1936 *last = '\0'; |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1937 return last; |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1938 } |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1939 |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1940 alias = 0; |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1941 } |
595 | 1942 } |
1943 | |
7605
02a539522be4
Tolerate '\0' in URI when mapping URI to path.
Ruslan Ermilov <ru@nginx.com>
parents:
7563
diff
changeset
|
1944 last = ngx_copy(last, r->uri.data + alias, r->uri.len - alias); |
02a539522be4
Tolerate '\0' in URI when mapping URI to path.
Ruslan Ermilov <ru@nginx.com>
parents:
7563
diff
changeset
|
1945 *last = '\0'; |
557 | 1946 |
1947 return last; | |
1948 } | |
1949 | |
1950 | |
1951 ngx_int_t | |
539 | 1952 ngx_http_auth_basic_user(ngx_http_request_t *r) |
1953 { | |
1954 ngx_str_t auth, encoded; | |
1955 ngx_uint_t len; | |
1956 | |
1957 if (r->headers_in.user.len == 0 && r->headers_in.user.data != NULL) { | |
1958 return NGX_DECLINED; | |
1959 } | |
1960 | |
1961 if (r->headers_in.authorization == NULL) { | |
1962 r->headers_in.user.data = (u_char *) ""; | |
1963 return NGX_DECLINED; | |
1964 } | |
1965 | |
1966 encoded = r->headers_in.authorization->value; | |
1967 | |
1968 if (encoded.len < sizeof("Basic ") - 1 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1969 || ngx_strncasecmp(encoded.data, (u_char *) "Basic ", |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1970 sizeof("Basic ") - 1) |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1971 != 0) |
539 | 1972 { |
1973 r->headers_in.user.data = (u_char *) ""; | |
1974 return NGX_DECLINED; | |
1975 } | |
1976 | |
1977 encoded.len -= sizeof("Basic ") - 1; | |
1978 encoded.data += sizeof("Basic ") - 1; | |
1979 | |
1980 while (encoded.len && encoded.data[0] == ' ') { | |
1981 encoded.len--; | |
1982 encoded.data++; | |
1983 } | |
1984 | |
1985 if (encoded.len == 0) { | |
1986 r->headers_in.user.data = (u_char *) ""; | |
1987 return NGX_DECLINED; | |
1988 } | |
577 | 1989 |
539 | 1990 auth.len = ngx_base64_decoded_length(encoded.len); |
2049 | 1991 auth.data = ngx_pnalloc(r->pool, auth.len + 1); |
539 | 1992 if (auth.data == NULL) { |
1993 return NGX_ERROR; | |
1994 } | |
1995 | |
1996 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) { | |
1997 r->headers_in.user.data = (u_char *) ""; | |
1998 return NGX_DECLINED; | |
1999 } | |
577 | 2000 |
539 | 2001 auth.data[auth.len] = '\0'; |
577 | 2002 |
2003 for (len = 0; len < auth.len; len++) { | |
539 | 2004 if (auth.data[len] == ':') { |
2005 break; | |
2006 } | |
2007 } | |
577 | 2008 |
573 | 2009 if (len == 0 || len == auth.len) { |
539 | 2010 r->headers_in.user.data = (u_char *) ""; |
2011 return NGX_DECLINED; | |
2012 } | |
2013 | |
2014 r->headers_in.user.len = len; | |
2015 r->headers_in.user.data = auth.data; | |
2016 r->headers_in.passwd.len = auth.len - len - 1; | |
2017 r->headers_in.passwd.data = &auth.data[len + 1]; | |
2018 | |
2019 return NGX_OK; | |
2020 } | |
2021 | |
2022 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2023 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2024 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2025 ngx_int_t |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2026 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
|
2027 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2028 time_t date, expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2029 ngx_uint_t p; |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2030 ngx_table_elt_t *e, *d, *ae, *cc; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2031 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
|
2032 |
3313 | 2033 r->gzip_tested = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2034 |
3979
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2035 if (r != r->main) { |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2036 return NGX_DECLINED; |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2037 } |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2038 |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2039 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
|
2040 if (ae == NULL) { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2041 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2042 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2043 |
3982
aab3889c41e9
fix r3981 for case "Accept-Encoding: gzip"
Igor Sysoev <igor@sysoev.ru>
parents:
3980
diff
changeset
|
2044 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
|
2045 return NGX_DECLINED; |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2046 } |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2047 |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2048 /* |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2049 * 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
|
2050 * MSIE: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2051 * Firefox: "gzip,deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2052 * Chrome: "gzip,deflate,sdch" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2053 * Safari: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2054 * Opera: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2055 */ |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2056 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2057 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
|
2058 && 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
|
2059 { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2060 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2061 } |
3979
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2062 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2063 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
|
2064 |
2205 | 2065 if (r->headers_in.msie6 && clcf->gzip_disable_msie6) { |
2066 return NGX_DECLINED; | |
2067 } | |
2068 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2069 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
|
2070 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2071 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2072 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2073 if (r->headers_in.via == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2074 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2075 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2076 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2077 p = clcf->gzip_proxied; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2078 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2079 if (p & NGX_HTTP_GZIP_PROXIED_OFF) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2080 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2081 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2082 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2083 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
|
2084 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2085 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2086 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2087 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
|
2088 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2089 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2090 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2091 e = r->headers_out.expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2092 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2093 if (e) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2094 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2095 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
|
2096 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2097 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2098 |
6180
8b6fa4842133
Moved ngx_http_parse_time() to core, renamed accordingly.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
2099 expires = ngx_parse_http_time(e->value.data, e->value.len); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2100 if (expires == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2101 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2102 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2103 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2104 d = r->headers_out.date; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2105 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2106 if (d) { |
6180
8b6fa4842133
Moved ngx_http_parse_time() to core, renamed accordingly.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
2107 date = ngx_parse_http_time(d->value.data, d->value.len); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2108 if (date == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2109 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2110 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2111 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2112 } else { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2113 date = ngx_time(); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2114 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2115 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2116 if (expires < date) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2117 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2118 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2119 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2120 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2121 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2122 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2123 cc = r->headers_out.cache_control; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2124 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2125 if (cc) { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2126 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2127 if ((p & NGX_HTTP_GZIP_PROXIED_NO_CACHE) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2128 && ngx_http_parse_multi_header_lines(r, cc, &ngx_http_gzip_no_cache, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2129 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2130 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2131 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2132 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2133 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2134 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2135 if ((p & NGX_HTTP_GZIP_PROXIED_NO_STORE) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2136 && ngx_http_parse_multi_header_lines(r, cc, &ngx_http_gzip_no_store, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2137 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2138 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2139 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2140 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2141 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2142 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2143 if ((p & NGX_HTTP_GZIP_PROXIED_PRIVATE) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2144 && ngx_http_parse_multi_header_lines(r, cc, &ngx_http_gzip_private, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2145 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2146 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2147 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2148 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2149 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2150 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2151 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2154 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
|
2155 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2156 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2157 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2158 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
|
2159 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2160 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2161 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2162 ok: |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2163 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2164 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2165 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2166 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
|
2167 |
1801
a4cb9c04e7f2
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1800
diff
changeset
|
2168 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
|
2169 &r->headers_in.user_agent->value, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2170 r->connection->log) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2171 != NGX_DECLINED) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2172 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2173 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2174 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2175 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2176 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2177 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2178 |
3313 | 2179 r->gzip_ok = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2180 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2181 return NGX_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2182 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2183 |
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 /* |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2186 * 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
|
2187 * "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
|
2188 * gzip is disabled for the following quantities: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2189 * "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
|
2190 */ |
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 static ngx_int_t |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2193 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
|
2194 { |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2195 u_char *p, *start, *last; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2196 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2197 start = ae->data; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2198 last = start + ae->len; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2199 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2200 for ( ;; ) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2201 p = ngx_strcasestrn(start, "gzip", 4 - 1); |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2202 if (p == NULL) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2203 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2204 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2205 |
3986
6c4d2d163611
fix r3981 again for case "Accept-Encoding: gzip"
Igor Sysoev <igor@sysoev.ru>
parents:
3984
diff
changeset
|
2206 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
|
2207 break; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2208 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2209 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2210 start = p + 4; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2211 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2212 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2213 p += 4; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2214 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2215 while (p < last) { |
5757
c5ec6944de98
Style: add whitespace between control statement and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents:
5733
diff
changeset
|
2216 switch (*p++) { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2217 case ',': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2218 return NGX_OK; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2219 case ';': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2220 goto quantity; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2221 case ' ': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2222 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2223 default: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2224 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2225 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2226 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2227 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2228 return NGX_OK; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2229 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2230 quantity: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2231 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2232 while (p < last) { |
5757
c5ec6944de98
Style: add whitespace between control statement and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents:
5733
diff
changeset
|
2233 switch (*p++) { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2234 case 'q': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2235 case 'Q': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2236 goto equal; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2237 case ' ': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2238 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2239 default: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2240 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2241 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2242 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2243 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2244 return NGX_OK; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2245 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2246 equal: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2247 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2248 if (p + 2 > last || *p++ != '=') { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2249 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2250 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2251 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2252 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
|
2253 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2254 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2255 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2256 return NGX_OK; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2257 } |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2258 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2259 |
5651
b51bd021808b
Fixed missing "static" in declaration of ngx_http_gzip_quantity().
Valentin Bartenev <vbart@nginx.com>
parents:
5637
diff
changeset
|
2260 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
|
2261 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
|
2262 { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2263 u_char c; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2264 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
|
2265 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2266 c = *p++; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2267 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2268 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
|
2269 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2270 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2271 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2272 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
|
2273 |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2274 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
|
2275 return q; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2276 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2277 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2278 c = *p++; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2279 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2280 if (c == ',' || c == ' ') { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2281 return q; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2282 } |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2283 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2284 if (c != '.') { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2285 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2286 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2287 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2288 n = 0; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2289 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2290 while (p < last) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2291 c = *p++; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2292 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2293 if (c == ',' || c == ' ') { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2294 break; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2295 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2296 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2297 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
|
2298 q += c - '0'; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2299 n++; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2300 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2301 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2302 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2303 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2304 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2305 |
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
|
2306 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
|
2307 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2308 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2309 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2310 return q; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2311 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2312 |
1790
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2315 |
539 | 2316 ngx_int_t |
509 | 2317 ngx_http_subrequest(ngx_http_request_t *r, |
758
86bb73dc8d40
fix <!--#include virtual=... wait="yes" -->
Igor Sysoev <igor@sysoev.ru>
parents:
716
diff
changeset
|
2318 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
|
2319 ngx_http_post_subrequest_t *ps, ngx_uint_t flags) |
509 | 2320 { |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2321 ngx_time_t *tp; |
583 | 2322 ngx_connection_t *c; |
509 | 2323 ngx_http_request_t *sr; |
2324 ngx_http_core_srv_conf_t *cscf; | |
2325 ngx_http_postponed_request_t *pr, *p; | |
2326 | |
6237
06e850859a26
Limit recursive subrequests instead of simultaneous.
Valentin Bartenev <vbart@nginx.com>
parents:
6227
diff
changeset
|
2327 if (r->subrequests == 0) { |
657 | 2328 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
679 | 2329 "subrequests cycle while processing \"%V\"", uri); |
657 | 2330 return NGX_ERROR; |
2331 } | |
2332 | |
6238
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2333 /* |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2334 * 1000 is reserved for other purposes. |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2335 */ |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2336 if (r->main->count >= 65535 - 1000) { |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2337 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0, |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2338 "request reference counter overflow " |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2339 "while processing \"%V\"", uri); |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2340 return NGX_ERROR; |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2341 } |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2342 |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2343 if (r->subrequest_in_memory) { |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2344 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2345 "nested in-memory subrequest \"%V\"", uri); |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2346 return NGX_ERROR; |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2347 } |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2348 |
509 | 2349 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t)); |
2350 if (sr == NULL) { | |
645 | 2351 return NGX_ERROR; |
509 | 2352 } |
2353 | |
2354 sr->signature = NGX_HTTP_MODULE; | |
583 | 2355 |
2356 c = r->connection; | |
2357 sr->connection = c; | |
509 | 2358 |
2359 sr->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); | |
2360 if (sr->ctx == NULL) { | |
645 | 2361 return NGX_ERROR; |
509 | 2362 } |
2363 | |
2364 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | |
581 | 2365 sizeof(ngx_table_elt_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2366 != NGX_OK) |
509 | 2367 { |
645 | 2368 return NGX_ERROR; |
509 | 2369 } |
2370 | |
7034
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2371 if (ngx_list_init(&sr->headers_out.trailers, r->pool, 4, |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2372 sizeof(ngx_table_elt_t)) |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2373 != NGX_OK) |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2374 { |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2375 return NGX_ERROR; |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2376 } |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2377 |
509 | 2378 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2379 sr->main_conf = cscf->ctx->main_conf; | |
2380 sr->srv_conf = cscf->ctx->srv_conf; | |
2381 sr->loc_conf = cscf->ctx->loc_conf; | |
2382 | |
2383 sr->pool = r->pool; | |
2384 | |
2385 sr->headers_in = r->headers_in; | |
2386 | |
577 | 2387 ngx_http_clear_content_length(sr); |
2388 ngx_http_clear_accept_ranges(sr); | |
2389 ngx_http_clear_last_modified(sr); | |
509 | 2390 |
2391 sr->request_body = r->request_body; | |
2392 | |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
2393 #if (NGX_HTTP_V2) |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
2394 sr->stream = r->stream; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
2395 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
2396 |
509 | 2397 sr->method = NGX_HTTP_GET; |
2398 sr->http_version = r->http_version; | |
2399 | |
2400 sr->request_line = r->request_line; | |
2401 sr->uri = *uri; | |
573 | 2402 |
509 | 2403 if (args) { |
2404 sr->args = *args; | |
2405 } | |
573 | 2406 |
583 | 2407 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2408 "http subrequest \"%V?%V\"", uri, &sr->args); | |
2409 | |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2410 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
|
2411 sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0; |
7006
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2412 sr->background = (flags & NGX_HTTP_SUBREQUEST_BACKGROUND) != 0; |
573 | 2413 |
509 | 2414 sr->unparsed_uri = r->unparsed_uri; |
1857
18c20c38ad6d
update GET method text in an subrequest
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
2415 sr->method_name = ngx_http_core_get_method; |
509 | 2416 sr->http_protocol = r->http_protocol; |
7295 | 2417 sr->schema = r->schema; |
509 | 2418 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2419 ngx_http_set_exten(sr); |
509 | 2420 |
553 | 2421 sr->main = r->main; |
509 | 2422 sr->parent = r; |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2423 sr->post_subrequest = ps; |
509 | 2424 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
|
2425 sr->write_event_handler = ngx_http_handler; |
509 | 2426 |
2427 sr->variables = r->variables; | |
2428 | |
2429 sr->log_handler = r->log_handler; | |
2430 | |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2431 if (sr->subrequest_in_memory) { |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2432 sr->filter_need_in_memory = 1; |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2433 } |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2434 |
7006
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2435 if (!sr->background) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2436 if (c->data == r && r->postponed == NULL) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2437 c->data = sr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2438 } |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2439 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2440 pr = ngx_palloc(r->pool, sizeof(ngx_http_postponed_request_t)); |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2441 if (pr == NULL) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2442 return NGX_ERROR; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2443 } |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2444 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2445 pr->request = sr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2446 pr->out = NULL; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2447 pr->next = NULL; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2448 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2449 if (r->postponed) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2450 for (p = r->postponed; p->next; p = p->next) { /* void */ } |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2451 p->next = pr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2452 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2453 } else { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2454 r->postponed = pr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2455 } |
509 | 2456 } |
2457 | |
2458 sr->internal = 1; | |
2459 | |
543 | 2460 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
|
2461 sr->expect_tested = 1; |
513 | 2462 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; |
2463 | |
651 | 2464 sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1; |
6237
06e850859a26
Limit recursive subrequests instead of simultaneous.
Valentin Bartenev <vbart@nginx.com>
parents:
6227
diff
changeset
|
2465 sr->subrequests = r->subrequests - 1; |
651 | 2466 |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2467 tp = ngx_timeofday(); |
3897 | 2468 sr->start_sec = tp->sec; |
2469 sr->start_msec = tp->msec; | |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2470 |
3049 | 2471 r->main->count++; |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2472 |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2473 *psr = sr; |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2474 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2475 if (flags & NGX_HTTP_SUBREQUEST_CLONE) { |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2476 sr->method = r->method; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2477 sr->method_name = r->method_name; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2478 sr->loc_conf = r->loc_conf; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2479 sr->valid_location = r->valid_location; |
7168
46ebff8c6396
Inherit valid_unparsed_uri in cloned subrequests (ticket #1430).
Roman Arutyunyan <arut@nginx.com>
parents:
7071
diff
changeset
|
2480 sr->valid_unparsed_uri = r->valid_unparsed_uri; |
6920
8b7fd958c59f
Fixed background update with "if".
Maxim Dounin <mdounin@mdounin.ru>
parents:
6906
diff
changeset
|
2481 sr->content_handler = r->content_handler; |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2482 sr->phase_handler = r->phase_handler; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2483 sr->write_event_handler = ngx_http_core_run_phases; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2484 |
7427
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2485 #if (NGX_PCRE) |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2486 sr->ncaptures = r->ncaptures; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2487 sr->captures = r->captures; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2488 sr->captures_data = r->captures_data; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2489 sr->realloc_captures = 1; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2490 r->realloc_captures = 1; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2491 #endif |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2492 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2493 ngx_http_update_location_config(sr); |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2494 } |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2495 |
3064 | 2496 return ngx_http_post_request(sr, NULL); |
509 | 2497 } |
2498 | |
2499 | |
2500 ngx_int_t | |
487 | 2501 ngx_http_internal_redirect(ngx_http_request_t *r, |
2502 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
|
2503 { |
487 | 2504 ngx_http_core_srv_conf_t *cscf; |
2505 | |
677 | 2506 r->uri_changes--; |
2507 | |
2508 if (r->uri_changes == 0) { | |
2509 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2510 "rewrite or internal redirection cycle " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
2511 "while internally redirecting to \"%V\"", uri); |
679 | 2512 |
3114
1c4fcfe57af1
fix request counter for rewrite or internal redirection cycle,
Igor Sysoev <igor@sysoev.ru>
parents:
3078
diff
changeset
|
2513 r->main->count++; |
677 | 2514 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2515 return NGX_DONE; | |
2516 } | |
2517 | |
461 | 2518 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
|
2519 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2520 if (args) { |
461 | 2521 r->args = *args; |
509 | 2522 |
2523 } else { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
2524 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
|
2525 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2526 |
583 | 2527 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2528 "internal redirect: \"%V?%V\"", uri, &r->args); | |
2529 | |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2530 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
|
2531 |
675 | 2532 /* clear the modules contexts */ |
2533 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
|
2534 |
487 | 2535 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2536 r->loc_conf = cscf->ctx->loc_conf; | |
2537 | |
535 | 2538 ngx_http_update_location_config(r); |
2539 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2540 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2541 r->cache = NULL; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2542 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2543 |
509 | 2544 r->internal = 1; |
4375
f31146f282fd
Added clearing of r->valid_unparsed_uri on internal redirects.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4325
diff
changeset
|
2545 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
|
2546 r->add_uri_to_alias = 0; |
3049 | 2547 r->main->count++; |
509 | 2548 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2549 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
|
2550 |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
2551 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
|
2552 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2553 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2554 |
1353 | 2555 ngx_int_t |
2556 ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name) | |
2557 { | |
2558 ngx_http_core_srv_conf_t *cscf; | |
2559 ngx_http_core_loc_conf_t **clcfp; | |
2560 ngx_http_core_main_conf_t *cmcf; | |
2561 | |
3049 | 2562 r->main->count++; |
4472
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2563 r->uri_changes--; |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2564 |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2565 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
|
2566 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
|
2567 "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
|
2568 "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
|
2569 |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2570 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
|
2571 return NGX_DONE; |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2572 } |
3049 | 2573 |
5584
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2574 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
|
2575 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
|
2576 "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
|
2577 |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2578 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
|
2579 return NGX_DONE; |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2580 } |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2581 |
1353 | 2582 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2583 | |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2584 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
|
2585 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2586 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
|
2587 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2588 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
|
2589 "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
|
2590 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2591 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
|
2592 || 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
|
2593 { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2594 continue; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2595 } |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2596 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2597 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
|
2598 "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
|
2599 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
|
2600 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2601 r->internal = 1; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2602 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
|
2603 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
|
2604 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
|
2605 |
4210
c8f6248566aa
Added clearing of modules' contexts in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4206
diff
changeset
|
2606 /* clear the modules contexts */ |
c8f6248566aa
Added clearing of modules' contexts in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4206
diff
changeset
|
2607 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
|
2608 |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2609 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
|
2610 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2611 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
|
2612 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2613 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
|
2614 |
4614
347a54b2cb14
Added write event handler reset in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4600
diff
changeset
|
2615 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
|
2616 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
|
2617 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2618 return NGX_DONE; |
1353 | 2619 } |
2620 } | |
2621 | |
2622 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1591 | 2623 "could not find named location \"%V\"", name); |
1353 | 2624 |
2625 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
2027 | 2626 |
1353 | 2627 return NGX_DONE; |
2628 } | |
2629 | |
2630 | |
569 | 2631 ngx_http_cleanup_t * |
2632 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
|
2633 { |
569 | 2634 ngx_http_cleanup_t *cln; |
2635 | |
2636 r = r->main; | |
2637 | |
2638 cln = ngx_palloc(r->pool, sizeof(ngx_http_cleanup_t)); | |
2639 if (cln == NULL) { | |
2640 return NULL; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2641 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2642 |
569 | 2643 if (size) { |
2644 cln->data = ngx_palloc(r->pool, size); | |
2645 if (cln->data == NULL) { | |
2646 return NULL; | |
2647 } | |
2648 | |
2649 } else { | |
2650 cln->data = NULL; | |
2651 } | |
2652 | |
2653 cln->handler = NULL; | |
2654 cln->next = r->cleanup; | |
2655 | |
2656 r->cleanup = cln; | |
2657 | |
2658 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2659 "http cleanup add: %p", cln); | |
2660 | |
2661 return cln; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2662 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2663 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2664 |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2665 ngx_int_t |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2666 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
|
2667 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
|
2668 { |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2669 #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
|
2670 u_char *p; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2671 ngx_str_t from; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2672 |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2673 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
|
2674 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2675 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
|
2676 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2677 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2678 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2679 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
|
2680 != NGX_OK) |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2681 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2682 return NGX_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2683 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2684 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2685 if (from.len == 0 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2686 || from.len > path->len |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2687 || 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
|
2688 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2689 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2690 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2691 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2692 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
|
2693 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
|
2694 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2695 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2696 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2697 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
|
2698 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2699 if (*p == '/') { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2700 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
|
2701 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2702 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2703 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2704 p--; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2705 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2706 if (*p == '/') { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2707 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
|
2708 } |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2709 #endif |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2710 |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2711 return NGX_OK; |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2712 } |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2713 |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2714 |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2715 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
|
2716 ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr, |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2717 ngx_table_elt_t *headers, ngx_str_t *value, ngx_array_t *proxies, |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2718 int recursive) |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2719 { |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2720 ngx_int_t rc; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2721 ngx_uint_t found; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2722 ngx_table_elt_t *h, *next; |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2723 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2724 if (headers == NULL) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2725 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
|
2726 value->len, proxies, |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2727 recursive); |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2728 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2729 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2730 /* revert headers order */ |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2731 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2732 for (h = headers, headers = NULL; h; h = next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2733 next = h->next; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2734 h->next = headers; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2735 headers = h; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2736 } |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2737 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2738 /* iterate over all headers in reverse order */ |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2739 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2740 rc = NGX_DECLINED; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2741 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2742 found = 0; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2743 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2744 for (h = headers; h; h = h->next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2745 rc = ngx_http_get_forwarded_addr_internal(r, addr, h->value.data, |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2746 h->value.len, proxies, |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2747 recursive); |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2748 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2749 if (!recursive) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2750 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2751 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2752 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2753 if (rc == NGX_DECLINED && found) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2754 rc = NGX_DONE; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2755 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2756 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2757 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2758 if (rc != NGX_OK) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2759 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2760 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2761 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2762 found = 1; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2763 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2764 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2765 /* restore headers order */ |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2766 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2767 for (h = headers, headers = NULL; h; h = next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2768 next = h->next; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2769 h->next = headers; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2770 headers = h; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2771 } |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2772 |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2773 return rc; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2774 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2775 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2776 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2777 static ngx_int_t |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2778 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
|
2779 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
|
2780 { |
6683
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2781 u_char *p; |
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2782 ngx_addr_t paddr; |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2783 ngx_uint_t found; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2784 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2785 found = 0; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2786 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2787 do { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2788 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2789 if (ngx_cidr_match(addr->sockaddr, proxies) != NGX_OK) { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2790 return found ? NGX_DONE : NGX_DECLINED; |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2791 } |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2792 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2793 for (p = xff + xfflen - 1; p > xff; p--, xfflen--) { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2794 if (*p != ' ' && *p != ',') { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2795 break; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2796 } |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2797 } |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2798 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2799 for ( /* void */ ; p > xff; p--) { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2800 if (*p == ' ' || *p == ',') { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2801 p++; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2802 break; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2803 } |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2804 } |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2805 |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2806 if (ngx_parse_addr_port(r->pool, &paddr, p, xfflen - (p - xff)) |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2807 != NGX_OK) |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2808 { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2809 return found ? NGX_DONE : NGX_DECLINED; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2810 } |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2811 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2812 *addr = paddr; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2813 found = 1; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2814 xfflen = p - 1 - xff; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2815 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2816 } while (recursive && p > xff); |
6683
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2817 |
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2818 return NGX_OK; |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2819 } |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2820 |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2821 |
8020
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2822 ngx_int_t |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2823 ngx_http_link_multi_headers(ngx_http_request_t *r) |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2824 { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2825 ngx_uint_t i, j; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2826 ngx_list_part_t *part, *ppart; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2827 ngx_table_elt_t *header, *pheader, **ph; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2828 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2829 if (r->headers_in.multi_linked) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2830 return NGX_OK; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2831 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2832 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2833 r->headers_in.multi_linked = 1; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2834 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2835 part = &r->headers_in.headers.part; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2836 header = part->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2837 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2838 for (i = 0; /* void */; i++) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2839 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2840 if (i >= part->nelts) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2841 if (part->next == NULL) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2842 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2843 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2844 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2845 part = part->next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2846 header = part->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2847 i = 0; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2848 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2849 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2850 header[i].next = NULL; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2851 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2852 /* |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2853 * search for previous headers with the same name; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2854 * if there are any, link to them |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2855 */ |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2856 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2857 ppart = &r->headers_in.headers.part; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2858 pheader = ppart->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2859 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2860 for (j = 0; /* void */; j++) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2861 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2862 if (j >= ppart->nelts) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2863 if (ppart->next == NULL) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2864 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2865 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2866 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2867 ppart = ppart->next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2868 pheader = ppart->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2869 j = 0; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2870 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2871 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2872 if (part == ppart && i == j) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2873 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2874 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2875 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2876 if (header[i].key.len == pheader[j].key.len |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2877 && ngx_strncasecmp(header[i].key.data, pheader[j].key.data, |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2878 header[i].key.len) |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2879 == 0) |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2880 { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2881 ph = &pheader[j].next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2882 while (*ph) { ph = &(*ph)->next; } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2883 *ph = &header[i]; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2884 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2885 r->headers_in.multi = 1; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2886 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2887 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2888 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2889 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2890 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2891 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2892 return NGX_OK; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2893 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2894 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2895 |
487 | 2896 static char * |
2897 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
|
2898 { |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2899 char *rv; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2900 void *mconf; |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2901 size_t len; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2902 u_char *p; |
1246
7dda762dcc9a
fix building --without-http_rewrite_module, the bug was introduced in r1236
Igor Sysoev <igor@sysoev.ru>
parents:
1236
diff
changeset
|
2903 ngx_uint_t i; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2904 ngx_conf_t pcf; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2905 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
|
2906 struct sockaddr_in *sin; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2907 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
|
2908 ngx_http_listen_opt_t lsopt; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2909 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
|
2910 ngx_http_core_main_conf_t *cmcf; |
487 | 2911 |
501 | 2912 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2913 if (ctx == NULL) { | |
487 | 2914 return NGX_CONF_ERROR; |
2915 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2916 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2917 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
|
2918 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
|
2919 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2920 /* 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
|
2921 |
487 | 2922 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2923 if (ctx->srv_conf == NULL) { | |
2924 return NGX_CONF_ERROR; | |
2925 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2926 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2927 /* 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
|
2928 |
487 | 2929 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2930 if (ctx->loc_conf == NULL) { | |
2931 return NGX_CONF_ERROR; | |
2932 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2933 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2934 for (i = 0; cf->cycle->modules[i]; i++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2935 if (cf->cycle->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
|
2936 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2937 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2938 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2939 module = cf->cycle->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
|
2940 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2941 if (module->create_srv_conf) { |
501 | 2942 mconf = module->create_srv_conf(cf); |
2943 if (mconf == NULL) { | |
487 | 2944 return NGX_CONF_ERROR; |
2945 } | |
2946 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2947 ctx->srv_conf[cf->cycle->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
|
2948 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2949 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2950 if (module->create_loc_conf) { |
501 | 2951 mconf = module->create_loc_conf(cf); |
2952 if (mconf == NULL) { | |
487 | 2953 return NGX_CONF_ERROR; |
2954 } | |
2955 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2956 ctx->loc_conf[cf->cycle->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
|
2957 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2958 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2959 |
487 | 2960 |
2961 /* 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
|
2962 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2963 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
|
2964 cscf->ctx = ctx; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2965 |
487 | 2966 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2967 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; |
487 | 2968 |
501 | 2969 cscfp = ngx_array_push(&cmcf->servers); |
2970 if (cscfp == NULL) { | |
487 | 2971 return NGX_CONF_ERROR; |
2972 } | |
2973 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2974 *cscfp = cscf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2975 |
487 | 2976 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2977 /* parse inside server{} */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2978 |
521 | 2979 pcf = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2980 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
|
2981 cf->cmd_type = NGX_HTTP_SRV_CONF; |
485 | 2982 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2983 rv = ngx_conf_parse(cf, NULL); |
485 | 2984 |
521 | 2985 *cf = pcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2986 |
3775
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2987 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
|
2988 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
|
2989 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2990 p = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2991 if (p == NULL) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2992 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2993 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2994 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2995 lsopt.sockaddr = (struct sockaddr *) p; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2996 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2997 sin = (struct sockaddr_in *) p; |
3775
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2998 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2999 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
|
3000 #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
|
3001 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
|
3002 #else |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3003 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
|
3004 #endif |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3005 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
|
3006 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3007 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
|
3008 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3009 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
|
3010 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
|
3011 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
|
3012 #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
|
3013 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
|
3014 #endif |
5456
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
3015 #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
|
3016 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
|
3017 #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
|
3018 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
|
3019 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3020 len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3021 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3022 p = ngx_pnalloc(cf->pool, len); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3023 if (p == NULL) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3024 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3025 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3026 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3027 lsopt.addr_text.data = p; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3028 lsopt.addr_text.len = ngx_sock_ntop(lsopt.sockaddr, lsopt.socklen, p, |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3029 len, 1); |
3775
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3030 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3031 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
|
3032 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
|
3033 } |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3034 } |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3035 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3036 return rv; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3037 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3038 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3039 |
487 | 3040 static char * |
3041 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
|
3042 { |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3043 char *rv; |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3044 u_char *mod; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3045 size_t len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3046 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
|
3047 ngx_uint_t i; |
485 | 3048 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
|
3049 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
|
3050 ngx_http_conf_ctx_t *ctx, *pctx; |
2027 | 3051 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
|
3052 |
501 | 3053 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
3054 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
|
3055 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
|
3056 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3057 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3058 pctx = cf->ctx; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3059 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
|
3060 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
|
3061 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3062 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
|
3063 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
|
3064 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
|
3065 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3066 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3067 for (i = 0; cf->cycle->modules[i]; i++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3068 if (cf->cycle->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
|
3069 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3070 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3071 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3072 module = cf->cycle->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
|
3073 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3074 if (module->create_loc_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3075 ctx->loc_conf[cf->cycle->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
|
3076 module->create_loc_conf(cf); |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3077 if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) { |
6474 | 3078 return NGX_CONF_ERROR; |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3079 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3080 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3081 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3082 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3083 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
|
3084 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
|
3085 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
3086 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
|
3087 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3088 if (cf->args->nelts == 3) { |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3089 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3090 len = value[1].len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3091 mod = value[1].data; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3092 name = &value[2]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3093 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3094 if (len == 1 && mod[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3095 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3096 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
|
3097 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
|
3098 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3099 } 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
|
3100 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3101 clcf->name = *name; |
467 | 3102 clcf->noregex = 1; |
3103 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3104 } else if (len == 1 && mod[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3105 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3106 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
|
3107 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
|
3108 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3109 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3110 } 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
|
3111 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3112 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
|
3113 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3114 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3115 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3116 } else { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3117 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3118 "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
|
3119 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
|
3120 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3121 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3122 } else { |
1353 | 3123 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3124 name = &value[1]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3125 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3126 if (name->data[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3127 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3128 clcf->name.len = name->len - 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3129 clcf->name.data = name->data + 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3130 clcf->exact_match = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3131 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3132 } 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
|
3133 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3134 clcf->name.len = name->len - 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3135 clcf->name.data = name->data + 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3136 clcf->noregex = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3137 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3138 } else if (name->data[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3139 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3140 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3141 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3142 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3143 if (name->data[0] == '*') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3144 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3145 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3146 name->data++; |
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 (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
|
3149 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3150 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3151 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3152 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3153 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
|
3154 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3155 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3156 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3157 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3158 } else { |
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 clcf->name = *name; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3161 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3162 if (name->data[0] == '@') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3163 clcf->named = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3164 } |
1353 | 3165 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3166 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3167 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3168 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
|
3169 |
6244
055d1f63960a
Fixed segfault with incorrect location nesting.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6238
diff
changeset
|
3170 if (cf->cmd_type == NGX_HTTP_LOC_CONF) { |
2027 | 3171 |
3172 /* nested location */ | |
3173 | |
485 | 3174 #if 0 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3175 clcf->prev_location = pclcf; |
485 | 3176 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3177 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3178 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
|
3179 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3180 "location \"%V\" cannot be inside " |
461 | 3181 "the exact location \"%V\"", |
3182 &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
|
3183 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
|
3184 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3185 |
1353 | 3186 if (pclcf->named) { |
3187 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3188 "location \"%V\" cannot be inside " |
1353 | 3189 "the named location \"%V\"", |
3190 &clcf->name, &pclcf->name); | |
3191 return NGX_CONF_ERROR; | |
3192 } | |
3193 | |
2027 | 3194 if (clcf->named) { |
3195 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3196 "named location \"%V\" can be " |
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3197 "on the server level only", |
2027 | 3198 &clcf->name); |
3199 return NGX_CONF_ERROR; | |
3200 } | |
3201 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3202 len = pclcf->name.len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3203 |
455 | 3204 #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
|
3205 if (clcf->regex == NULL |
5388
fbaae7d1c033
Caseless location tree construction (ticket #90).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5339
diff
changeset
|
3206 && 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
|
3207 #else |
5388
fbaae7d1c033
Caseless location tree construction (ticket #90).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5339
diff
changeset
|
3208 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
|
3209 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3210 { |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3211 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3212 "location \"%V\" is outside location \"%V\"", |
3213 &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
|
3214 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
|
3215 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3216 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3217 |
2027 | 3218 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { |
3219 return NGX_CONF_ERROR; | |
3220 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3221 |
485 | 3222 save = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3223 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
|
3224 cf->cmd_type = NGX_HTTP_LOC_CONF; |
485 | 3225 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3226 rv = ngx_conf_parse(cf, NULL); |
485 | 3227 |
3228 *cf = save; | |
3229 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3230 return rv; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3231 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3232 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3233 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3234 static ngx_int_t |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3235 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
|
3236 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
|
3237 { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3238 #if (NGX_PCRE) |
3325 | 3239 ngx_regex_compile_t rc; |
3240 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
3241 | |
3242 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); | |
3243 | |
3244 rc.pattern = *regex; | |
3245 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
3246 rc.err.data = errstr; | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3247 |
2981
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
3248 #if (NGX_HAVE_CASELESS_FILESYSTEM) |
3325 | 3249 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
|
3250 #else |
5148
4bcd35e7a0f0
Pass PCRE_CASELESS to pcre_compile() for caseless matching.
Ruslan Ermilov <ru@nginx.com>
parents:
5121
diff
changeset
|
3251 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
|
3252 #endif |
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
3253 |
3325 | 3254 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
|
3255 if (clcf->regex == NULL) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3256 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3257 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3258 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3259 clcf->name = *regex; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3260 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3261 return NGX_OK; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3262 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3263 #else |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3264 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3265 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3266 "using regex \"%V\" requires PCRE library", |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3267 regex); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3268 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3269 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3270 #endif |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3271 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3272 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3273 |
487 | 3274 static char * |
3275 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
|
3276 { |
3318 | 3277 ngx_http_core_loc_conf_t *clcf = conf; |
637 | 3278 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3279 char *rv; |
485 | 3280 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
|
3281 |
3318 | 3282 if (clcf->types == NULL) { |
3283 clcf->types = ngx_array_create(cf->pool, 64, sizeof(ngx_hash_key_t)); | |
3284 if (clcf->types == NULL) { | |
637 | 3285 return NGX_CONF_ERROR; |
3286 } | |
3287 } | |
3288 | |
485 | 3289 save = *cf; |
3290 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
|
3291 cf->handler_conf = conf; |
485 | 3292 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3293 rv = ngx_conf_parse(cf, NULL); |
485 | 3294 |
3295 *cf = save; | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3296 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3297 return rv; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3298 } |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3299 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3300 |
487 | 3301 static char * |
3302 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
|
3303 { |
3318 | 3304 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
|
3305 |
4827
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3306 ngx_str_t *value, *content_type, *old; |
2136 | 3307 ngx_uint_t i, n, hash; |
589 | 3308 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
|
3309 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3310 value = cf->args->elts; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3311 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3312 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
|
3313 if (cf->args->nelts != 2) { |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3314 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
|
3315 "invalid number of arguments" |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3316 " in \"include\" directive"); |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3317 return NGX_CONF_ERROR; |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3318 } |
4827
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3319 |
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3320 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
|
3321 } |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3322 |
589 | 3323 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t)); |
3324 if (content_type == NULL) { | |
3325 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
|
3326 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3327 |
589 | 3328 *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
|
3329 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3330 for (i = 1; i < cf->args->nelts; i++) { |
589 | 3331 |
2136 | 3332 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); |
589 | 3333 |
3318 | 3334 type = clcf->types->elts; |
3335 for (n = 0; n < clcf->types->nelts; n++) { | |
589 | 3336 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { |
3337 old = type[n].value; | |
3338 type[n].value = content_type; | |
3339 | |
3340 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3341 "duplicate extension \"%V\", " |
589 | 3342 "content type: \"%V\", " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3343 "previous content type: \"%V\"", |
589 | 3344 &value[i], content_type, old); |
4204
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3345 goto next; |
589 | 3346 } |
3347 } | |
3348 | |
3349 | |
3318 | 3350 type = ngx_array_push(clcf->types); |
501 | 3351 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
|
3352 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
|
3353 } |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
3354 |
589 | 3355 type->key = value[i]; |
2136 | 3356 type->key_hash = hash; |
589 | 3357 type->value = content_type; |
4204
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3358 |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3359 next: |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3360 continue; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3361 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3362 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3363 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
|
3364 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3365 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3366 |
509 | 3367 static ngx_int_t |
3368 ngx_http_core_preconfiguration(ngx_conf_t *cf) | |
3369 { | |
3370 return ngx_http_variables_add_core_vars(cf); | |
3371 } | |
3372 | |
3373 | |
6049
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3374 static ngx_int_t |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3375 ngx_http_core_postconfiguration(ngx_conf_t *cf) |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3376 { |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3377 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
|
3378 |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3379 return NGX_OK; |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3380 } |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3381 |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3382 |
487 | 3383 static void * |
3384 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
|
3385 { |
485 | 3386 ngx_http_core_main_conf_t *cmcf; |
3387 | |
501 | 3388 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t)); |
3389 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
|
3390 return NULL; |
485 | 3391 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3392 |
499 | 3393 if (ngx_array_init(&cmcf->servers, cf->pool, 4, |
569 | 3394 sizeof(ngx_http_core_srv_conf_t *)) |
651 | 3395 != NGX_OK) |
485 | 3396 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3397 return NULL; |
485 | 3398 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3399 |
593 | 3400 cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT; |
3401 cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
477 | 3402 |
611 | 3403 cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT; |
3404 cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3405 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3406 return cmcf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3407 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3408 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3409 |
487 | 3410 static char * |
3411 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
|
3412 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3413 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
|
3414 |
5617
68c6cc832c76
Macros used for initialization in ngx_http_core_init_main_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
5605
diff
changeset
|
3415 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
|
3416 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
|
3417 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
|
3418 |
593 | 3419 cmcf->server_names_hash_bucket_size = |
3420 ngx_align(cmcf->server_names_hash_bucket_size, ngx_cacheline_size); | |
3421 | |
611 | 3422 |
5623
d0e75244a18a
Increased default value of variables_hash_max_size.
Andrei Belov <defan@nginx.com>
parents:
5617
diff
changeset
|
3423 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
|
3424 ngx_conf_init_uint_value(cmcf->variables_hash_bucket_size, 64); |
611 | 3425 |
3426 cmcf->variables_hash_bucket_size = | |
3427 ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size); | |
3428 | |
3345
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3429 if (cmcf->ncaptures) { |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3430 cmcf->ncaptures = (cmcf->ncaptures + 1) * 3; |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3431 } |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3432 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3433 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
|
3434 } |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3435 |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3436 |
487 | 3437 static void * |
3438 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
|
3439 { |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3440 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
|
3441 |
501 | 3442 cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t)); |
3443 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
|
3444 return NULL; |
487 | 3445 } |
3446 | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3447 /* |
487 | 3448 * set by ngx_pcalloc(): |
479 | 3449 * |
3450 * conf->client_large_buffers.num = 0; | |
3451 */ | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3452 |
681 | 3453 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, |
593 | 3454 sizeof(ngx_http_server_name_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3455 != NGX_OK) |
487 | 3456 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3457 return NULL; |
487 | 3458 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3459 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3460 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
|
3461 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
|
3462 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
|
3463 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE; |
511 | 3464 cscf->ignore_invalid_headers = NGX_CONF_UNSET; |
1585 | 3465 cscf->merge_slashes = NGX_CONF_UNSET; |
2256 | 3466 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
|
3467 |
7269
7f955d3b9a0d
SSL: detect "listen ... ssl" without certificates (ticket #178).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7220
diff
changeset
|
3468 cscf->file_name = cf->conf_file->file.name.data; |
7f955d3b9a0d
SSL: detect "listen ... ssl" without certificates (ticket #178).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7220
diff
changeset
|
3469 cscf->line = cf->conf_file->line; |
7f955d3b9a0d
SSL: detect "listen ... ssl" without certificates (ticket #178).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7220
diff
changeset
|
3470 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3471 return cscf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3472 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3473 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3474 |
487 | 3475 static char * |
3476 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
|
3477 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3478 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
|
3479 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
|
3480 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3481 ngx_str_t name; |
593 | 3482 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
|
3483 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
3484 /* 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
|
3485 |
3259
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3486 ngx_conf_merge_size_value(conf->connection_pool_size, |
6314
fcbac620ae83
Style: NGX_PTR_SIZE replaced with sizeof(void *).
Maxim Dounin <mdounin@mdounin.ru>
parents:
6312
diff
changeset
|
3487 prev->connection_pool_size, 64 * sizeof(void *)); |
3259
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3488 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
|
3489 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
|
3490 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
|
3491 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
|
3492 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
|
3493 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
|
3494 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
|
3495 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
|
3496 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
|
3497 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3498 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
|
3499 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
|
3500 "the \"large_client_header_buffers\" size must be " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3501 "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
|
3502 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
|
3503 } |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3504 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3505 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
|
3506 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
|
3507 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3508 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
|
3509 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3510 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
|
3511 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
|
3512 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3513 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
|
3514 /* the array has 4 empty preallocated elements, so push cannot fail */ |
501 | 3515 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
|
3516 #if (NGX_PCRE) |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3517 sn->regex = NULL; |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3518 #endif |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
3519 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
|
3520 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
|
3521 } |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
3522 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3523 sn = conf->server_names.elts; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3524 name = sn[0].name; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3525 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3526 #if (NGX_PCRE) |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3527 if (sn->regex) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3528 name.len++; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3529 name.data--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3530 } else |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3531 #endif |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3532 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3533 if (name.data[0] == '.') { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3534 name.len--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3535 name.data++; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3536 } |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3537 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3538 conf->server_name.len = name.len; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3539 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
|
3540 if (conf->server_name.data == NULL) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3541 return NGX_CONF_ERROR; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3542 } |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3543 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3544 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
|
3545 } |
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
|
3546 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3547 |
487 | 3548 static void * |
3549 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
|
3550 { |
3318 | 3551 ngx_http_core_loc_conf_t *clcf; |
3552 | |
3553 clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t)); | |
3554 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
|
3555 return NULL; |
487 | 3556 } |
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
|
3557 |
479 | 3558 /* |
3559 * set by ngx_pcalloc(): | |
3560 * | |
7848
1bde031b59ff
Location header escaping in redirects (ticket #882).
Ruslan Ermilov <ru@nginx.com>
parents:
7831
diff
changeset
|
3561 * clcf->escaped_name = { 0, NULL }; |
3318 | 3562 * clcf->root = { 0, NULL }; |
3563 * clcf->limit_except = 0; | |
3564 * clcf->post_action = { 0, NULL }; | |
3565 * clcf->types = NULL; | |
3566 * clcf->default_type = { 0, NULL }; | |
3567 * clcf->error_log = NULL; | |
3568 * clcf->error_pages = NULL; | |
3569 * clcf->client_body_path = NULL; | |
3570 * clcf->regex = NULL; | |
3571 * clcf->exact_match = 0; | |
3572 * clcf->auto_redirect = 0; | |
3573 * clcf->alias = 0; | |
3574 * clcf->gzip_proxied = 0; | |
4300 | 3575 * clcf->keepalive_disable = 0; |
479 | 3576 */ |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3577 |
3318 | 3578 clcf->client_max_body_size = NGX_CONF_UNSET; |
3579 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | |
3580 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | |
3581 clcf->satisfy = NGX_CONF_UNSET_UINT; | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
3582 clcf->auth_delay = NGX_CONF_UNSET_MSEC; |
3318 | 3583 clcf->if_modified_since = NGX_CONF_UNSET_UINT; |
4062 | 3584 clcf->max_ranges = NGX_CONF_UNSET_UINT; |
3318 | 3585 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3586 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | |
3587 clcf->internal = NGX_CONF_UNSET; | |
3588 clcf->sendfile = NGX_CONF_UNSET; | |
3589 clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; | |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3590 clcf->subrequest_output_buffer_size = NGX_CONF_UNSET_SIZE; |
3318 | 3591 clcf->aio = NGX_CONF_UNSET; |
6443
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
3592 clcf->aio_write = NGX_CONF_UNSET; |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3593 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3594 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
|
3595 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
|
3596 #endif |
3318 | 3597 clcf->read_ahead = NGX_CONF_UNSET_SIZE; |
3598 clcf->directio = NGX_CONF_UNSET; | |
3599 clcf->directio_alignment = NGX_CONF_UNSET; | |
3600 clcf->tcp_nopush = NGX_CONF_UNSET; | |
3601 clcf->tcp_nodelay = NGX_CONF_UNSET; | |
3602 clcf->send_timeout = NGX_CONF_UNSET_MSEC; | |
3603 clcf->send_lowat = NGX_CONF_UNSET_SIZE; | |
3604 clcf->postpone_output = NGX_CONF_UNSET_SIZE; | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3605 clcf->limit_rate = NGX_CONF_UNSET_PTR; |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3606 clcf->limit_rate_after = NGX_CONF_UNSET_PTR; |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3607 clcf->keepalive_time = NGX_CONF_UNSET_MSEC; |
3318 | 3608 clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC; |
3609 clcf->keepalive_header = NGX_CONF_UNSET; | |
3610 clcf->keepalive_requests = NGX_CONF_UNSET_UINT; | |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
3611 clcf->lingering_close = NGX_CONF_UNSET_UINT; |
3318 | 3612 clcf->lingering_time = NGX_CONF_UNSET_MSEC; |
3613 clcf->lingering_timeout = NGX_CONF_UNSET_MSEC; | |
3614 clcf->resolver_timeout = NGX_CONF_UNSET_MSEC; | |
3615 clcf->reset_timedout_connection = NGX_CONF_UNSET; | |
6852
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3616 clcf->absolute_redirect = NGX_CONF_UNSET; |
3318 | 3617 clcf->server_name_in_redirect = NGX_CONF_UNSET; |
3618 clcf->port_in_redirect = NGX_CONF_UNSET; | |
3619 clcf->msie_padding = NGX_CONF_UNSET; | |
3620 clcf->msie_refresh = NGX_CONF_UNSET; | |
3621 clcf->log_not_found = NGX_CONF_UNSET; | |
3622 clcf->log_subrequest = NGX_CONF_UNSET; | |
3623 clcf->recursive_error_pages = NGX_CONF_UNSET; | |
3484 | 3624 clcf->chunked_transfer_encoding = NGX_CONF_UNSET; |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
3625 clcf->etag = NGX_CONF_UNSET; |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3626 clcf->server_tokens = NGX_CONF_UNSET_UINT; |
3318 | 3627 clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; |
3628 clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3629 | |
3630 clcf->open_file_cache = NGX_CONF_UNSET_PTR; | |
3631 clcf->open_file_cache_valid = NGX_CONF_UNSET; | |
3632 clcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT; | |
3633 clcf->open_file_cache_errors = NGX_CONF_UNSET; | |
3634 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
|
3635 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3636 #if (NGX_HTTP_GZIP) |
3318 | 3637 clcf->gzip_vary = NGX_CONF_UNSET; |
3638 clcf->gzip_http_version = NGX_CONF_UNSET_UINT; | |
1800 | 3639 #if (NGX_PCRE) |
3318 | 3640 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
|
3641 #endif |
3318 | 3642 clcf->gzip_disable_msie6 = 3; |
3773 | 3643 #if (NGX_HTTP_DEGRADATION) |
3644 clcf->gzip_disable_degradation = 3; | |
3645 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3646 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3647 |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3648 #if (NGX_HAVE_OPENAT) |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3649 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
|
3650 clcf->disable_symlinks_from = NGX_CONF_UNSET_PTR; |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3651 #endif |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3652 |
3318 | 3653 return clcf; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3654 } |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3655 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3656 |
589 | 3657 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html"); |
3658 static ngx_str_t ngx_http_core_image_gif_type = ngx_string("image/gif"); | |
3659 static ngx_str_t ngx_http_core_image_jpeg_type = ngx_string("image/jpeg"); | |
3660 | |
3661 static ngx_hash_key_t ngx_http_core_default_types[] = { | |
3662 { ngx_string("html"), 0, &ngx_http_core_text_html_type }, | |
3663 { ngx_string("gif"), 0, &ngx_http_core_image_gif_type }, | |
3664 { ngx_string("jpg"), 0, &ngx_http_core_image_jpeg_type }, | |
3665 { 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
|
3666 }; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3667 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3668 |
487 | 3669 static char * |
589 | 3670 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
|
3671 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3672 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
|
3673 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
|
3674 |
487 | 3675 ngx_uint_t i; |
589 | 3676 ngx_hash_key_t *type; |
3677 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
|
3678 |
603 | 3679 if (conf->root.data == NULL) { |
3680 | |
625 | 3681 conf->alias = prev->alias; |
603 | 3682 conf->root = prev->root; |
3683 conf->root_lengths = prev->root_lengths; | |
3684 conf->root_values = prev->root_values; | |
3685 | |
3686 if (prev->root.data == NULL) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
3687 ngx_str_set(&conf->root, "html"); |
603 | 3688 |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
3689 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { |
603 | 3690 return NGX_CONF_ERROR; |
3691 } | |
3692 } | |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3693 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3694 |
577 | 3695 if (conf->post_action.data == NULL) { |
3696 conf->post_action = prev->post_action; | |
3697 } | |
3698 | |
663 | 3699 ngx_conf_merge_uint_value(conf->types_hash_max_size, |
3700 prev->types_hash_max_size, 1024); | |
3701 | |
3702 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
|
3703 prev->types_hash_bucket_size, 64); |
589 | 3704 |
3705 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size, | |
3706 ngx_cacheline_size); | |
3707 | |
3708 /* | |
4203 | 3709 * the special handling of the "types" directive in the "http" section |
589 | 3710 * to inherit the http's conf->types_hash to all servers |
3711 */ | |
3712 | |
3713 if (prev->types && prev->types_hash.buckets == NULL) { | |
3714 | |
3715 types_hash.hash = &prev->types_hash; | |
3716 types_hash.key = ngx_hash_key_lc; | |
3717 types_hash.max_size = conf->types_hash_max_size; | |
3718 types_hash.bucket_size = conf->types_hash_bucket_size; | |
595 | 3719 types_hash.name = "types_hash"; |
589 | 3720 types_hash.pool = cf->pool; |
3721 types_hash.temp_pool = NULL; | |
3722 | |
3723 if (ngx_hash_init(&types_hash, prev->types->elts, prev->types->nelts) | |
3724 != NGX_OK) | |
3725 { | |
3726 return NGX_CONF_ERROR; | |
3727 } | |
3728 } | |
3729 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3730 if (conf->types == NULL) { |
589 | 3731 conf->types = prev->types; |
3732 conf->types_hash = prev->types_hash; | |
3733 } | |
3734 | |
3735 if (conf->types == NULL) { | |
4200
4f5b3714eead
Preallocating exact number of default MIME types entries.
Igor Sysoev <igor@sysoev.ru>
parents:
4198
diff
changeset
|
3736 conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t)); |
589 | 3737 if (conf->types == NULL) { |
3738 return NGX_CONF_ERROR; | |
3739 } | |
3740 | |
3741 for (i = 0; ngx_http_core_default_types[i].key.len; i++) { | |
3742 type = ngx_array_push(conf->types); | |
3743 if (type == NULL) { | |
487 | 3744 return NGX_CONF_ERROR; |
3745 } | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3746 |
589 | 3747 type->key = ngx_http_core_default_types[i].key; |
3748 type->key_hash = | |
3749 ngx_hash_key_lc(ngx_http_core_default_types[i].key.data, | |
3750 ngx_http_core_default_types[i].key.len); | |
3751 type->value = ngx_http_core_default_types[i].value; | |
3752 } | |
3753 } | |
3754 | |
3755 if (conf->types_hash.buckets == NULL) { | |
3756 | |
3757 types_hash.hash = &conf->types_hash; | |
3758 types_hash.key = ngx_hash_key_lc; | |
3759 types_hash.max_size = conf->types_hash_max_size; | |
3760 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
|
3761 types_hash.name = "types_hash"; |
589 | 3762 types_hash.pool = cf->pool; |
3763 types_hash.temp_pool = NULL; | |
3764 | |
3765 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) | |
3766 != NGX_OK) | |
3767 { | |
3768 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
|
3769 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3770 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3771 |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3772 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
|
3773 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
|
3774 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
|
3775 } else { |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3776 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
|
3777 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3778 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
3779 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3780 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
|
3781 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
|
3782 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3783 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3784 ngx_conf_merge_str_value(conf->default_type, |
487 | 3785 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
|
3786 |
663 | 3787 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
|
3788 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
|
3789 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
|
3790 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
|
3791 (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
|
3792 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
|
3793 prev->client_body_timeout, 60000); |
509 | 3794 |
4266
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3795 ngx_conf_merge_bitmask_value(conf->keepalive_disable, |
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3796 prev->keepalive_disable, |
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3797 (NGX_CONF_BITMASK_SET |
4551
22e613ba0925
Removed safari from keepalive_disable default.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4541
diff
changeset
|
3798 |NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)); |
1806 | 3799 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3800 NGX_HTTP_SATISFY_ALL); | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
3801 ngx_conf_merge_msec_value(conf->auth_delay, prev->auth_delay, 0); |
2361 | 3802 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
2496 | 3803 NGX_HTTP_IMS_EXACT); |
4062 | 3804 ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges, |
4202
7a739880b80c
Replaced magic constants representing default values of some directives
Ruslan Ermilov <ru@nginx.com>
parents:
4200
diff
changeset
|
3805 NGX_MAX_INT32_VALUE); |
2841
faafc084a7a4
fix client_body_in_file_only type
Igor Sysoev <igor@sysoev.ru>
parents:
2820
diff
changeset
|
3806 ngx_conf_merge_uint_value(conf->client_body_in_file_only, |
4202
7a739880b80c
Replaced magic constants representing default values of some directives
Ruslan Ermilov <ru@nginx.com>
parents:
4200
diff
changeset
|
3807 prev->client_body_in_file_only, |
7a739880b80c
Replaced magic constants representing default values of some directives
Ruslan Ermilov <ru@nginx.com>
parents:
4200
diff
changeset
|
3808 NGX_HTTP_REQUEST_BODY_FILE_OFF); |
2845 | 3809 ngx_conf_merge_value(conf->client_body_in_single_buffer, |
3810 prev->client_body_in_single_buffer, 0); | |
509 | 3811 ngx_conf_merge_value(conf->internal, prev->internal, 0); |
154
eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
Igor Sysoev <igor@sysoev.ru>
parents:
153
diff
changeset
|
3812 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); |
1197 | 3813 ngx_conf_merge_size_value(conf->sendfile_max_chunk, |
7950
e3dbd9449b14
Changed default value of sendfile_max_chunk to 2m.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7848
diff
changeset
|
3814 prev->sendfile_max_chunk, 2 * 1024 * 1024); |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3815 ngx_conf_merge_size_value(conf->subrequest_output_buffer_size, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3816 prev->subrequest_output_buffer_size, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3817 (size_t) ngx_pagesize); |
4202
7a739880b80c
Replaced magic constants representing default values of some directives
Ruslan Ermilov <ru@nginx.com>
parents:
4200
diff
changeset
|
3818 ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF); |
6443
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
3819 ngx_conf_merge_value(conf->aio_write, prev->aio_write, 0); |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3820 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3821 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
|
3822 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
|
3823 NULL); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3824 #endif |
3178 | 3825 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); |
2129 | 3826 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
|
3827 NGX_OPEN_FILE_DIRECTIO_OFF); |
3053 | 3828 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, |
3829 512); | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
3830 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); |
679 | 3831 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); |
509 | 3832 |
253
b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
3833 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
|
3834 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
|
3835 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
|
3836 1460); |
7504
c19ca381b2e6
Variables support in limit_rate and limit_rate_after (ticket #293).
Ruslan Ermilov <ru@nginx.com>
parents:
7478
diff
changeset
|
3837 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3838 ngx_conf_merge_ptr_value(conf->limit_rate, prev->limit_rate, NULL); |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3839 ngx_conf_merge_ptr_value(conf->limit_rate_after, |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3840 prev->limit_rate_after, NULL); |
7504
c19ca381b2e6
Variables support in limit_rate and limit_rate_after (ticket #293).
Ruslan Ermilov <ru@nginx.com>
parents:
7478
diff
changeset
|
3841 |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3842 ngx_conf_merge_msec_value(conf->keepalive_time, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3843 prev->keepalive_time, 3600000); |
95
b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
3844 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
|
3845 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
|
3846 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
|
3847 prev->keepalive_header, 0); |
2888 | 3848 ngx_conf_merge_uint_value(conf->keepalive_requests, |
7822
82e174e47663
Changed keepalive_requests default to 1000 (ticket #2155).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7820
diff
changeset
|
3849 prev->keepalive_requests, 1000); |
3990 | 3850 ngx_conf_merge_uint_value(conf->lingering_close, |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
3851 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
|
3852 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
|
3853 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
|
3854 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
|
3855 prev->lingering_timeout, 5000); |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3856 ngx_conf_merge_msec_value(conf->resolver_timeout, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3857 prev->resolver_timeout, 30000); |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3858 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3859 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
|
3860 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3861 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
|
3862 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3863 /* |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3864 * 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
|
3865 * 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
|
3866 */ |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3867 |
4225
016352c19049
Support of several servers in the "resolver" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4210
diff
changeset
|
3868 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
|
3869 if (prev->resolver == NULL) { |
1881 | 3870 return NGX_CONF_ERROR; |
1683
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3871 } |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3872 } |
2006
b52cb9bf2064
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1982
diff
changeset
|
3873 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3874 conf->resolver = prev->resolver; |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3875 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3876 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3877 if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path, |
479 | 3878 prev->client_body_temp_path, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3879 &ngx_http_client_temp_path) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3880 != NGX_OK) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3881 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3882 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3883 } |
479 | 3884 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
3885 ngx_conf_merge_value(conf->reset_timedout_connection, |
487 | 3886 prev->reset_timedout_connection, 0); |
6852
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3887 ngx_conf_merge_value(conf->absolute_redirect, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3888 prev->absolute_redirect, 1); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
3889 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
|
3890 prev->server_name_in_redirect, 0); |
521 | 3891 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
|
3892 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1); |
679 | 3893 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); |
527 | 3894 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); |
2261 | 3895 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); |
679 | 3896 ngx_conf_merge_value(conf->recursive_error_pages, |
3897 prev->recursive_error_pages, 0); | |
3484 | 3898 ngx_conf_merge_value(conf->chunked_transfer_encoding, |
3899 prev->chunked_transfer_encoding, 1); | |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
3900 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
|
3901 |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3902 ngx_conf_merge_uint_value(conf->server_tokens, prev->server_tokens, |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3903 NGX_HTTP_SERVER_TOKENS_ON); |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3904 |
1454 | 3905 ngx_conf_merge_ptr_value(conf->open_file_cache, |
1780 | 3906 prev->open_file_cache, NULL); |
1454 | 3907 |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
3908 ngx_conf_merge_sec_value(conf->open_file_cache_valid, |
1780 | 3909 prev->open_file_cache_valid, 60); |
1454 | 3910 |
1772 | 3911 ngx_conf_merge_uint_value(conf->open_file_cache_min_uses, |
1780 | 3912 prev->open_file_cache_min_uses, 1); |
1772 | 3913 |
1454 | 3914 ngx_conf_merge_sec_value(conf->open_file_cache_errors, |
1780 | 3915 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
|
3916 |
1457 | 3917 ngx_conf_merge_sec_value(conf->open_file_cache_events, |
1780 | 3918 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
|
3919 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3920 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3921 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
|
3922 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
|
3923 NGX_HTTP_VERSION_11); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3924 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
|
3925 (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
|
3926 |
1800 | 3927 #if (NGX_PCRE) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3928 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL); |
1800 | 3929 #endif |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3930 |
2205 | 3931 if (conf->gzip_disable_msie6 == 3) { |
3932 conf->gzip_disable_msie6 = | |
3933 (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6; | |
3934 } | |
3935 | |
3773 | 3936 #if (NGX_HTTP_DEGRADATION) |
3937 | |
3938 if (conf->gzip_disable_degradation == 3) { | |
3939 conf->gzip_disable_degradation = | |
3940 (prev->gzip_disable_degradation == 3) ? | |
3941 0 : prev->gzip_disable_degradation; | |
3942 } | |
3943 | |
3944 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3945 #endif |
1457 | 3946 |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3947 #if (NGX_HAVE_OPENAT) |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3948 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
|
3949 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
|
3950 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
|
3951 prev->disable_symlinks_from, NULL); |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3952 #endif |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3953 |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3954 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
|
3955 } |
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3956 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3957 |
487 | 3958 static char * |
3959 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
|
3960 { |
3217 | 3961 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
|
3962 |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3963 ngx_str_t *value, size; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3964 ngx_url_t u; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3965 ngx_uint_t n; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3966 ngx_http_listen_opt_t lsopt; |
3217 | 3967 |
3968 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
|
3969 |
523 | 3970 value = cf->args->elts; |
577 | 3971 |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3972 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
|
3973 |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3974 u.url = value[1]; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3975 u.listen = 1; |
906 | 3976 u.default_port = 80; |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3977 |
1559
fe11e2a3946d
use pool instead of ngx_conf_t
Igor Sysoev <igor@sysoev.ru>
parents:
1546
diff
changeset
|
3978 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
|
3979 if (u.err) { |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3980 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
|
3981 "%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
|
3982 u.err, &u.url); |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3983 } |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3984 |
577 | 3985 return NGX_CONF_ERROR; |
523 | 3986 } |
3987 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3988 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
|
3989 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3990 lsopt.backlog = NGX_LISTEN_BACKLOG; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3991 lsopt.rcvbuf = -1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3992 lsopt.sndbuf = -1; |
3676 | 3993 #if (NGX_HAVE_SETFIB) |
3994 lsopt.setfib = -1; | |
3995 #endif | |
5456
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
3996 #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
|
3997 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
|
3998 #endif |
6719
cebf5fed00bf
Modules compatibility: removed unneeded IPV6_V6ONLY checks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6683
diff
changeset
|
3999 #if (NGX_HAVE_INET6) |
4771
bdcdbdf35b52
Core: ipv6only is now on by default.
Ruslan Ermilov <ru@nginx.com>
parents:
4768
diff
changeset
|
4000 lsopt.ipv6only = 1; |
bdcdbdf35b52
Core: ipv6only is now on by default.
Ruslan Ermilov <ru@nginx.com>
parents:
4768
diff
changeset
|
4001 #endif |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4002 |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4003 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
|
4004 |
3225
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4005 if (ngx_strcmp(value[n].data, "default_server") == 0 |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4006 || ngx_strcmp(value[n].data, "default") == 0) |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4007 { |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4008 lsopt.default_server = 1; |
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4009 continue; |
523 | 4010 } |
4011 | |
4012 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
|
4013 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4014 lsopt.bind = 1; |
523 | 4015 continue; |
4016 } | |
4017 | |
3676 | 4018 #if (NGX_HAVE_SETFIB) |
4019 if (ngx_strncmp(value[n].data, "setfib=", 7) == 0) { | |
4020 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
|
4021 lsopt.set = 1; |
8f2c69418045
Fixed "setfib=" on non-first listening socket.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5428
diff
changeset
|
4022 lsopt.bind = 1; |
3676 | 4023 |
3687 | 4024 if (lsopt.setfib == NGX_ERROR) { |
3676 | 4025 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4026 "invalid setfib \"%V\"", &value[n]); | |
4027 return NGX_CONF_ERROR; | |
4028 } | |
4029 | |
4030 continue; | |
4031 } | |
4032 #endif | |
5456
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4033 |
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 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
|
4036 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
|
4037 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
|
4038 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
|
4039 |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4040 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
|
4041 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
|
4042 "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
|
4043 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
|
4044 } |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4045 |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4046 continue; |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4047 } |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4048 #endif |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4049 |
563 | 4050 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
|
4051 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
|
4052 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4053 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4054 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4055 if (lsopt.backlog == NGX_ERROR || lsopt.backlog == 0) { |
523 | 4056 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4057 "invalid backlog \"%V\"", &value[n]); | |
4058 return NGX_CONF_ERROR; | |
4059 } | |
4060 | |
4061 continue; | |
4062 } | |
4063 | |
563 | 4064 if (ngx_strncmp(value[n].data, "rcvbuf=", 7) == 0) { |
4065 size.len = value[n].len - 7; | |
4066 size.data = value[n].data + 7; | |
4067 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4068 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
|
4069 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4070 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4071 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4072 if (lsopt.rcvbuf == NGX_ERROR) { |
563 | 4073 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4074 "invalid rcvbuf \"%V\"", &value[n]); | |
4075 return NGX_CONF_ERROR; | |
4076 } | |
4077 | |
4078 continue; | |
4079 } | |
4080 | |
4081 if (ngx_strncmp(value[n].data, "sndbuf=", 7) == 0) { | |
4082 size.len = value[n].len - 7; | |
4083 size.data = value[n].data + 7; | |
4084 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4085 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
|
4086 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4087 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4088 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4089 if (lsopt.sndbuf == NGX_ERROR) { |
563 | 4090 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4091 "invalid sndbuf \"%V\"", &value[n]); | |
4092 return NGX_CONF_ERROR; | |
4093 } | |
4094 | |
4095 continue; | |
4096 } | |
4097 | |
4098 if (ngx_strncmp(value[n].data, "accept_filter=", 14) == 0) { | |
523 | 4099 #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
|
4100 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
|
4101 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4102 lsopt.bind = 1; |
523 | 4103 #else |
4104 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4105 "accept filters \"%V\" are not supported " | |
4106 "on this platform, ignored", | |
4107 &value[n]); | |
4108 #endif | |
4109 continue; | |
4110 } | |
4111 | |
4112 if (ngx_strcmp(value[n].data, "deferred") == 0) { | |
4113 #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
|
4114 lsopt.deferred_accept = 1; |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4115 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4116 lsopt.bind = 1; |
523 | 4117 #else |
4118 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4119 "the deferred accept is not supported " | |
4120 "on this platform, ignored"); | |
4121 #endif | |
4122 continue; | |
4123 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4124 |
2562 | 4125 if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) { |
4126 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4127 if (ngx_strcmp(&value[n].data[10], "n") == 0) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4128 lsopt.ipv6only = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4129 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4130 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4131 lsopt.ipv6only = 0; |
2562 | 4132 |
4133 } else { | |
4134 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4135 "invalid ipv6only flags \"%s\"", |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4136 &value[n].data[9]); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4137 return NGX_CONF_ERROR; |
2562 | 4138 } |
4139 | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4140 lsopt.set = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4141 lsopt.bind = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4142 |
2562 | 4143 continue; |
4144 #else | |
4145 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4146 "ipv6only is not supported " |
2562 | 4147 "on this platform"); |
4148 return NGX_CONF_ERROR; | |
4149 #endif | |
4150 } | |
4151 | |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4152 if (ngx_strcmp(value[n].data, "reuseport") == 0) { |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4153 #if (NGX_HAVE_REUSEPORT) |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4154 lsopt.reuseport = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4155 lsopt.set = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4156 lsopt.bind = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4157 #else |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4158 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4159 "reuseport is not supported " |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4160 "on this platform, ignored"); |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4161 #endif |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4162 continue; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4163 } |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4164 |
2224 | 4165 if (ngx_strcmp(value[n].data, "ssl") == 0) { |
4166 #if (NGX_HTTP_SSL) | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4167 lsopt.ssl = 1; |
2224 | 4168 continue; |
4169 #else | |
4170 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4171 "the \"ssl\" parameter requires " | |
4172 "ngx_http_ssl_module"); | |
4173 return NGX_CONF_ERROR; | |
4174 #endif | |
4175 } | |
4176 | |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4177 if (ngx_strcmp(value[n].data, "http2") == 0) { |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4178 #if (NGX_HTTP_V2) |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4179 lsopt.http2 = 1; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4180 continue; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4181 #else |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4182 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4183 "the \"http2\" parameter requires " |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4184 "ngx_http_v2_module"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4185 return NGX_CONF_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4186 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4187 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4188 |
4323
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4189 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
|
4190 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4191 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
|
4192 lsopt.so_keepalive = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4193 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4194 } 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
|
4195 lsopt.so_keepalive = 2; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4196 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4197 } else { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4198 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4199 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4200 u_char *p, *end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4201 ngx_str_t s; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4202 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4203 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
|
4204 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
|
4205 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4206 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
|
4207 if (p == NULL) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4208 p = end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4209 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4210 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4211 if (p > s.data) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4212 s.len = p - s.data; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4213 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4214 lsopt.tcp_keepidle = ngx_parse_time(&s, 1); |
4474 | 4215 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
|
4216 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4217 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4218 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4219 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4220 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
|
4221 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4222 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
|
4223 if (p == NULL) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4224 p = end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4225 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4226 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4227 if (p > s.data) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4228 s.len = p - s.data; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4229 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4230 lsopt.tcp_keepintvl = ngx_parse_time(&s, 1); |
4474 | 4231 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
|
4232 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4233 } |
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 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4236 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
|
4237 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4238 if (s.data < end) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4239 s.len = end - s.data; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4240 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4241 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
|
4242 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
|
4243 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4244 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4245 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4246 |
4522 | 4247 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
|
4248 && lsopt.tcp_keepcnt == 0) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4249 { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4250 goto invalid_so_keepalive; |
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 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4253 lsopt.so_keepalive = 1; |
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 #else |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4256 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4257 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
|
4258 "the \"so_keepalive\" parameter accepts " |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4259 "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
|
4260 return NGX_CONF_ERROR; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4261 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4262 #endif |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4263 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4264 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4265 lsopt.set = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4266 lsopt.bind = 1; |
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 continue; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4269 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4270 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4271 invalid_so_keepalive: |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4272 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4273 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
|
4274 "invalid so_keepalive value: \"%s\"", |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4275 &value[n].data[13]); |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4276 return NGX_CONF_ERROR; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4277 #endif |
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 |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4280 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
|
4281 lsopt.proxy_protocol = 1; |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4282 continue; |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4283 } |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4284 |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
4285 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4286 "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
|
4287 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
|
4288 } |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
4289 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4290 for (n = 0; n < u.naddrs; n++) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4291 lsopt.sockaddr = u.addrs[n].sockaddr; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4292 lsopt.socklen = u.addrs[n].socklen; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4293 lsopt.addr_text = u.addrs[n].name; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4294 lsopt.wildcard = ngx_inet_wildcard(lsopt.sockaddr); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4295 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4296 if (ngx_http_add_listen(cf, cscf, &lsopt) != NGX_OK) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4297 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4298 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4299 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4300 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4301 return NGX_CONF_OK; |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
4302 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4303 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4304 |
487 | 4305 static char * |
4306 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
|
4307 { |
593 | 4308 ngx_http_core_srv_conf_t *cscf = conf; |
4309 | |
4310 u_char ch; | |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
4311 ngx_str_t *value; |
593 | 4312 ngx_uint_t i; |
4313 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
|
4314 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4315 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
|
4316 |
593 | 4317 for (i = 1; i < cf->args->nelts; i++) { |
4318 | |
4319 ch = value[i].data[0]; | |
4320 | |
2195 | 4321 if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.')) |
593 | 4322 || (ch == '.' && value[i].len < 2)) |
4323 { | |
4324 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4325 "server name \"%V\" is invalid", &value[i]); | |
4326 return NGX_CONF_ERROR; | |
4327 } | |
4328 | |
1157 | 4329 if (ngx_strchr(value[i].data, '/')) { |
4330 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4331 "server name \"%V\" has suspicious symbols", |
1157 | 4332 &value[i]); |
4333 } | |
4334 | |
593 | 4335 sn = ngx_array_push(&cscf->server_names); |
501 | 4336 if (sn == NULL) { |
455 | 4337 return NGX_CONF_ERROR; |
4338 } | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4339 |
1387 | 4340 #if (NGX_PCRE) |
4341 sn->regex = NULL; | |
4342 #endif | |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
4343 sn->server = cscf; |
3855 | 4344 |
4345 if (ngx_strcasecmp(value[i].data, (u_char *) "$hostname") == 0) { | |
4346 sn->name = cf->cycle->hostname; | |
4347 | |
4348 } else { | |
4349 sn->name = value[i]; | |
4350 } | |
1387 | 4351 |
4352 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
|
4353 ngx_strlow(sn->name.data, sn->name.data, sn->name.len); |
1387 | 4354 continue; |
4355 } | |
4356 | |
4357 #if (NGX_PCRE) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
4358 { |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4359 u_char *p; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4360 ngx_regex_compile_t rc; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4361 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
|
4362 |
3122
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
4363 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
|
4364 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
|
4365 "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
|
4366 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
|
4367 } |
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
4368 |
1387 | 4369 value[i].len--; |
4370 value[i].data++; | |
4371 | |
3325 | 4372 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
4373 | |
4374 rc.pattern = value[i]; | |
4375 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
4376 rc.err.data = errstr; | |
4377 | |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4378 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
|
4379 if (*p >= 'A' && *p <= 'Z') { |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4380 rc.options = NGX_REGEX_CASELESS; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4381 break; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4382 } |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4383 } |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4384 |
3325 | 4385 sn->regex = ngx_http_regex_compile(cf, &rc); |
1387 | 4386 if (sn->regex == NULL) { |
4387 return NGX_CONF_ERROR; | |
4388 } | |
4389 | |
1781 | 4390 sn->name = value[i]; |
3325 | 4391 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
|
4392 } |
1387 | 4393 #else |
4394 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4395 "using regex \"%V\" " |
1387 | 4396 "requires PCRE library", &value[i]); |
4397 | |
4398 return NGX_CONF_ERROR; | |
4399 #endif | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4400 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4401 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4402 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
|
4403 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4404 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4405 |
487 | 4406 static char * |
4407 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
|
4408 { |
3318 | 4409 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
|
4410 |
595 | 4411 ngx_str_t *value; |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4412 ngx_int_t alias; |
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4413 ngx_uint_t n; |
595 | 4414 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
|
4415 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4416 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
|
4417 |
3318 | 4418 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
|
4419 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4420 if ((clcf->alias != 0) == alias) { |
6941
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4421 return "is duplicate"; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4422 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4423 |
6941
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4424 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4425 "\"%V\" directive is duplicate, " |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4426 "\"%s\" directive was specified earlier", |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4427 &cmd->name, clcf->alias ? "alias" : "root"); |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4428 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4429 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
|
4430 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4431 |
3318 | 4432 if (clcf->named && alias) { |
1353 | 4433 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4434 "the \"alias\" directive cannot be used " |
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4435 "inside the named location"); |
1353 | 4436 |
4437 return NGX_CONF_ERROR; | |
4438 } | |
4439 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4440 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
|
4441 |
1156 | 4442 if (ngx_strstr(value[1].data, "$document_root") |
4443 || 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
|
4444 { |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4445 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4446 "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
|
4447 "in the \"%V\" directive", |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4448 &cmd->name); |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4449 |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4450 return NGX_CONF_ERROR; |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4451 } |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4452 |
2263
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4453 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
|
4454 || 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
|
4455 { |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4456 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4457 "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
|
4458 "in the \"%V\" directive", |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4459 &cmd->name); |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4460 |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4461 return NGX_CONF_ERROR; |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4462 } |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4463 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4464 clcf->alias = alias ? clcf->name.len : 0; |
3318 | 4465 clcf->root = value[1]; |
4466 | |
6262
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4467 if (!alias && clcf->root.len > 0 |
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4468 && clcf->root.data[clcf->root.len - 1] == '/') |
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4469 { |
3318 | 4470 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
|
4471 } |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
4472 |
3318 | 4473 if (clcf->root.data[0] != '$') { |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
4474 if (ngx_conf_full_name(cf->cycle, &clcf->root, 0) != NGX_OK) { |
667 | 4475 return NGX_CONF_ERROR; |
4476 } | |
603 | 4477 } |
4478 | |
3318 | 4479 n = ngx_http_script_variables_count(&clcf->root); |
595 | 4480 |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4481 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
|
4482 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
|
4483 |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4484 #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
|
4485 if (alias && clcf->regex) { |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
4486 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
|
4487 n = 1; |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4488 } |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4489 #endif |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4490 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4491 if (n) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4492 sc.cf = cf; |
3318 | 4493 sc.source = &clcf->root; |
4494 sc.lengths = &clcf->root_lengths; | |
4495 sc.values = &clcf->root_values; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4496 sc.complete_lengths = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4497 sc.complete_values = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4498 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4499 if (ngx_http_script_compile(&sc) != NGX_OK) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4500 return NGX_CONF_ERROR; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4501 } |
595 | 4502 } |
4503 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4504 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
|
4505 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4506 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4507 |
631 | 4508 static ngx_http_method_name_t ngx_methods_names[] = { |
6474 | 4509 { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, |
4510 { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, | |
4511 { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, | |
4512 { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, | |
4513 { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, | |
4514 { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, | |
4515 { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, | |
4516 { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, | |
4517 { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, | |
4518 { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND }, | |
4519 { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, | |
4520 { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, | |
4521 { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, | |
4522 { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH }, | |
4523 { NULL, 0 } | |
631 | 4524 }; |
4525 | |
4526 | |
4527 static char * | |
4528 ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4529 { | |
2027 | 4530 ngx_http_core_loc_conf_t *pclcf = conf; |
631 | 4531 |
4532 char *rv; | |
4533 void *mconf; | |
4534 ngx_str_t *value; | |
4535 ngx_uint_t i; | |
4536 ngx_conf_t save; | |
4537 ngx_http_module_t *module; | |
4538 ngx_http_conf_ctx_t *ctx, *pctx; | |
4539 ngx_http_method_name_t *name; | |
2027 | 4540 ngx_http_core_loc_conf_t *clcf; |
4541 | |
4542 if (pclcf->limit_except) { | |
6940
39ff6939266e
Unified error messages about duplicate directives.
Ruslan Ermilov <ru@nginx.com>
parents:
6920
diff
changeset
|
4543 return "is duplicate"; |
631 | 4544 } |
4545 | |
2027 | 4546 pclcf->limit_except = 0xffffffff; |
631 | 4547 |
4548 value = cf->args->elts; | |
4549 | |
4550 for (i = 1; i < cf->args->nelts; i++) { | |
4551 for (name = ngx_methods_names; name->name; name++) { | |
4552 | |
4553 if (ngx_strcasecmp(value[i].data, name->name) == 0) { | |
2027 | 4554 pclcf->limit_except &= name->method; |
631 | 4555 goto next; |
4556 } | |
4557 } | |
4558 | |
4559 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4560 "invalid method \"%V\"", &value[i]); | |
4561 return NGX_CONF_ERROR; | |
4562 | |
4563 next: | |
4564 continue; | |
4565 } | |
4566 | |
2027 | 4567 if (!(pclcf->limit_except & NGX_HTTP_GET)) { |
4568 pclcf->limit_except &= (uint32_t) ~NGX_HTTP_HEAD; | |
631 | 4569 } |
4570 | |
4571 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); | |
4572 if (ctx == NULL) { | |
4573 return NGX_CONF_ERROR; | |
4574 } | |
4575 | |
4576 pctx = cf->ctx; | |
4577 ctx->main_conf = pctx->main_conf; | |
4578 ctx->srv_conf = pctx->srv_conf; | |
4579 | |
4580 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | |
4581 if (ctx->loc_conf == NULL) { | |
4582 return NGX_CONF_ERROR; | |
4583 } | |
4584 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4585 for (i = 0; cf->cycle->modules[i]; i++) { |
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4586 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) { |
631 | 4587 continue; |
4588 } | |
4589 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4590 module = cf->cycle->modules[i]->ctx; |
631 | 4591 |
4592 if (module->create_loc_conf) { | |
4593 | |
4594 mconf = module->create_loc_conf(cf); | |
4595 if (mconf == NULL) { | |
6474 | 4596 return NGX_CONF_ERROR; |
631 | 4597 } |
4598 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4599 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; |
631 | 4600 } |
4601 } | |
4602 | |
4603 | |
2027 | 4604 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |
4605 pclcf->limit_except_loc_conf = ctx->loc_conf; | |
4606 clcf->loc_conf = ctx->loc_conf; | |
4607 clcf->name = pclcf->name; | |
4608 clcf->noname = 1; | |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3721
diff
changeset
|
4609 clcf->lmt_excpt = 1; |
2027 | 4610 |
4611 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { | |
631 | 4612 return NGX_CONF_ERROR; |
4613 } | |
4614 | |
4615 save = *cf; | |
4616 cf->ctx = ctx; | |
4617 cf->cmd_type = NGX_HTTP_LMT_CONF; | |
4618 | |
4619 rv = ngx_conf_parse(cf, NULL); | |
4620 | |
4621 *cf = save; | |
4622 | |
4623 return rv; | |
4624 } | |
4625 | |
4626 | |
487 | 4627 static char * |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4628 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
|
4629 { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4630 ngx_http_core_loc_conf_t *clcf = conf; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4631 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4632 ngx_str_t *value; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4633 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4634 if (clcf->aio != NGX_CONF_UNSET) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4635 return "is duplicate"; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4636 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4637 |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4638 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4639 clcf->thread_pool = NULL; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4640 clcf->thread_pool_value = NULL; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4641 #endif |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4642 |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4643 value = cf->args->elts; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4644 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4645 if (ngx_strcmp(value[1].data, "off") == 0) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4646 clcf->aio = NGX_HTTP_AIO_OFF; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4647 return NGX_CONF_OK; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4648 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4649 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4650 if (ngx_strcmp(value[1].data, "on") == 0) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4651 #if (NGX_HAVE_FILE_AIO) |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4652 clcf->aio = NGX_HTTP_AIO_ON; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4653 return NGX_CONF_OK; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4654 #else |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4655 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
|
4656 "\"aio on\" " |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4657 "is unsupported on this platform"); |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4658 return NGX_CONF_ERROR; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4659 #endif |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4660 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4661 |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4662 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
|
4663 && (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
|
4664 { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4665 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4666 ngx_str_t name; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4667 ngx_thread_pool_t *tp; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4668 ngx_http_complex_value_t cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4669 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
|
4670 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4671 clcf->aio = NGX_HTTP_AIO_THREADS; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4672 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4673 if (value[1].len >= 8) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4674 name.len = value[1].len - 8; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4675 name.data = value[1].data + 8; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4676 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4677 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
|
4678 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4679 ccv.cf = cf; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4680 ccv.value = &name; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4681 ccv.complex_value = &cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4682 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4683 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
|
4684 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4685 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4686 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4687 if (cv.lengths != NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4688 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
|
4689 sizeof(ngx_http_complex_value_t)); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4690 if (clcf->thread_pool_value == NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4691 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4692 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4693 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4694 *clcf->thread_pool_value = cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4695 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4696 return NGX_CONF_OK; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4697 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4698 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4699 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
|
4700 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4701 } else { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4702 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
|
4703 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4704 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4705 if (tp == NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4706 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4707 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4708 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4709 clcf->thread_pool = tp; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4710 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4711 return NGX_CONF_OK; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4712 #else |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4713 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
|
4714 "\"aio threads\" " |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4715 "is unsupported on this platform"); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4716 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4717 #endif |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4718 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4719 |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4720 return "invalid value"; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4721 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4722 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4723 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4724 static char * |
2129 | 4725 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4726 { | |
4727 ngx_http_core_loc_conf_t *clcf = conf; | |
4728 | |
4729 ngx_str_t *value; | |
4730 | |
4731 if (clcf->directio != NGX_CONF_UNSET) { | |
4732 return "is duplicate"; | |
4733 } | |
4734 | |
4735 value = cf->args->elts; | |
4736 | |
4737 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2277 | 4738 clcf->directio = NGX_OPEN_FILE_DIRECTIO_OFF; |
2129 | 4739 return NGX_CONF_OK; |
4740 } | |
4741 | |
4742 clcf->directio = ngx_parse_offset(&value[1]); | |
4743 if (clcf->directio == (off_t) NGX_ERROR) { | |
4744 return "invalid value"; | |
4745 } | |
4746 | |
4747 return NGX_CONF_OK; | |
4748 } | |
4749 | |
4750 | |
4751 static char * | |
487 | 4752 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
|
4753 { |
3318 | 4754 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
|
4755 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4756 u_char *p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4757 ngx_int_t overwrite; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4758 ngx_str_t *value, uri, args; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4759 ngx_uint_t i, n; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4760 ngx_http_err_page_t *err; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4761 ngx_http_complex_value_t cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4762 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
|
4763 |
3318 | 4764 if (clcf->error_pages == NULL) { |
4765 clcf->error_pages = ngx_array_create(cf->pool, 4, | |
4766 sizeof(ngx_http_err_page_t)); | |
4767 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
|
4768 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
|
4769 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4770 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4771 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4772 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
|
4773 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4774 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
|
4775 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4776 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
|
4777 if (i == 1) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4778 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4779 "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
|
4780 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
|
4781 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4782 |
555 | 4783 if (value[i].len > 1) { |
4784 overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1); | |
4785 | |
4786 if (overwrite == NGX_ERROR) { | |
4787 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4788 "invalid value \"%V\"", &value[i]); | |
4789 return NGX_CONF_ERROR; | |
4790 } | |
4791 | |
4792 } else { | |
4793 overwrite = 0; | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4794 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4795 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4796 n = 2; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4797 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4798 } else { |
555 | 4799 overwrite = -1; |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4800 n = 1; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4801 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4802 |
673 | 4803 uri = value[cf->args->nelts - 1]; |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4804 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4805 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
|
4806 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4807 ccv.cf = cf; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4808 ccv.value = &uri; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4809 ccv.complex_value = &cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4810 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4811 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
|
4812 return NGX_CONF_ERROR; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4813 } |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4814 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
4815 ngx_str_null(&args); |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4816 |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4930
diff
changeset
|
4817 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
|
4818 p = (u_char *) ngx_strchr(uri.data, '?'); |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4819 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4820 if (p) { |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4821 cv.value.len = p - uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4822 cv.value.data = uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4823 p++; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4824 args.len = (uri.data + uri.len) - p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4825 args.data = p; |
673 | 4826 } |
4827 } | |
4828 | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4829 for (i = 1; i < cf->args->nelts - n; i++) { |
3318 | 4830 err = ngx_array_push(clcf->error_pages); |
501 | 4831 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
|
4832 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
|
4833 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4834 |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
4835 err->status = ngx_atoi(value[i].data, value[i].len); |
487 | 4836 |
715 | 4837 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
|
4838 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4839 "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
|
4840 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
|
4841 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4842 |
3401
9e7926763f87
allow to handle 301/302 in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3395
diff
changeset
|
4843 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
|
4844 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
|
4845 "value \"%V\" must be between 300 and 599", |
461 | 4846 &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
|
4847 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
|
4848 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4849 |
3781
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4850 err->overwrite = overwrite; |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4851 |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4852 if (overwrite == -1) { |
1923
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4853 switch (err->status) { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4854 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
|
4855 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
|
4856 case NGX_HTTPS_NO_CERT: |
7630
f001d9384293
Added default overwrite in error_page 494.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7624
diff
changeset
|
4857 case NGX_HTTP_REQUEST_HEADER_TOO_LARGE: |
1923
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4858 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
|
4859 } |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4860 } |
555 | 4861 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4862 err->value = cv; |
2591 | 4863 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
|
4864 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4865 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4866 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
|
4867 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4868 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4869 |
487 | 4870 static char * |
1454 | 4871 ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4872 { | |
3318 | 4873 ngx_http_core_loc_conf_t *clcf = conf; |
1454 | 4874 |
4875 time_t inactive; | |
4876 ngx_str_t *value, s; | |
4877 ngx_int_t max; | |
4878 ngx_uint_t i; | |
4879 | |
3318 | 4880 if (clcf->open_file_cache != NGX_CONF_UNSET_PTR) { |
1454 | 4881 return "is duplicate"; |
4882 } | |
4883 | |
4884 value = cf->args->elts; | |
4885 | |
4886 max = 0; | |
4887 inactive = 60; | |
4888 | |
4889 for (i = 1; i < cf->args->nelts; i++) { | |
4890 | |
4891 if (ngx_strncmp(value[i].data, "max=", 4) == 0) { | |
4892 | |
4893 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
|
4894 if (max <= 0) { |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4895 goto failed; |
1454 | 4896 } |
4897 | |
4898 continue; | |
4899 } | |
4900 | |
4901 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) { | |
4902 | |
4903 s.len = value[i].len - 9; | |
4904 s.data = value[i].data + 9; | |
4905 | |
4906 inactive = ngx_parse_time(&s, 1); | |
4474 | 4907 if (inactive == (time_t) NGX_ERROR) { |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4908 goto failed; |
1454 | 4909 } |
4910 | |
4911 continue; | |
4912 } | |
4913 | |
4914 if (ngx_strcmp(value[i].data, "off") == 0) { | |
4915 | |
3318 | 4916 clcf->open_file_cache = NULL; |
1454 | 4917 |
4918 continue; | |
4919 } | |
4920 | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4921 failed: |
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4922 |
1454 | 4923 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4924 "invalid \"open_file_cache\" parameter \"%V\"", | |
4925 &value[i]); | |
4926 return NGX_CONF_ERROR; | |
4927 } | |
4928 | |
3318 | 4929 if (clcf->open_file_cache == NULL) { |
1454 | 4930 return NGX_CONF_OK; |
4931 } | |
4932 | |
4933 if (max == 0) { | |
4934 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4522 | 4935 "\"open_file_cache\" must have the \"max\" parameter"); |
1454 | 4936 return NGX_CONF_ERROR; |
4937 } | |
4938 | |
3318 | 4939 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); |
4940 if (clcf->open_file_cache) { | |
1454 | 4941 return NGX_CONF_OK; |
4942 } | |
4943 | |
4944 return NGX_CONF_ERROR; | |
4945 } | |
4946 | |
4947 | |
4948 static char * | |
509 | 4949 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4950 { | |
3318 | 4951 ngx_http_core_loc_conf_t *clcf = conf; |
509 | 4952 |
5254
7ecaa9e4bf1b
Core: support several "error_log" directives.
Vladimir Homutov <vl@nginx.com>
parents:
5240
diff
changeset
|
4953 return ngx_log_set_log(cf, &clcf->error_log); |
509 | 4954 } |
4955 | |
4956 | |
4957 static char * | |
487 | 4958 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
|
4959 { |
3318 | 4960 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
|
4961 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4962 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
|
4963 |
3318 | 4964 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
|
4965 return "is duplicate"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4966 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4967 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4968 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
|
4969 |
3318 | 4970 clcf->keepalive_timeout = ngx_parse_time(&value[1], 0); |
4971 | |
4972 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
|
4973 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4974 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4975 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4976 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
|
4977 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
|
4978 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4979 |
3318 | 4980 clcf->keepalive_header = ngx_parse_time(&value[2], 1); |
4981 | |
4474 | 4982 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
|
4983 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4984 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4985 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4986 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
|
4987 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4988 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
4989 |
487 | 4990 static char * |
509 | 4991 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
|
4992 { |
3318 | 4993 ngx_http_core_loc_conf_t *clcf = conf; |
4994 | |
4995 if (clcf->internal != NGX_CONF_UNSET) { | |
509 | 4996 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
|
4997 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4998 |
3318 | 4999 clcf->internal = 1; |
509 | 5000 |
5001 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
|
5002 } |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5003 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5004 |
487 | 5005 static char * |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5006 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
|
5007 { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5008 ngx_http_core_loc_conf_t *clcf = conf; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5009 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5010 ngx_str_t *value; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5011 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
5012 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
|
5013 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
|
5014 } |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
5015 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5016 value = cf->args->elts; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5017 |
4225
016352c19049
Support of several servers in the "resolver" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4210
diff
changeset
|
5018 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
|
5019 if (clcf->resolver == NULL) { |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5020 return NGX_CONF_ERROR; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5021 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5022 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5023 return NGX_CONF_OK; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5024 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5025 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5026 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5027 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5028 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5029 static char * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5030 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
|
5031 { |
2205 | 5032 ngx_http_core_loc_conf_t *clcf = conf; |
5033 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5034 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5035 |
3325 | 5036 ngx_str_t *value; |
5037 ngx_uint_t i; | |
5038 ngx_regex_elt_t *re; | |
5039 ngx_regex_compile_t rc; | |
5040 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
|
5041 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5042 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
|
5043 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
|
5044 sizeof(ngx_regex_elt_t)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5045 if (clcf->gzip_disable == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5046 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5047 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5048 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5049 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5050 value = cf->args->elts; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5051 |
3325 | 5052 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
5053 | |
5054 rc.pool = cf->pool; | |
5055 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
5056 rc.err.data = errstr; | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5057 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5058 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
|
5059 |
3754
5f58badd13ed
gzip_disable msie6 ignored other patterns
Igor Sysoev <igor@sysoev.ru>
parents:
3753
diff
changeset
|
5060 if (ngx_strcmp(value[i].data, "msie6") == 0) { |
2205 | 5061 clcf->gzip_disable_msie6 = 1; |
5062 continue; | |
5063 } | |
5064 | |
3773 | 5065 #if (NGX_HTTP_DEGRADATION) |
5066 | |
5067 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
5068 clcf->gzip_disable_degradation = 1; | |
5069 continue; | |
5070 } | |
5071 | |
5072 #endif | |
5073 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5074 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
|
5075 if (re == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5076 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5077 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5078 |
3753
9da3a04fc845
gzip_disable compiled always the first pattern only
Igor Sysoev <igor@sysoev.ru>
parents:
3752
diff
changeset
|
5079 rc.pattern = value[i]; |
3325 | 5080 rc.options = NGX_REGEX_CASELESS; |
5081 | |
5082 if (ngx_regex_compile(&rc) != NGX_OK) { | |
5083 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
|
5084 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5085 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5086 |
3325 | 5087 re->regex = rc.regex; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5088 re->name = value[i].data; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5089 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5090 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5091 return NGX_CONF_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5092 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5093 #else |
3773 | 5094 ngx_str_t *value; |
5095 ngx_uint_t i; | |
2205 | 5096 |
5097 value = cf->args->elts; | |
5098 | |
3773 | 5099 for (i = 1; i < cf->args->nelts; i++) { |
5100 if (ngx_strcmp(value[i].data, "msie6") == 0) { | |
5101 clcf->gzip_disable_msie6 = 1; | |
5102 continue; | |
5103 } | |
5104 | |
5105 #if (NGX_HTTP_DEGRADATION) | |
5106 | |
5107 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
5108 clcf->gzip_disable_degradation = 1; | |
5109 continue; | |
5110 } | |
5111 | |
5112 #endif | |
5113 | |
5114 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5115 "without PCRE library \"gzip_disable\" supports " | |
5116 "builtin \"msie6\" and \"degradation\" mask only"); | |
5117 | |
5118 return NGX_CONF_ERROR; | |
2205 | 5119 } |
5120 | |
3773 | 5121 return NGX_CONF_OK; |
5122 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5123 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5124 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5125 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5126 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5127 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5128 |
4495
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5129 #if (NGX_HAVE_OPENAT) |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5130 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5131 static char * |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5132 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
|
5133 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5134 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
|
5135 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5136 ngx_str_t *value; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5137 ngx_uint_t i; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5138 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
|
5139 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5140 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
|
5141 return "is duplicate"; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5142 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5143 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5144 value = cf->args->elts; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5145 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5146 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
|
5147 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5148 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
|
5149 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
|
5150 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5151 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5152 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5153 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
|
5154 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
|
5155 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5156 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5157 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5158 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
|
5159 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
|
5160 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5161 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5162 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5163 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
|
5164 value[i].len -= 5; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5165 value[i].data += 5; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5166 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5167 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
|
5168 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5169 ccv.cf = cf; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5170 ccv.value = &value[i]; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5171 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
|
5172 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
|
5173 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
|
5174 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5175 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5176 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5177 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
|
5178 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5179 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5180 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5181 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
|
5182 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5183 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5184 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5185 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5186 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
|
5187 "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
|
5188 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5189 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5190 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5191 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
|
5192 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
|
5193 "\"%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
|
5194 "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
|
5195 &cmd->name); |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5196 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5197 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5198 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5199 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
|
5200 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
|
5201 return NGX_CONF_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5202 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5203 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5204 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
|
5205 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
|
5206 "duplicate parameters \"%V %V\"", |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5207 &value[1], &value[2]); |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5208 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5209 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5210 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5211 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
|
5212 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
|
5213 "\"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
|
5214 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5215 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5216 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5217 return NGX_CONF_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5218 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5219 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5220 #endif |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5221 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5222 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5223 static char * |
487 | 5224 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
|
5225 { |
473 | 5226 #if (NGX_FREEBSD) |
452 | 5227 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
|
5228 |
673 | 5229 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
|
5230 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
|
5231 "\"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
|
5232 "(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
|
5233 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
|
5234 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5235 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
|
5236 } |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5237 |
469 | 5238 #elif !(NGX_HAVE_SO_SNDLOWAT) |
473 | 5239 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
|
5240 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5241 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
|
5242 "\"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
|
5243 |
452 | 5244 *np = 0; |
5245 | |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5246 #endif |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5247 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5248 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
|
5249 } |
1200 | 5250 |
5251 | |
5252 static char * | |
5253 ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data) | |
5254 { | |
5255 size_t *sp = data; | |
5256 | |
5257 if (*sp < NGX_MIN_POOL_SIZE) { | |
5258 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3388 | 5259 "the pool size must be no less than %uz", |
5260 NGX_MIN_POOL_SIZE); | |
5261 return NGX_CONF_ERROR; | |
5262 } | |
5263 | |
5264 if (*sp % NGX_POOL_ALIGNMENT) { | |
5265 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5266 "the pool size must be a multiple of %uz", | |
5267 NGX_POOL_ALIGNMENT); | |
1200 | 5268 return NGX_CONF_ERROR; |
5269 } | |
5270 | |
5271 return NGX_CONF_OK; | |
5272 } |