Mercurial > hg > nginx
annotate src/http/ngx_http_core_module.c @ 9249:afd36b161859
Updated HTTP status code descriptions to match RFC 9110.
This patch changes the status codes and status pages served by
freenginx to use the wording from RFC 9110.
Exception for HTTP status code 413 "Request Entity Too Large",
which is "Content Too Large" in the RFC. In that case we would
lose information about what actually is too large, the request
or the response.
author | Michiel W. Beijen <mb@x14.nl> |
---|---|
date | Sun, 14 Apr 2024 12:23:40 +0200 |
parents | 73eb75bee30f |
children | a6649497a762 |
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; | |
8038
711737177b77
Multiple WWW-Authenticate headers with "satisfy any;".
Maxim Dounin <mdounin@mdounin.ru>
parents:
8031
diff
changeset
|
1091 ngx_table_elt_t *h; |
681 | 1092 ngx_http_core_loc_conf_t *clcf; |
1093 | |
1094 if (r != r->main) { | |
1095 r->phase_handler = ph->next; | |
1096 return NGX_AGAIN; | |
1097 } | |
1098 | |
1099 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1100 "access phase: %ui", r->phase_handler); | |
1101 | |
1102 rc = ph->handler(r); | |
1103 | |
1104 if (rc == NGX_DECLINED) { | |
1105 r->phase_handler++; | |
1106 return NGX_AGAIN; | |
1107 } | |
1108 | |
1109 if (rc == NGX_AGAIN || rc == NGX_DONE) { | |
1110 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
|
1111 } |
02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
1112 |
681 | 1113 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1114 | |
1806 | 1115 if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) { |
681 | 1116 |
1117 if (rc == NGX_OK) { | |
1118 r->phase_handler++; | |
1119 return NGX_AGAIN; | |
1120 } | |
1121 | |
1122 } else { | |
1123 if (rc == NGX_OK) { | |
1124 r->access_code = 0; | |
1125 | |
8038
711737177b77
Multiple WWW-Authenticate headers with "satisfy any;".
Maxim Dounin <mdounin@mdounin.ru>
parents:
8031
diff
changeset
|
1126 for (h = r->headers_out.www_authenticate; h; h = h->next) { |
711737177b77
Multiple WWW-Authenticate headers with "satisfy any;".
Maxim Dounin <mdounin@mdounin.ru>
parents:
8031
diff
changeset
|
1127 h->hash = 0; |
681 | 1128 } |
1129 | |
1130 r->phase_handler = ph->next; | |
1131 return NGX_AGAIN; | |
1132 } | |
1133 | |
1134 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
|
1135 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
|
1136 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
|
1137 } |
681 | 1138 |
1139 r->phase_handler++; | |
1140 return NGX_AGAIN; | |
1141 } | |
1142 } | |
1143 | |
1144 /* rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
1145 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1146 if (rc == NGX_HTTP_UNAUTHORIZED) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1147 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
|
1148 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1149 |
681 | 1150 ngx_http_finalize_request(r, rc); |
1151 return NGX_OK; | |
1152 } | |
1153 | |
1154 | |
1155 ngx_int_t | |
1156 ngx_http_core_post_access_phase(ngx_http_request_t *r, | |
1157 ngx_http_phase_handler_t *ph) | |
1158 { | |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1159 ngx_int_t access_code; |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1160 |
681 | 1161 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1162 "post access phase: %ui", r->phase_handler); | |
1163 | |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1164 access_code = r->access_code; |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1165 |
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1166 if (access_code) { |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1167 r->access_code = 0; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1168 |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1169 if (access_code == NGX_HTTP_FORBIDDEN) { |
681 | 1170 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1171 "access forbidden by rule"); | |
1172 } | |
1173 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1174 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
|
1175 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
|
1176 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1177 |
3886
901d9d93e71b
"satisfy any" disabled custom 401 error page
Igor Sysoev <igor@sysoev.ru>
parents:
3855
diff
changeset
|
1178 ngx_http_finalize_request(r, access_code); |
681 | 1179 return NGX_OK; |
1180 } | |
1181 | |
1182 r->phase_handler++; | |
1183 return NGX_AGAIN; | |
1184 } | |
1185 | |
1186 | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1187 static ngx_int_t |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1188 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
|
1189 { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1190 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
|
1191 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1192 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
|
1193 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1194 if (clcf->auth_delay == 0) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1195 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
|
1196 return NGX_OK; |
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 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1199 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
|
1200 "delaying unauthorized request"); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1201 |
7811
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1202 if (r->connection->read->ready) { |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1203 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
|
1204 |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1205 } else { |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1206 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
|
1207 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
1ebd78df4ce7
Fixed handling of already closed connections.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7770
diff
changeset
|
1208 } |
7638
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 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1211 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
|
1212 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
|
1213 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1214 r->connection->write->delayed = 1; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1215 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
|
1216 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1217 /* |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1218 * 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
|
1219 * to ensure constant-time processing |
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 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1222 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
|
1223 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1224 return NGX_OK; |
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 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1228 static void |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1229 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
|
1230 { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1231 ngx_event_t *wev; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1232 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1233 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
|
1234 "auth delay handler"); |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1235 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1236 wev = r->connection->write; |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1237 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1238 if (wev->delayed) { |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1239 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1240 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
|
1241 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
|
1242 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1243 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1244 return; |
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 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1247 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
|
1248 } |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1249 |
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
1250 |
681 | 1251 ngx_int_t |
1252 ngx_http_core_content_phase(ngx_http_request_t *r, | |
1253 ngx_http_phase_handler_t *ph) | |
1254 { | |
773 | 1255 size_t root; |
681 | 1256 ngx_int_t rc; |
1257 ngx_str_t path; | |
1258 | |
1259 if (r->content_handler) { | |
1260 r->write_event_handler = ngx_http_request_empty_handler; | |
1261 ngx_http_finalize_request(r, r->content_handler(r)); | |
1262 return NGX_OK; | |
1263 } | |
1264 | |
1265 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1266 "content phase: %ui", r->phase_handler); | |
1267 | |
1268 rc = ph->handler(r); | |
1269 | |
1270 if (rc != NGX_DECLINED) { | |
1271 ngx_http_finalize_request(r, rc); | |
1272 return NGX_OK; | |
1273 } | |
1274 | |
1275 /* rc == NGX_DECLINED */ | |
1276 | |
1277 ph++; | |
1278 | |
1279 if (ph->checker) { | |
1280 r->phase_handler++; | |
1281 return NGX_AGAIN; | |
1282 } | |
1283 | |
1284 /* no content handler was found */ | |
1285 | |
3527 | 1286 if (r->uri.data[r->uri.len - 1] == '/') { |
681 | 1287 |
773 | 1288 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { |
681 | 1289 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
|
1290 "directory index of \"%s\" is forbidden", path.data); |
681 | 1291 } |
1292 | |
1293 ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN); | |
1294 return NGX_OK; | |
1295 } | |
1296 | |
1297 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found"); | |
1298 | |
1299 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); | |
535 | 1300 return NGX_OK; |
1301 } | |
1302 | |
1303 | |
1304 void | |
1305 ngx_http_update_location_config(ngx_http_request_t *r) | |
1306 { | |
1307 ngx_http_core_loc_conf_t *clcf; | |
1308 | |
1309 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1310 | |
631 | 1311 if (r->method & clcf->limit_except) { |
1312 r->loc_conf = clcf->limit_except_loc_conf; | |
1313 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1314 } | |
1315 | |
643 | 1316 if (r == r->main) { |
6129
187aa751ad62
Core: the ngx_set_connection_log() macro.
Vladimir Homutov <vl@nginx.com>
parents:
6049
diff
changeset
|
1317 ngx_set_connection_log(r->connection, clcf->error_log); |
535 | 1318 } |
1319 | |
1320 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { | |
1321 r->connection->sendfile = 1; | |
1322 | |
1323 } else { | |
1324 r->connection->sendfile = 0; | |
1325 } | |
1326 | |
633 | 1327 if (clcf->client_body_in_file_only) { |
1328 r->request_body_in_file_only = 1; | |
1329 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
|
1330 r->request_body_in_clean_file = |
4d203f76b757
undo "client_body_in_file_only any"
Igor Sysoev <igor@sysoev.ru>
parents:
1073
diff
changeset
|
1331 clcf->client_body_in_file_only == NGX_HTTP_REQUEST_BODY_FILE_CLEAN; |
637 | 1332 r->request_body_file_log_level = NGX_LOG_NOTICE; |
1333 | |
1334 } else { | |
1335 r->request_body_file_log_level = NGX_LOG_WARN; | |
633 | 1336 } |
1337 | |
2845 | 1338 r->request_body_in_single_buf = clcf->client_body_in_single_buffer; |
1339 | |
2888 | 1340 if (r->keepalive) { |
1341 if (clcf->keepalive_timeout == 0) { | |
1342 r->keepalive = 0; | |
1343 | |
1344 } else if (r->connection->requests >= clcf->keepalive_requests) { | |
1345 r->keepalive = 0; | |
3793 | 1346 |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1347 } else if (ngx_current_msec - r->connection->start_time |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1348 > clcf->keepalive_time) |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1349 { |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1350 r->keepalive = 0; |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
1351 |
3793 | 1352 } else if (r->headers_in.msie6 |
1353 && r->method == NGX_HTTP_POST | |
1354 && (clcf->keepalive_disable | |
1355 & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) | |
1356 { | |
1357 /* | |
1358 * MSIE may wait for some time if an response for | |
1359 * a POST request was sent over a keepalive connection | |
1360 */ | |
1361 r->keepalive = 0; | |
1362 | |
1363 } else if (r->headers_in.safari | |
1364 && (clcf->keepalive_disable | |
1365 & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) | |
1366 { | |
1367 /* | |
1368 * Safari may send a POST request to a closed keepalive | |
1369 * connection and may stall for some time, see | |
1370 * https://bugs.webkit.org/show_bug.cgi?id=5760 | |
1371 */ | |
1372 r->keepalive = 0; | |
2888 | 1373 } |
535 | 1374 } |
1375 | |
1376 if (!clcf->tcp_nopush) { | |
1377 /* disable TCP_NOPUSH/TCP_CORK use */ | |
1378 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; | |
1379 } | |
1380 | |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
1381 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
|
1382 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
|
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 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
1386 |
2186
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1387 /* |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1388 * 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
|
1389 * NGX_DONE - auto redirect |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1390 * NGX_AGAIN - inclusive match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1391 * NGX_ERROR - regex error |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1392 * NGX_DECLINED - no match |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1393 */ |
ecce31d90117
*) regex match must return NGX_OK to stop regex searching,
Igor Sysoev <igor@sysoev.ru>
parents:
2185
diff
changeset
|
1394 |
487 | 1395 static ngx_int_t |
2027 | 1396 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
|
1397 { |
2027 | 1398 ngx_int_t rc; |
1399 ngx_http_core_loc_conf_t *pclcf; | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1400 #if (NGX_PCRE) |
3325 | 1401 ngx_int_t n; |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1402 ngx_uint_t noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1403 ngx_http_core_loc_conf_t *clcf, **clcfp; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1404 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1405 noregex = 0; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1406 #endif |
2027 | 1407 |
1408 pclcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1409 | |
1410 rc = ngx_http_core_find_static_location(r, pclcf->static_locations); | |
1411 | |
1412 if (rc == NGX_AGAIN) { | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1413 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1414 #if (NGX_PCRE) |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1415 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
|
1416 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1417 noregex = clcf->noregex; |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1418 #endif |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1419 |
2027 | 1420 /* look up nested locations */ |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1421 |
2027 | 1422 rc = ngx_http_core_find_location(r); |
1423 } | |
1424 | |
1425 if (rc == NGX_OK || rc == NGX_DONE) { | |
1426 return rc; | |
1427 } | |
1428 | |
1429 /* rc == NGX_DECLINED or rc == NGX_AGAIN in nested location */ | |
1430 | |
1431 #if (NGX_PCRE) | |
2185
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1432 |
e9420c1b6f25
fix noregex for inclusive locations
Igor Sysoev <igor@sysoev.ru>
parents:
2138
diff
changeset
|
1433 if (noregex == 0 && pclcf->regex_locations) { |
2027 | 1434 |
1435 for (clcfp = pclcf->regex_locations; *clcfp; clcfp++) { | |
1436 | |
1437 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1438 "test location: ~ \"%V\"", &(*clcfp)->name); | |
1439 | |
3325 | 1440 n = ngx_http_regex_exec(r, (*clcfp)->regex, &r->uri); |
1441 | |
1442 if (n == NGX_OK) { | |
1443 r->loc_conf = (*clcfp)->loc_conf; | |
1444 | |
1445 /* look up nested locations */ | |
1446 | |
1447 rc = ngx_http_core_find_location(r); | |
1448 | |
1449 return (rc == NGX_ERROR) ? rc : NGX_OK; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1450 } |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1451 |
3325 | 1452 if (n == NGX_DECLINED) { |
2027 | 1453 continue; |
1454 } | |
1455 | |
3325 | 1456 return NGX_ERROR; |
2027 | 1457 } |
1458 } | |
1386
3c6da0610f19
fix building by bcc without PCRE
Igor Sysoev <igor@sysoev.ru>
parents:
1377
diff
changeset
|
1459 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1460 |
2027 | 1461 return rc; |
1462 } | |
1463 | |
1464 | |
1465 /* | |
1466 * NGX_OK - exact match | |
1467 * NGX_DONE - auto redirect | |
1468 * NGX_AGAIN - inclusive match | |
1469 * NGX_DECLINED - no match | |
1470 */ | |
1471 | |
1472 static ngx_int_t | |
1473 ngx_http_core_find_static_location(ngx_http_request_t *r, | |
1474 ngx_http_location_tree_node_t *node) | |
1475 { | |
1476 u_char *uri; | |
1477 size_t len, n; | |
1478 ngx_int_t rc, rv; | |
1479 | |
1480 len = r->uri.len; | |
1481 uri = r->uri.data; | |
1482 | |
1483 rv = NGX_DECLINED; | |
1484 | |
1485 for ( ;; ) { | |
1486 | |
1487 if (node == NULL) { | |
1488 return rv; | |
485 | 1489 } |
1490 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1491 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
|
1492 "test location: \"%*s\"", |
3ef7bb882ad4
Fixed logging with variable field width.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6474
diff
changeset
|
1493 (size_t) node->len, node->name); |
2027 | 1494 |
1495 n = (len <= (size_t) node->len) ? len : node->len; | |
1496 | |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
2085
diff
changeset
|
1497 rc = ngx_filename_cmp(uri, node->name, n); |
2027 | 1498 |
1499 if (rc != 0) { | |
1500 node = (rc < 0) ? node->left : node->right; | |
1501 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1502 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1503 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1504 |
2027 | 1505 if (len > (size_t) node->len) { |
1506 | |
1507 if (node->inclusive) { | |
1508 | |
1509 r->loc_conf = node->inclusive->loc_conf; | |
1510 rv = NGX_AGAIN; | |
1511 | |
1512 node = node->tree; | |
1513 uri += n; | |
1514 len -= n; | |
485 | 1515 |
1516 continue; | |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1517 } |
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
1518 |
2027 | 1519 /* exact only */ |
1520 | |
1521 node = node->right; | |
1522 | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1523 continue; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1524 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1525 |
2027 | 1526 if (len == (size_t) node->len) { |
1527 | |
3636
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1528 if (node->exact) { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1529 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
|
1530 return NGX_OK; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1531 |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1532 } else { |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1533 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
|
1534 return NGX_AGAIN; |
446f611b0a79
Test regex location if URI matches exactly to non-exact location.
Igor Sysoev <igor@sysoev.ru>
parents:
3634
diff
changeset
|
1535 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1536 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1537 |
2027 | 1538 /* len < node->len */ |
1539 | |
1540 if (len + 1 == (size_t) node->len && node->auto_redirect) { | |
1541 | |
1542 r->loc_conf = (node->exact) ? node->exact->loc_conf: | |
1543 node->inclusive->loc_conf; | |
1544 rv = NGX_DONE; | |
1545 } | |
1546 | |
1547 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
|
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 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
1551 |
2138 | 1552 void * |
1553 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) | |
1554 { | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1555 u_char c, *lowcase; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1556 size_t len; |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1557 ngx_uint_t i, hash; |
2138 | 1558 |
3372
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1559 if (types_hash->size == 0) { |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1560 return (void *) 4; |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1561 } |
6b8e5c882e47
support "*" in gzip_types, ssi_types, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3368
diff
changeset
|
1562 |
2138 | 1563 if (r->headers_out.content_type.len == 0) { |
1564 return NULL; | |
1565 } | |
1566 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1567 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
|
1568 |
2138 | 1569 if (r->headers_out.content_type_lowcase == NULL) { |
1570 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1571 lowcase = ngx_pnalloc(r->pool, len); |
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1572 if (lowcase == NULL) { |
2138 | 1573 return NULL; |
1574 } | |
1575 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1576 r->headers_out.content_type_lowcase = lowcase; |
2138 | 1577 |
1578 hash = 0; | |
1579 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1580 for (i = 0; i < len; i++) { |
2138 | 1581 c = ngx_tolower(r->headers_out.content_type.data[i]); |
1582 hash = ngx_hash(hash, c); | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1583 lowcase[i] = c; |
2138 | 1584 } |
1585 | |
1586 r->headers_out.content_type_hash = hash; | |
1587 } | |
1588 | |
2881
13b63d682228
light optimization of ngx_http_test_content_type()
Igor Sysoev <igor@sysoev.ru>
parents:
2857
diff
changeset
|
1589 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
|
1590 r->headers_out.content_type_lowcase, len); |
2138 | 1591 } |
1592 | |
1593 | |
487 | 1594 ngx_int_t |
1595 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
|
1596 { |
2136 | 1597 u_char c, *exten; |
589 | 1598 ngx_str_t *type; |
649 | 1599 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
|
1600 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
|
1601 |
673 | 1602 if (r->headers_out.content_type.len) { |
1603 return NGX_OK; | |
1604 } | |
1605 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1606 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
|
1607 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1608 if (r->exten.len) { |
485 | 1609 |
649 | 1610 hash = 0; |
1611 | |
1612 for (i = 0; i < r->exten.len; i++) { | |
1613 c = r->exten.data[i]; | |
1614 | |
1615 if (c >= 'A' && c <= 'Z') { | |
1616 | |
2136 | 1617 exten = ngx_pnalloc(r->pool, r->exten.len); |
1618 if (exten == NULL) { | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
1619 return NGX_ERROR; |
485 | 1620 } |
1621 | |
2136 | 1622 hash = ngx_hash_strlow(exten, r->exten.data, r->exten.len); |
485 | 1623 |
1624 r->exten.data = exten; | |
649 | 1625 |
1626 break; | |
485 | 1627 } |
1628 | |
649 | 1629 hash = ngx_hash(hash, c); |
485 | 1630 } |
1631 | |
649 | 1632 type = ngx_hash_find(&clcf->types_hash, hash, |
589 | 1633 r->exten.data, r->exten.len); |
1634 | |
1635 if (type) { | |
657 | 1636 r->headers_out.content_type_len = type->len; |
589 | 1637 r->headers_out.content_type = *type; |
657 | 1638 |
589 | 1639 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
|
1640 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1641 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1642 |
657 | 1643 r->headers_out.content_type_len = clcf->default_type.len; |
589 | 1644 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
|
1645 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1646 return NGX_OK; |
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 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
1649 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1650 void |
487 | 1651 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
|
1652 { |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1653 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
|
1654 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
1655 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
|
1656 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1657 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
|
1658 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { |
649 | 1659 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1660 r->exten.len = r->uri.len - i - 1; |
649 | 1661 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
|
1662 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1663 return; |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1664 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1665 } 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
|
1666 return; |
216
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 } |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1669 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
1670 return; |
216
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 |
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
1673 |
487 | 1674 ngx_int_t |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1675 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
|
1676 { |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1677 ngx_table_elt_t *etag; |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1678 ngx_http_core_loc_conf_t *clcf; |
4780 | 1679 |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1680 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
4780 | 1681 |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1682 if (!clcf->etag) { |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1683 return NGX_OK; |
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
1684 } |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1685 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1686 etag = ngx_list_push(&r->headers_out.headers); |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1687 if (etag == NULL) { |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1688 return NGX_ERROR; |
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 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1691 etag->hash = 1; |
8031
d26db4f82d7d
All known output headers can be linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1692 etag->next = NULL; |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1693 ngx_str_set(&etag->key, "ETag"); |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1694 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1695 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
|
1696 if (etag->value.data == NULL) { |
5825
51fe42cc7876
Fixed ETag memory allocation error handling.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5757
diff
changeset
|
1697 etag->hash = 0; |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1698 return NGX_ERROR; |
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 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1701 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
|
1702 r->headers_out.last_modified_time, |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1703 r->headers_out.content_length_n) |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1704 - etag->value.data; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1705 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1706 r->headers_out.etag = etag; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1707 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1708 return NGX_OK; |
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 |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1711 |
5733
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1712 void |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1713 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
|
1714 { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1715 size_t len; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1716 u_char *p; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1717 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
|
1718 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1719 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
|
1720 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1721 if (etag == NULL) { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1722 return; |
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 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1725 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
|
1726 && 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
|
1727 && etag->value.data[1] == '/') |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1728 { |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1729 return; |
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 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1732 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
|
1733 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
|
1734 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
|
1735 return; |
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 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1738 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
|
1739 if (p == NULL) { |
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->hash = 0; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1741 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
|
1742 return; |
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 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1745 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
|
1746 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1747 etag->value.data = p; |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1748 etag->value.len = len; |
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 |
e491b26fa5a1
Entity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5715
diff
changeset
|
1751 |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4736
diff
changeset
|
1752 ngx_int_t |
3632 | 1753 ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, |
1754 ngx_str_t *ct, ngx_http_complex_value_t *cv) | |
1755 { | |
1756 ngx_int_t rc; | |
1757 ngx_str_t val; | |
1758 ngx_buf_t *b; | |
1759 ngx_chain_t out; | |
1760 | |
7563
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1761 rc = ngx_http_discard_request_body(r); |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1762 |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1763 if (rc != NGX_OK) { |
a7e8f953408e
Fixed "return" with discarding invalid chunked body.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7504
diff
changeset
|
1764 return rc; |
4148
18f1cb12c6d7
Fix for "return 202" not discarding body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
1765 } |
18f1cb12c6d7
Fix for "return 202" not discarding body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4133
diff
changeset
|
1766 |
3632 | 1767 r->headers_out.status = status; |
1768 | |
1769 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { | |
1770 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1771 } | |
1772 | |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1773 if (status == NGX_HTTP_MOVED_PERMANENTLY |
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1774 || status == NGX_HTTP_MOVED_TEMPORARILY |
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1775 || 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
|
1776 || 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
|
1777 || status == NGX_HTTP_PERMANENT_REDIRECT) |
4491
d11f86a16e3b
Added support for the 307 Temporary Redirect.
Ruslan Ermilov <ru@nginx.com>
parents:
4477
diff
changeset
|
1778 { |
4206
1a94a56a4e5d
Clear old Location header (if any) while adding a new one.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4204
diff
changeset
|
1779 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
|
1780 |
3632 | 1781 r->headers_out.location = ngx_list_push(&r->headers_out.headers); |
1782 if (r->headers_out.location == NULL) { | |
1783 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1784 } | |
1785 | |
1786 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
|
1787 r->headers_out.location->next = NULL; |
3632 | 1788 ngx_str_set(&r->headers_out.location->key, "Location"); |
1789 r->headers_out.location->value = val; | |
1790 | |
1791 return status; | |
1792 } | |
1793 | |
1794 r->headers_out.content_length_n = val.len; | |
1795 | |
1796 if (ct) { | |
1797 r->headers_out.content_type_len = ct->len; | |
1798 r->headers_out.content_type = *ct; | |
1799 | |
1800 } else { | |
1801 if (ngx_http_set_content_type(r) != NGX_OK) { | |
1802 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1803 } | |
1804 } | |
1805 | |
6973
99934aade555
Use ngx_calloc_buf() where appropriate.
Ruslan Ermilov <ru@nginx.com>
parents:
6948
diff
changeset
|
1806 b = ngx_calloc_buf(r->pool); |
3632 | 1807 if (b == NULL) { |
1808 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
1809 } | |
1810 | |
1811 b->pos = val.data; | |
1812 b->last = val.data + val.len; | |
1813 b->memory = val.len ? 1 : 0; | |
1814 b->last_buf = (r == r->main) ? 1 : 0; | |
1815 b->last_in_chain = 1; | |
8124
f5515e727656
Fixed "zero size buf" alerts with subrequests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8117
diff
changeset
|
1816 b->sync = (b->last_buf || b->memory) ? 0 : 1; |
3632 | 1817 |
1818 out.buf = b; | |
1819 out.next = NULL; | |
1820 | |
1821 rc = ngx_http_send_header(r); | |
1822 | |
1823 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { | |
1824 return rc; | |
1825 } | |
1826 | |
1827 return ngx_http_output_filter(r, &out); | |
1828 } | |
1829 | |
1830 | |
1831 ngx_int_t | |
557 | 1832 ngx_http_send_header(ngx_http_request_t *r) |
1833 { | |
5925
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1834 if (r->post_action) { |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1835 return NGX_OK; |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1836 } |
c76d851c5e7a
Fixed post_action to not trigger "header already sent" alert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5825
diff
changeset
|
1837 |
5334
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1838 if (r->header_sent) { |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1839 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
|
1840 "header already sent"); |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1841 return NGX_ERROR; |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1842 } |
03ff14058272
Added safety belt for the case of sending header twice.
Sergey Kandaurov <pluknet@nginx.com>
parents:
5330
diff
changeset
|
1843 |
557 | 1844 if (r->err_status) { |
1845 r->headers_out.status = r->err_status; | |
1846 r->headers_out.status_line.len = 0; | |
1847 } | |
1848 | |
1849 return ngx_http_top_header_filter(r); | |
1850 } | |
1851 | |
1852 | |
1853 ngx_int_t | |
1854 ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in) | |
1855 { | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1856 ngx_int_t rc; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1857 ngx_connection_t *c; |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1858 |
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1859 c = r->connection; |
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 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
583 | 1862 "http output filter \"%V?%V\"", &r->uri, &r->args); |
557 | 1863 |
1864 rc = ngx_http_top_body_filter(r, in); | |
1865 | |
1866 if (rc == NGX_ERROR) { | |
1867 /* NGX_ERROR may be returned by any filter */ | |
2820
5eb4e2d2e9fa
test already destroyed request
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
1868 c->error = 1; |
557 | 1869 } |
1870 | |
1871 return rc; | |
1872 } | |
1873 | |
1874 | |
1875 u_char * | |
1876 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, | |
773 | 1877 size_t *root_length, size_t reserved) |
557 | 1878 { |
623 | 1879 u_char *last; |
1880 size_t alias; | |
1881 ngx_http_core_loc_conf_t *clcf; | |
557 | 1882 |
1883 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | |
1884 | |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
1885 alias = clcf->alias; |
557 | 1886 |
603 | 1887 if (alias && !r->valid_location) { |
1888 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
1889 "\"alias\" cannot be used in location \"%V\" " |
603 | 1890 "where URI was rewritten", &clcf->name); |
1891 return NULL; | |
1892 } | |
1893 | |
595 | 1894 if (clcf->root_lengths == NULL) { |
1895 | |
773 | 1896 *root_length = clcf->root.len; |
595 | 1897 |
2565
456e453eb84a
fix reserved mapped uri length if alias has captures
Igor Sysoev <igor@sysoev.ru>
parents:
2564
diff
changeset
|
1898 path->len = clcf->root.len + reserved + r->uri.len - alias + 1; |
595 | 1899 |
2049 | 1900 path->data = ngx_pnalloc(r->pool, path->len); |
595 | 1901 if (path->data == NULL) { |
1902 return NULL; | |
1903 } | |
1904 | |
1905 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); | |
623 | 1906 |
1907 } else { | |
2607
cb96a60c8f10
fix alias with variables, but without captures,
Igor Sysoev <igor@sysoev.ru>
parents:
2592
diff
changeset
|
1908 |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1909 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
|
1910 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
|
1911 |
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1912 } else { |
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1913 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
|
1914 } |
2572
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1915 |
9c42c19f364a
reserve space for r->uri, the bug has been introduced in r2566
Igor Sysoev <igor@sysoev.ru>
parents:
2566
diff
changeset
|
1916 if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved, |
671 | 1917 clcf->root_values->elts) |
667 | 1918 == NULL) |
1919 { | |
1920 return NULL; | |
1921 } | |
1922 | |
5316
12dd27b74117
Fixed memory leaks in the root and auth_basic_user_file directives.
Valentin Bartenev <vbart@nginx.com>
parents:
5266
diff
changeset
|
1923 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
|
1924 != NGX_OK) |
12dd27b74117
Fixed memory leaks in the root and auth_basic_user_file directives.
Valentin Bartenev <vbart@nginx.com>
parents:
5266
diff
changeset
|
1925 { |
623 | 1926 return NULL; |
1927 } | |
1928 | |
773 | 1929 *root_length = path->len - reserved; |
1930 last = path->data + *root_length; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1931 |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
1932 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
|
1933 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
|
1934 *last = '\0'; |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1935 return last; |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1936 } |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1937 |
3711bb1336c3
fix a try_files/alias case when alias uses captures and
Igor Sysoev <igor@sysoev.ru>
parents:
3533
diff
changeset
|
1938 alias = 0; |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
1939 } |
595 | 1940 } |
1941 | |
7605
02a539522be4
Tolerate '\0' in URI when mapping URI to path.
Ruslan Ermilov <ru@nginx.com>
parents:
7563
diff
changeset
|
1942 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
|
1943 *last = '\0'; |
557 | 1944 |
1945 return last; | |
1946 } | |
1947 | |
1948 | |
1949 ngx_int_t | |
539 | 1950 ngx_http_auth_basic_user(ngx_http_request_t *r) |
1951 { | |
1952 ngx_str_t auth, encoded; | |
1953 ngx_uint_t len; | |
1954 | |
1955 if (r->headers_in.user.len == 0 && r->headers_in.user.data != NULL) { | |
1956 return NGX_DECLINED; | |
1957 } | |
1958 | |
1959 if (r->headers_in.authorization == NULL) { | |
1960 r->headers_in.user.data = (u_char *) ""; | |
1961 return NGX_DECLINED; | |
1962 } | |
1963 | |
1964 encoded = r->headers_in.authorization->value; | |
1965 | |
1966 if (encoded.len < sizeof("Basic ") - 1 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1967 || ngx_strncasecmp(encoded.data, (u_char *) "Basic ", |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1968 sizeof("Basic ") - 1) |
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1075
diff
changeset
|
1969 != 0) |
539 | 1970 { |
1971 r->headers_in.user.data = (u_char *) ""; | |
1972 return NGX_DECLINED; | |
1973 } | |
1974 | |
1975 encoded.len -= sizeof("Basic ") - 1; | |
1976 encoded.data += sizeof("Basic ") - 1; | |
1977 | |
1978 while (encoded.len && encoded.data[0] == ' ') { | |
1979 encoded.len--; | |
1980 encoded.data++; | |
1981 } | |
1982 | |
1983 if (encoded.len == 0) { | |
1984 r->headers_in.user.data = (u_char *) ""; | |
1985 return NGX_DECLINED; | |
1986 } | |
577 | 1987 |
539 | 1988 auth.len = ngx_base64_decoded_length(encoded.len); |
2049 | 1989 auth.data = ngx_pnalloc(r->pool, auth.len + 1); |
539 | 1990 if (auth.data == NULL) { |
1991 return NGX_ERROR; | |
1992 } | |
1993 | |
1994 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) { | |
1995 r->headers_in.user.data = (u_char *) ""; | |
1996 return NGX_DECLINED; | |
1997 } | |
577 | 1998 |
539 | 1999 auth.data[auth.len] = '\0'; |
577 | 2000 |
2001 for (len = 0; len < auth.len; len++) { | |
539 | 2002 if (auth.data[len] == ':') { |
2003 break; | |
2004 } | |
2005 } | |
577 | 2006 |
573 | 2007 if (len == 0 || len == auth.len) { |
539 | 2008 r->headers_in.user.data = (u_char *) ""; |
2009 return NGX_DECLINED; | |
2010 } | |
2011 | |
2012 r->headers_in.user.len = len; | |
2013 r->headers_in.user.data = auth.data; | |
2014 r->headers_in.passwd.len = auth.len - len - 1; | |
2015 r->headers_in.passwd.data = &auth.data[len + 1]; | |
2016 | |
2017 return NGX_OK; | |
2018 } | |
2019 | |
2020 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2021 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2022 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2023 ngx_int_t |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2024 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
|
2025 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2026 time_t date, expires; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2027 ngx_uint_t p; |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2028 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
|
2029 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
|
2030 |
3313 | 2031 r->gzip_tested = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2032 |
3979
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2033 if (r != r->main) { |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2034 return NGX_DECLINED; |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2035 } |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2036 |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2037 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
|
2038 if (ae == NULL) { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2039 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2040 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2041 |
3982
aab3889c41e9
fix r3981 for case "Accept-Encoding: gzip"
Igor Sysoev <igor@sysoev.ru>
parents:
3980
diff
changeset
|
2042 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
|
2043 return NGX_DECLINED; |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2044 } |
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2045 |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2046 /* |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2047 * 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
|
2048 * MSIE: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2049 * Firefox: "gzip,deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2050 * Chrome: "gzip,deflate,sdch" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2051 * Safari: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2052 * Opera: "gzip, deflate" |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2053 */ |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2054 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2055 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
|
2056 && 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
|
2057 { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2058 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2059 } |
3979
1d9353fbc077
Accept-Encoding refactoring: test first the most common case "gzip,"
Igor Sysoev <igor@sysoev.ru>
parents:
3978
diff
changeset
|
2060 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2061 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
|
2062 |
2205 | 2063 if (r->headers_in.msie6 && clcf->gzip_disable_msie6) { |
2064 return NGX_DECLINED; | |
2065 } | |
2066 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2067 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
|
2068 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2069 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2070 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2071 if (r->headers_in.via == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2072 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2073 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2074 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2075 p = clcf->gzip_proxied; |
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 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
|
2078 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2079 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2080 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2081 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
|
2082 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2083 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2084 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2085 if (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
|
2086 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2087 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2088 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2089 e = r->headers_out.expires; |
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 if (e) { |
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 (!(p & NGX_HTTP_GZIP_PROXIED_EXPIRED)) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2094 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2095 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2096 |
6180
8b6fa4842133
Moved ngx_http_parse_time() to core, renamed accordingly.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
2097 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
|
2098 if (expires == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2099 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2100 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2101 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2102 d = r->headers_out.date; |
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 if (d) { |
6180
8b6fa4842133
Moved ngx_http_parse_time() to core, renamed accordingly.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6153
diff
changeset
|
2105 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
|
2106 if (date == NGX_ERROR) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2107 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2108 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2109 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2110 } else { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2111 date = ngx_time(); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2112 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2113 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2114 if (expires < date) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2115 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2116 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2117 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2118 return NGX_DECLINED; |
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 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2121 cc = r->headers_out.cache_control; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2122 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2123 if (cc) { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2124 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2125 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
|
2126 && 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
|
2127 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2128 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2129 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2130 goto ok; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2133 if ((p & NGX_HTTP_GZIP_PROXIED_NO_STORE) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2134 && 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
|
2135 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2136 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2137 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2138 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2139 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2140 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2141 if ((p & NGX_HTTP_GZIP_PROXIED_PRIVATE) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2142 && 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
|
2143 NULL) |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2144 != NULL) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2145 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2146 goto ok; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2147 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2148 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2149 return NGX_DECLINED; |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2152 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
|
2153 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2154 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2155 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2156 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
|
2157 return NGX_DECLINED; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2158 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2159 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2160 ok: |
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 #if (NGX_PCRE) |
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 (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
|
2165 |
1801
a4cb9c04e7f2
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1800
diff
changeset
|
2166 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
|
2167 &r->headers_in.user_agent->value, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2168 r->connection->log) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2169 != NGX_DECLINED) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2170 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2171 return 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 } |
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 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2176 |
3313 | 2177 r->gzip_ok = 1; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2178 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2179 return NGX_OK; |
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 |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2182 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2183 /* |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2184 * 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
|
2185 * "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
|
2186 * gzip is disabled for the following quantities: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2187 * "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
|
2188 */ |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2189 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2190 static ngx_int_t |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2191 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
|
2192 { |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2193 u_char *p, *start, *last; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2194 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2195 start = ae->data; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2196 last = start + ae->len; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2197 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2198 for ( ;; ) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2199 p = ngx_strcasestrn(start, "gzip", 4 - 1); |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2200 if (p == NULL) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2201 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2202 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2203 |
3986
6c4d2d163611
fix r3981 again for case "Accept-Encoding: gzip"
Igor Sysoev <igor@sysoev.ru>
parents:
3984
diff
changeset
|
2204 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
|
2205 break; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2206 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2207 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2208 start = p + 4; |
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 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2211 p += 4; |
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 while (p < last) { |
5757
c5ec6944de98
Style: add whitespace between control statement and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents:
5733
diff
changeset
|
2214 switch (*p++) { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2215 case ',': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2216 return NGX_OK; |
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 goto quantity; |
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 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2221 default: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2222 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2223 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2224 } |
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 return NGX_OK; |
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 quantity: |
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 while (p < last) { |
5757
c5ec6944de98
Style: add whitespace between control statement and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents:
5733
diff
changeset
|
2231 switch (*p++) { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2232 case 'q': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2233 case 'Q': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2234 goto equal; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2235 case ' ': |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2236 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2237 default: |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2238 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2239 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2240 } |
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 return NGX_OK; |
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 equal: |
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 if (p + 2 > last || *p++ != '=') { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2247 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2248 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2249 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2250 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
|
2251 return NGX_DECLINED; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2252 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2253 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2254 return NGX_OK; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2255 } |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2256 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2257 |
5651
b51bd021808b
Fixed missing "static" in declaration of ngx_http_gzip_quantity().
Valentin Bartenev <vbart@nginx.com>
parents:
5637
diff
changeset
|
2258 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
|
2259 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
|
2260 { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2261 u_char c; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2262 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
|
2263 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2264 c = *p++; |
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 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
|
2267 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2268 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2269 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2270 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
|
2271 |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2272 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
|
2273 return q; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2274 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2275 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2276 c = *p++; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2277 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2278 if (c == ',' || c == ' ') { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2279 return q; |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2280 } |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2281 |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2282 if (c != '.') { |
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2283 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2284 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2285 |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2286 n = 0; |
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 while (p < last) { |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2289 c = *p++; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2290 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2291 if (c == ',' || c == ' ') { |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2292 break; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2293 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2294 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2295 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
|
2296 q += c - '0'; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2297 n++; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2298 continue; |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2299 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2300 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2301 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2302 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2303 |
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
|
2304 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
|
2305 return 0; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2306 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2307 |
3993
f77ed914eb1d
refactor gzip quantity introduced in r3981: it ignored "q=1.000"
Igor Sysoev <igor@sysoev.ru>
parents:
3990
diff
changeset
|
2308 return q; |
3980
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2309 } |
19de03b4217f
Accept-Encoding refactoring: "gzip; q=0" support
Igor Sysoev <igor@sysoev.ru>
parents:
3979
diff
changeset
|
2310 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2311 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2312 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
2313 |
539 | 2314 ngx_int_t |
509 | 2315 ngx_http_subrequest(ngx_http_request_t *r, |
758
86bb73dc8d40
fix <!--#include virtual=... wait="yes" -->
Igor Sysoev <igor@sysoev.ru>
parents:
716
diff
changeset
|
2316 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
|
2317 ngx_http_post_subrequest_t *ps, ngx_uint_t flags) |
509 | 2318 { |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2319 ngx_time_t *tp; |
583 | 2320 ngx_connection_t *c; |
509 | 2321 ngx_http_request_t *sr; |
2322 ngx_http_core_srv_conf_t *cscf; | |
2323 ngx_http_postponed_request_t *pr, *p; | |
2324 | |
6237
06e850859a26
Limit recursive subrequests instead of simultaneous.
Valentin Bartenev <vbart@nginx.com>
parents:
6227
diff
changeset
|
2325 if (r->subrequests == 0) { |
657 | 2326 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
679 | 2327 "subrequests cycle while processing \"%V\"", uri); |
657 | 2328 return NGX_ERROR; |
2329 } | |
2330 | |
6238
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2331 /* |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2332 * 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
|
2333 */ |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2334 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
|
2335 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
|
2336 "request reference counter overflow " |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2337 "while processing \"%V\"", uri); |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2338 return NGX_ERROR; |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2339 } |
8c6e71722aff
Added protection against r->main->count overflow by subrequests.
Valentin Bartenev <vbart@nginx.com>
parents:
6237
diff
changeset
|
2340 |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2341 if (r->subrequest_in_memory) { |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2342 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2343 "nested in-memory subrequest \"%V\"", uri); |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2344 return NGX_ERROR; |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2345 } |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2346 |
509 | 2347 sr = ngx_pcalloc(r->pool, sizeof(ngx_http_request_t)); |
2348 if (sr == NULL) { | |
645 | 2349 return NGX_ERROR; |
509 | 2350 } |
2351 | |
2352 sr->signature = NGX_HTTP_MODULE; | |
583 | 2353 |
2354 c = r->connection; | |
2355 sr->connection = c; | |
509 | 2356 |
2357 sr->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); | |
2358 if (sr->ctx == NULL) { | |
645 | 2359 return NGX_ERROR; |
509 | 2360 } |
2361 | |
2362 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | |
581 | 2363 sizeof(ngx_table_elt_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
2364 != NGX_OK) |
509 | 2365 { |
645 | 2366 return NGX_ERROR; |
509 | 2367 } |
2368 | |
7034
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2369 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
|
2370 sizeof(ngx_table_elt_t)) |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2371 != NGX_OK) |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2372 { |
1b068a4e82d8
Added support for trailers in HTTP responses.
Piotr Sikora <piotrsikora@google.com>
parents:
7027
diff
changeset
|
2373 return NGX_ERROR; |
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 |
509 | 2376 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2377 sr->main_conf = cscf->ctx->main_conf; | |
2378 sr->srv_conf = cscf->ctx->srv_conf; | |
2379 sr->loc_conf = cscf->ctx->loc_conf; | |
2380 | |
2381 sr->pool = r->pool; | |
2382 | |
2383 sr->headers_in = r->headers_in; | |
2384 | |
577 | 2385 ngx_http_clear_content_length(sr); |
2386 ngx_http_clear_accept_ranges(sr); | |
2387 ngx_http_clear_last_modified(sr); | |
509 | 2388 |
2389 sr->request_body = r->request_body; | |
2390 | |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
2391 #if (NGX_HTTP_V2) |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
2392 sr->stream = r->stream; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
2393 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
2394 |
509 | 2395 sr->method = NGX_HTTP_GET; |
2396 sr->http_version = r->http_version; | |
2397 | |
2398 sr->request_line = r->request_line; | |
2399 sr->uri = *uri; | |
573 | 2400 |
509 | 2401 if (args) { |
2402 sr->args = *args; | |
2403 } | |
573 | 2404 |
583 | 2405 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
2406 "http subrequest \"%V?%V\"", uri, &sr->args); | |
2407 | |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2408 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
|
2409 sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0; |
7006
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2410 sr->background = (flags & NGX_HTTP_SUBREQUEST_BACKGROUND) != 0; |
573 | 2411 |
509 | 2412 sr->unparsed_uri = r->unparsed_uri; |
1857
18c20c38ad6d
update GET method text in an subrequest
Igor Sysoev <igor@sysoev.ru>
parents:
1811
diff
changeset
|
2413 sr->method_name = ngx_http_core_get_method; |
509 | 2414 sr->http_protocol = r->http_protocol; |
7295 | 2415 sr->schema = r->schema; |
509 | 2416 |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2417 ngx_http_set_exten(sr); |
509 | 2418 |
553 | 2419 sr->main = r->main; |
509 | 2420 sr->parent = r; |
777
4ab852b691f5
<!--#include virtual=... set=... -->
Igor Sysoev <igor@sysoev.ru>
parents:
773
diff
changeset
|
2421 sr->post_subrequest = ps; |
509 | 2422 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
|
2423 sr->write_event_handler = ngx_http_handler; |
509 | 2424 |
2425 sr->variables = r->variables; | |
2426 | |
2427 sr->log_handler = r->log_handler; | |
2428 | |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2429 if (sr->subrequest_in_memory) { |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2430 sr->filter_need_in_memory = 1; |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2431 } |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
2432 |
7006
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2433 if (!sr->background) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2434 if (c->data == r && r->postponed == NULL) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2435 c->data = sr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2436 } |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2437 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2438 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
|
2439 if (pr == NULL) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2440 return NGX_ERROR; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2441 } |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2442 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2443 pr->request = sr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2444 pr->out = NULL; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2445 pr->next = NULL; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2446 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2447 if (r->postponed) { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2448 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
|
2449 p->next = pr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2450 |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2451 } else { |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2452 r->postponed = pr; |
9552758a786e
Background subrequests for cache updates.
Roman Arutyunyan <arut@nginx.com>
parents:
6986
diff
changeset
|
2453 } |
509 | 2454 } |
2455 | |
2456 sr->internal = 1; | |
2457 | |
543 | 2458 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
|
2459 sr->expect_tested = 1; |
513 | 2460 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; |
2461 | |
651 | 2462 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
|
2463 sr->subrequests = r->subrequests - 1; |
651 | 2464 |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2465 tp = ngx_timeofday(); |
3897 | 2466 sr->start_sec = tp->sec; |
2467 sr->start_msec = tp->msec; | |
3712
518eeff336c1
fix $request_time for subrequests
Igor Sysoev <igor@sysoev.ru>
parents:
3687
diff
changeset
|
2468 |
3049 | 2469 r->main->count++; |
2377
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2470 |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2471 *psr = sr; |
87b8c44906b5
*) refactor subrequest handling, now they run as separate posted requests
Igor Sysoev <igor@sysoev.ru>
parents:
2361
diff
changeset
|
2472 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2473 if (flags & NGX_HTTP_SUBREQUEST_CLONE) { |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2474 sr->method = r->method; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2475 sr->method_name = r->method_name; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2476 sr->loc_conf = r->loc_conf; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2477 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
|
2478 sr->valid_unparsed_uri = r->valid_unparsed_uri; |
6920
8b7fd958c59f
Fixed background update with "if".
Maxim Dounin <mdounin@mdounin.ru>
parents:
6906
diff
changeset
|
2479 sr->content_handler = r->content_handler; |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2480 sr->phase_handler = r->phase_handler; |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2481 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
|
2482 |
7427
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2483 #if (NGX_PCRE) |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2484 sr->ncaptures = r->ncaptures; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2485 sr->captures = r->captures; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2486 sr->captures_data = r->captures_data; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2487 sr->realloc_captures = 1; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2488 r->realloc_captures = 1; |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2489 #endif |
81d49f85afed
Copy regex unnamed captures to cloned subrequests.
Roman Arutyunyan <arut@nginx.com>
parents:
7295
diff
changeset
|
2490 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2491 ngx_http_update_location_config(sr); |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2492 } |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6885
diff
changeset
|
2493 |
3064 | 2494 return ngx_http_post_request(sr, NULL); |
509 | 2495 } |
2496 | |
2497 | |
2498 ngx_int_t | |
487 | 2499 ngx_http_internal_redirect(ngx_http_request_t *r, |
2500 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
|
2501 { |
487 | 2502 ngx_http_core_srv_conf_t *cscf; |
2503 | |
677 | 2504 r->uri_changes--; |
2505 | |
2506 if (r->uri_changes == 0) { | |
2507 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
679 | 2508 "rewrite or internal redirection cycle " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
2509 "while internally redirecting to \"%V\"", uri); |
679 | 2510 |
3114
1c4fcfe57af1
fix request counter for rewrite or internal redirection cycle,
Igor Sysoev <igor@sysoev.ru>
parents:
3078
diff
changeset
|
2511 r->main->count++; |
677 | 2512 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2513 return NGX_DONE; | |
2514 } | |
2515 | |
461 | 2516 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
|
2517 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2518 if (args) { |
461 | 2519 r->args = *args; |
509 | 2520 |
2521 } else { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
2522 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
|
2523 } |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
2524 |
583 | 2525 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2526 "internal redirect: \"%V?%V\"", uri, &r->args); | |
2527 | |
2979
b941147f2b2e
ngx_http_set_exten() is always successful since 0.3.46
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
2528 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
|
2529 |
675 | 2530 /* clear the modules contexts */ |
2531 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
|
2532 |
487 | 2533 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2534 r->loc_conf = cscf->ctx->loc_conf; | |
2535 | |
535 | 2536 ngx_http_update_location_config(r); |
2537 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2538 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2539 r->cache = NULL; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2540 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
2541 |
509 | 2542 r->internal = 1; |
4375
f31146f282fd
Added clearing of r->valid_unparsed_uri on internal redirects.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4325
diff
changeset
|
2543 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
|
2544 r->add_uri_to_alias = 0; |
3049 | 2545 r->main->count++; |
509 | 2546 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
2547 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
|
2548 |
152
fb48bf4fea1c
nginx-0.0.1-2003-10-21-11:47:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
2549 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
|
2550 } |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2551 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
2552 |
1353 | 2553 ngx_int_t |
2554 ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name) | |
2555 { | |
2556 ngx_http_core_srv_conf_t *cscf; | |
2557 ngx_http_core_loc_conf_t **clcfp; | |
2558 ngx_http_core_main_conf_t *cmcf; | |
2559 | |
3049 | 2560 r->main->count++; |
4472
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2561 r->uri_changes--; |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2562 |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2563 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
|
2564 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
|
2565 "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
|
2566 "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
|
2567 |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2568 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
|
2569 return NGX_DONE; |
c95b828912a3
Core: protection from cycles with named locations and post_action.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4471
diff
changeset
|
2570 } |
3049 | 2571 |
5584
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2572 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
|
2573 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
|
2574 "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
|
2575 |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2576 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
|
2577 return NGX_DONE; |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2578 } |
0251f2f1dc93
Disabled redirects to named locations if URI is not set.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5456
diff
changeset
|
2579 |
1353 | 2580 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
2581 | |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2582 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
|
2583 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2584 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
|
2585 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2586 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
|
2587 "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
|
2588 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2589 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
|
2590 || 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
|
2591 { |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2592 continue; |
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 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2595 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
|
2596 "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
|
2597 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
|
2598 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2599 r->internal = 1; |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2600 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
|
2601 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
|
2602 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
|
2603 |
4210
c8f6248566aa
Added clearing of modules' contexts in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4206
diff
changeset
|
2604 /* clear the modules contexts */ |
c8f6248566aa
Added clearing of modules' contexts in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4206
diff
changeset
|
2605 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
|
2606 |
2404
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2607 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
|
2608 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2609 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
|
2610 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2611 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
|
2612 |
4614
347a54b2cb14
Added write event handler reset in ngx_http_named_location().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4600
diff
changeset
|
2613 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
|
2614 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
|
2615 |
dca164c4a868
fix segfault if no named location are defined, but are used
Igor Sysoev <igor@sysoev.ru>
parents:
2400
diff
changeset
|
2616 return NGX_DONE; |
1353 | 2617 } |
2618 } | |
2619 | |
2620 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1591 | 2621 "could not find named location \"%V\"", name); |
1353 | 2622 |
2623 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | |
2027 | 2624 |
1353 | 2625 return NGX_DONE; |
2626 } | |
2627 | |
2628 | |
569 | 2629 ngx_http_cleanup_t * |
2630 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
|
2631 { |
569 | 2632 ngx_http_cleanup_t *cln; |
2633 | |
2634 r = r->main; | |
2635 | |
2636 cln = ngx_palloc(r->pool, sizeof(ngx_http_cleanup_t)); | |
2637 if (cln == NULL) { | |
2638 return NULL; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2639 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2640 |
569 | 2641 if (size) { |
2642 cln->data = ngx_palloc(r->pool, size); | |
2643 if (cln->data == NULL) { | |
2644 return NULL; | |
2645 } | |
2646 | |
2647 } else { | |
2648 cln->data = NULL; | |
2649 } | |
2650 | |
2651 cln->handler = NULL; | |
2652 cln->next = r->cleanup; | |
2653 | |
2654 r->cleanup = cln; | |
2655 | |
2656 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2657 "http cleanup add: %p", cln); | |
2658 | |
2659 return cln; | |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2660 } |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2661 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
2662 |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2663 ngx_int_t |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2664 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
|
2665 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
|
2666 { |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2667 #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
|
2668 u_char *p; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2669 ngx_str_t from; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2670 |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2671 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
|
2672 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2673 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
|
2674 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2675 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2676 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2677 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
|
2678 != NGX_OK) |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2679 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2680 return NGX_ERROR; |
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 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2683 if (from.len == 0 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2684 || from.len > path->len |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2685 || 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
|
2686 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2687 return NGX_OK; |
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 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2690 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
|
2691 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
|
2692 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2693 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2694 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2695 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
|
2696 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2697 if (*p == '/') { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2698 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
|
2699 return NGX_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2700 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2701 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2702 p--; |
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 if (*p == '/') { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
2705 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
|
2706 } |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2707 #endif |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2708 |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2709 return NGX_OK; |
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 |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4491
diff
changeset
|
2712 |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2713 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
|
2714 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
|
2715 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
|
2716 int recursive) |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2717 { |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2718 ngx_int_t rc; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2719 ngx_uint_t found; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2720 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
|
2721 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2722 if (headers == NULL) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2723 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
|
2724 value->len, proxies, |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2725 recursive); |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2726 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2727 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2728 /* revert headers order */ |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2729 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2730 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
|
2731 next = h->next; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2732 h->next = headers; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2733 headers = h; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2734 } |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2735 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2736 /* 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
|
2737 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2738 rc = NGX_DECLINED; |
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 found = 0; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2741 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2742 for (h = headers; h; h = h->next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2743 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
|
2744 h->value.len, proxies, |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2745 recursive); |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2746 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2747 if (!recursive) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2748 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2749 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2750 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2751 if (rc == NGX_DECLINED && found) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2752 rc = NGX_DONE; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2753 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2754 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2755 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2756 if (rc != NGX_OK) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2757 break; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2758 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2759 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2760 found = 1; |
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 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2763 /* restore headers order */ |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2764 |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2765 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
|
2766 next = h->next; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2767 h->next = headers; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2768 headers = h; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2769 } |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8020
diff
changeset
|
2770 |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2771 return rc; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2772 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2773 |
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 static ngx_int_t |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
4973
diff
changeset
|
2776 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
|
2777 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
|
2778 { |
6683
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2779 u_char *p; |
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2780 ngx_addr_t paddr; |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2781 ngx_uint_t found; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2782 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2783 found = 0; |
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 do { |
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 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
|
2788 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
|
2789 } |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2790 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2791 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
|
2792 if (*p != ' ' && *p != ',') { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2793 break; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2794 } |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2795 } |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2796 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2797 for ( /* void */ ; p > xff; p--) { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2798 if (*p == ' ' || *p == ',') { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2799 p++; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2800 break; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2801 } |
4623
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2802 } |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2803 |
7624
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2804 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
|
2805 != NGX_OK) |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2806 { |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2807 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
|
2808 } |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2809 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2810 *addr = paddr; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2811 found = 1; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2812 xfflen = p - 1 - xff; |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2813 |
1055e43e4fab
Made ngx_http_get_forwarded_addr_internal() non-recursive.
Vladimir Homutov <vl@nginx.com>
parents:
7605
diff
changeset
|
2814 } while (recursive && p > xff); |
6683
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2815 |
b802b7e1d9bc
Core: introduced ngx_cidr_match() function.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6564
diff
changeset
|
2816 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
|
2817 } |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2818 |
ed3d0cc6de5a
New function ngx_http_get_forwarded_addr() to look up real client address.
Ruslan Ermilov <ru@nginx.com>
parents:
4614
diff
changeset
|
2819 |
8020
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2820 ngx_int_t |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2821 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
|
2822 { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2823 ngx_uint_t i, j; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2824 ngx_list_part_t *part, *ppart; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2825 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
|
2826 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2827 if (r->headers_in.multi_linked) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2828 return NGX_OK; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2829 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2830 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2831 r->headers_in.multi_linked = 1; |
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 part = &r->headers_in.headers.part; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2834 header = part->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2835 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2836 for (i = 0; /* void */; i++) { |
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 if (i >= part->nelts) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2839 if (part->next == NULL) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2840 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2841 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2842 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2843 part = part->next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2844 header = part->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2845 i = 0; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2846 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2847 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2848 header[i].next = NULL; |
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 /* |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2851 * 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
|
2852 * 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
|
2853 */ |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2854 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2855 ppart = &r->headers_in.headers.part; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2856 pheader = ppart->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2857 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2858 for (j = 0; /* void */; j++) { |
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 if (j >= ppart->nelts) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2861 if (ppart->next == NULL) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2862 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2863 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2864 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2865 ppart = ppart->next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2866 pheader = ppart->elts; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2867 j = 0; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2868 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2869 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2870 if (part == ppart && i == j) { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2871 break; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2872 } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2873 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2874 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
|
2875 && 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
|
2876 header[i].key.len) |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2877 == 0) |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2878 { |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2879 ph = &pheader[j].next; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2880 while (*ph) { ph = &(*ph)->next; } |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2881 *ph = &header[i]; |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2882 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2883 r->headers_in.multi = 1; |
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 break; |
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 } |
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 return NGX_OK; |
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 |
f8f6b9fee66a
FastCGI: combining headers with identical names (ticket #1724).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7984
diff
changeset
|
2893 |
487 | 2894 static char * |
2895 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
|
2896 { |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2897 char *rv; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2898 void *mconf; |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2899 size_t len; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2900 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
|
2901 ngx_uint_t i; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2902 ngx_conf_t pcf; |
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2903 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
|
2904 struct sockaddr_in *sin; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2905 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
|
2906 ngx_http_listen_opt_t lsopt; |
1235
f8a40ccafb04
optimize regex location search
Igor Sysoev <igor@sysoev.ru>
parents:
1234
diff
changeset
|
2907 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
|
2908 ngx_http_core_main_conf_t *cmcf; |
487 | 2909 |
501 | 2910 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
2911 if (ctx == NULL) { | |
487 | 2912 return NGX_CONF_ERROR; |
2913 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2914 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
2915 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
|
2916 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
|
2917 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2918 /* 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
|
2919 |
487 | 2920 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2921 if (ctx->srv_conf == NULL) { | |
2922 return NGX_CONF_ERROR; | |
2923 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2924 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2925 /* 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
|
2926 |
487 | 2927 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); |
2928 if (ctx->loc_conf == NULL) { | |
2929 return NGX_CONF_ERROR; | |
2930 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2931 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2932 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
|
2933 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
|
2934 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2935 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2936 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2937 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
|
2938 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2939 if (module->create_srv_conf) { |
501 | 2940 mconf = module->create_srv_conf(cf); |
2941 if (mconf == NULL) { | |
487 | 2942 return NGX_CONF_ERROR; |
2943 } | |
2944 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2945 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
|
2946 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2947 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2948 if (module->create_loc_conf) { |
501 | 2949 mconf = module->create_loc_conf(cf); |
2950 if (mconf == NULL) { | |
487 | 2951 return NGX_CONF_ERROR; |
2952 } | |
2953 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
2954 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
|
2955 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2956 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2957 |
487 | 2958 |
2959 /* 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
|
2960 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2961 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
|
2962 cscf->ctx = ctx; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2963 |
487 | 2964 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
2965 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; |
487 | 2966 |
501 | 2967 cscfp = ngx_array_push(&cmcf->servers); |
2968 if (cscfp == NULL) { | |
487 | 2969 return NGX_CONF_ERROR; |
2970 } | |
2971 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2972 *cscfp = cscf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2973 |
487 | 2974 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2975 /* parse inside server{} */ |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
2976 |
521 | 2977 pcf = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2978 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
|
2979 cf->cmd_type = NGX_HTTP_SRV_CONF; |
485 | 2980 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2981 rv = ngx_conf_parse(cf, NULL); |
485 | 2982 |
521 | 2983 *cf = pcf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
2984 |
3775
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2985 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
|
2986 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
|
2987 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2988 p = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2989 if (p == NULL) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2990 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2991 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2992 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
2993 lsopt.sockaddr = (struct sockaddr *) p; |
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 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
|
2996 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
2997 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
|
2998 #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
|
2999 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
|
3000 #else |
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((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
|
3002 #endif |
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_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
|
3004 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3005 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
|
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.backlog = NGX_LISTEN_BACKLOG; |
9036
6cf8ed15fd00
Set default listen socket type in http.
Roman Arutyunyan <arut@nginx.com>
parents:
9021
diff
changeset
|
3008 lsopt.type = SOCK_STREAM; |
3775
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.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
|
3010 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
|
3011 #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
|
3012 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
|
3013 #endif |
5456
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
3014 #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
|
3015 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
|
3016 #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
|
3017 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
|
3018 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3019 len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3020 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3021 p = ngx_pnalloc(cf->pool, len); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3022 if (p == NULL) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3023 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3024 } |
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 lsopt.addr_text.data = p; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
3027 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
|
3028 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
|
3029 |
2902fc8487ae
add default listen port at the end of server block parsing instead of
Igor Sysoev <igor@sysoev.ru>
parents:
3774
diff
changeset
|
3030 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
|
3031 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
|
3032 } |
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 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3035 return rv; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3036 } |
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 |
487 | 3039 static char * |
3040 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
|
3041 { |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3042 char *rv; |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3043 u_char *mod; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3044 size_t len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3045 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
|
3046 ngx_uint_t i; |
485 | 3047 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
|
3048 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
|
3049 ngx_http_conf_ctx_t *ctx, *pctx; |
2027 | 3050 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
|
3051 |
501 | 3052 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); |
3053 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
|
3054 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
|
3055 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3056 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3057 pctx = cf->ctx; |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3058 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
|
3059 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
|
3060 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3061 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
|
3062 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
|
3063 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
|
3064 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3065 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3066 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
|
3067 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
|
3068 continue; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3069 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3070 |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3071 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
|
3072 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3073 if (module->create_loc_conf) { |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3074 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
|
3075 module->create_loc_conf(cf); |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
3076 if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) { |
6474 | 3077 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
|
3078 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3079 } |
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 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3082 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
|
3083 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
|
3084 |
216
f1d0e5f09c1e
nginx-0.0.1-2003-12-25-23:26:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
3085 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
|
3086 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3087 if (cf->args->nelts == 3) { |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3088 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3089 len = value[1].len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3090 mod = value[1].data; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3091 name = &value[2]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3092 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3093 if (len == 1 && mod[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3094 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3095 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
|
3096 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
|
3097 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3098 } 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
|
3099 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3100 clcf->name = *name; |
467 | 3101 clcf->noregex = 1; |
3102 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3103 } else if (len == 1 && mod[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3104 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3105 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
|
3106 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
|
3107 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3108 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3109 } 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
|
3110 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3111 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
|
3112 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3113 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3114 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3115 } else { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3116 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3117 "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
|
3118 return NGX_CONF_ERROR; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3119 } |
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 } else { |
1353 | 3122 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3123 name = &value[1]; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3124 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3125 if (name->data[0] == '=') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3126 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3127 clcf->name.len = name->len - 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3128 clcf->name.data = name->data + 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3129 clcf->exact_match = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3130 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3131 } 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
|
3132 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3133 clcf->name.len = name->len - 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3134 clcf->name.data = name->data + 2; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3135 clcf->noregex = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3136 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3137 } else if (name->data[0] == '~') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3138 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3139 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3140 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3141 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3142 if (name->data[0] == '*') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3143 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3144 name->len--; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3145 name->data++; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3146 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3147 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
|
3148 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3149 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3150 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3151 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3152 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
|
3153 return NGX_CONF_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3154 } |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3155 } |
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 } else { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3158 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3159 clcf->name = *name; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3160 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3161 if (name->data[0] == '@') { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3162 clcf->named = 1; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3163 } |
1353 | 3164 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3165 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3166 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3167 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
|
3168 |
6244
055d1f63960a
Fixed segfault with incorrect location nesting.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6238
diff
changeset
|
3169 if (cf->cmd_type == NGX_HTTP_LOC_CONF) { |
2027 | 3170 |
3171 /* nested location */ | |
3172 | |
485 | 3173 #if 0 |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3174 clcf->prev_location = pclcf; |
485 | 3175 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3176 |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3177 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
|
3178 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3179 "location \"%V\" cannot be inside " |
461 | 3180 "the exact location \"%V\"", |
3181 &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
|
3182 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
|
3183 } |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3184 |
1353 | 3185 if (pclcf->named) { |
3186 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3187 "location \"%V\" cannot be inside " |
1353 | 3188 "the named location \"%V\"", |
3189 &clcf->name, &pclcf->name); | |
3190 return NGX_CONF_ERROR; | |
3191 } | |
3192 | |
2027 | 3193 if (clcf->named) { |
3194 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3195 "named location \"%V\" can be " |
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3196 "on the server level only", |
2027 | 3197 &clcf->name); |
3198 return NGX_CONF_ERROR; | |
3199 } | |
3200 | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3201 len = pclcf->name.len; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3202 |
455 | 3203 #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
|
3204 if (clcf->regex == NULL |
5388
fbaae7d1c033
Caseless location tree construction (ticket #90).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5339
diff
changeset
|
3205 && 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
|
3206 #else |
5388
fbaae7d1c033
Caseless location tree construction (ticket #90).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5339
diff
changeset
|
3207 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
|
3208 #endif |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3209 { |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3210 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 3211 "location \"%V\" is outside location \"%V\"", |
3212 &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
|
3213 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
|
3214 } |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
3215 } |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
3216 |
2027 | 3217 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { |
3218 return NGX_CONF_ERROR; | |
3219 } | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3220 |
485 | 3221 save = *cf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3222 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
|
3223 cf->cmd_type = NGX_HTTP_LOC_CONF; |
485 | 3224 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3225 rv = ngx_conf_parse(cf, NULL); |
485 | 3226 |
3227 *cf = save; | |
3228 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3229 return rv; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3230 } |
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 |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3233 static ngx_int_t |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3234 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
|
3235 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
|
3236 { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3237 #if (NGX_PCRE) |
3325 | 3238 ngx_regex_compile_t rc; |
3239 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
3240 | |
3241 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); | |
3242 | |
3243 rc.pattern = *regex; | |
3244 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
3245 rc.err.data = errstr; | |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3246 |
2981
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
3247 #if (NGX_HAVE_CASELESS_FILESYSTEM) |
3325 | 3248 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
|
3249 #else |
5148
4bcd35e7a0f0
Pass PCRE_CASELESS to pcre_compile() for caseless matching.
Ruslan Ermilov <ru@nginx.com>
parents:
5121
diff
changeset
|
3250 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
|
3251 #endif |
635c0006441e
use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
Igor Sysoev <igor@sysoev.ru>
parents:
2979
diff
changeset
|
3252 |
3325 | 3253 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
|
3254 if (clcf->regex == NULL) { |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3255 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3256 } |
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 clcf->name = *regex; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3259 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3260 return NGX_OK; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3261 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3262 #else |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3263 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3264 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3265 "using regex \"%V\" requires PCRE library", |
2400
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3266 regex); |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3267 return NGX_ERROR; |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3268 |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3269 #endif |
2c2b79633ded
allow "~", "~*", "^~", and "=" before location name without space
Igor Sysoev <igor@sysoev.ru>
parents:
2377
diff
changeset
|
3270 } |
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 |
487 | 3273 static char * |
3274 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
|
3275 { |
3318 | 3276 ngx_http_core_loc_conf_t *clcf = conf; |
637 | 3277 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3278 char *rv; |
485 | 3279 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
|
3280 |
3318 | 3281 if (clcf->types == NULL) { |
3282 clcf->types = ngx_array_create(cf->pool, 64, sizeof(ngx_hash_key_t)); | |
3283 if (clcf->types == NULL) { | |
637 | 3284 return NGX_CONF_ERROR; |
3285 } | |
3286 } | |
3287 | |
485 | 3288 save = *cf; |
3289 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
|
3290 cf->handler_conf = conf; |
485 | 3291 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3292 rv = ngx_conf_parse(cf, NULL); |
485 | 3293 |
3294 *cf = save; | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3295 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3296 return rv; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3297 } |
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 |
487 | 3300 static char * |
3301 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
|
3302 { |
3318 | 3303 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
|
3304 |
4827
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3305 ngx_str_t *value, *content_type, *old; |
2136 | 3306 ngx_uint_t i, n, hash; |
589 | 3307 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
|
3308 |
1149
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3309 value = cf->args->elts; |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3310 |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3311 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
|
3312 if (cf->args->nelts != 2) { |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3313 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
|
3314 "invalid number of arguments" |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3315 " in \"include\" directive"); |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3316 return NGX_CONF_ERROR; |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3317 } |
4827
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3318 |
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4780
diff
changeset
|
3319 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
|
3320 } |
b8fe8a80e019
the "include" support inside the "types" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1148
diff
changeset
|
3321 |
589 | 3322 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t)); |
3323 if (content_type == NULL) { | |
3324 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
|
3325 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3326 |
589 | 3327 *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
|
3328 |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3329 for (i = 1; i < cf->args->nelts; i++) { |
589 | 3330 |
2136 | 3331 hash = ngx_hash_strlow(value[i].data, value[i].data, value[i].len); |
589 | 3332 |
3318 | 3333 type = clcf->types->elts; |
3334 for (n = 0; n < clcf->types->nelts; n++) { | |
589 | 3335 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { |
3336 old = type[n].value; | |
3337 type[n].value = content_type; | |
3338 | |
3339 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3340 "duplicate extension \"%V\", " |
589 | 3341 "content type: \"%V\", " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3342 "previous content type: \"%V\"", |
589 | 3343 &value[i], content_type, old); |
4204
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3344 goto next; |
589 | 3345 } |
3346 } | |
3347 | |
3348 | |
3318 | 3349 type = ngx_array_push(clcf->types); |
501 | 3350 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
|
3351 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
|
3352 } |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
425
diff
changeset
|
3353 |
589 | 3354 type->key = value[i]; |
2136 | 3355 type->key_hash = hash; |
589 | 3356 type->value = content_type; |
4204
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3357 |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3358 next: |
657aaedcc0e3
Fixed two minor bugs in "types" parsing code.
Ruslan Ermilov <ru@nginx.com>
parents:
4203
diff
changeset
|
3359 continue; |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3360 } |
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 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
|
3363 } |
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 |
509 | 3366 static ngx_int_t |
3367 ngx_http_core_preconfiguration(ngx_conf_t *cf) | |
3368 { | |
3369 return ngx_http_variables_add_core_vars(cf); | |
3370 } | |
3371 | |
3372 | |
6049
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3373 static ngx_int_t |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3374 ngx_http_core_postconfiguration(ngx_conf_t *cf) |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3375 { |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3376 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
|
3377 |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3378 return NGX_OK; |
42d9beeb22db
Request body: filters support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6022
diff
changeset
|
3379 } |
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 |
487 | 3382 static void * |
3383 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
|
3384 { |
485 | 3385 ngx_http_core_main_conf_t *cmcf; |
3386 | |
501 | 3387 cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t)); |
3388 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
|
3389 return NULL; |
485 | 3390 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3391 |
499 | 3392 if (ngx_array_init(&cmcf->servers, cf->pool, 4, |
569 | 3393 sizeof(ngx_http_core_srv_conf_t *)) |
651 | 3394 != NGX_OK) |
485 | 3395 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3396 return NULL; |
485 | 3397 } |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3398 |
593 | 3399 cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT; |
3400 cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
477 | 3401 |
611 | 3402 cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT; |
3403 cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3404 | |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3405 return cmcf; |
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3406 } |
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 |
487 | 3409 static char * |
3410 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
|
3411 { |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3412 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
|
3413 |
5617
68c6cc832c76
Macros used for initialization in ngx_http_core_init_main_conf().
Maxim Dounin <mdounin@mdounin.ru>
parents:
5605
diff
changeset
|
3414 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
|
3415 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
|
3416 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
|
3417 |
593 | 3418 cmcf->server_names_hash_bucket_size = |
3419 ngx_align(cmcf->server_names_hash_bucket_size, ngx_cacheline_size); | |
3420 | |
611 | 3421 |
5623
d0e75244a18a
Increased default value of variables_hash_max_size.
Andrei Belov <defan@nginx.com>
parents:
5617
diff
changeset
|
3422 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
|
3423 ngx_conf_init_uint_value(cmcf->variables_hash_bucket_size, 64); |
611 | 3424 |
3425 cmcf->variables_hash_bucket_size = | |
3426 ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size); | |
3427 | |
3345
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3428 if (cmcf->ncaptures) { |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3429 cmcf->ncaptures = (cmcf->ncaptures + 1) * 3; |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3430 } |
d8228f0b5113
evaluate maximum captures size on configuration phase
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
3431 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3432 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
|
3433 } |
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 |
487 | 3436 static void * |
3437 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
|
3438 { |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3439 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
|
3440 |
501 | 3441 cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t)); |
3442 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
|
3443 return NULL; |
487 | 3444 } |
3445 | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3446 /* |
487 | 3447 * set by ngx_pcalloc(): |
479 | 3448 * |
3449 * conf->client_large_buffers.num = 0; | |
3450 */ | |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
434
diff
changeset
|
3451 |
681 | 3452 if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4, |
593 | 3453 sizeof(ngx_http_server_name_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2533
diff
changeset
|
3454 != NGX_OK) |
487 | 3455 { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2907
diff
changeset
|
3456 return NULL; |
487 | 3457 } |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3458 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
3459 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
|
3460 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
|
3461 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
|
3462 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE; |
511 | 3463 cscf->ignore_invalid_headers = NGX_CONF_UNSET; |
1585 | 3464 cscf->merge_slashes = NGX_CONF_UNSET; |
2256 | 3465 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
|
3466 |
7269
7f955d3b9a0d
SSL: detect "listen ... ssl" without certificates (ticket #178).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7220
diff
changeset
|
3467 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
|
3468 cscf->line = cf->conf_file->line; |
7f955d3b9a0d
SSL: detect "listen ... ssl" without certificates (ticket #178).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7220
diff
changeset
|
3469 |
91
637625a2acdb
nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
90
diff
changeset
|
3470 return cscf; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3471 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3472 |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3473 |
487 | 3474 static char * |
3475 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
|
3476 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3477 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
|
3478 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
|
3479 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3480 ngx_str_t name; |
593 | 3481 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
|
3482 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
3483 /* 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
|
3484 |
3259
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3485 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
|
3486 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
|
3487 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
|
3488 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
|
3489 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
|
3490 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
|
3491 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
|
3492 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
|
3493 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
|
3494 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
|
3495 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
|
3496 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3497 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
|
3498 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
|
3499 "the \"large_client_header_buffers\" size must be " |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
3500 "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
|
3501 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
|
3502 } |
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 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
|
3505 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
|
3506 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3507 ngx_conf_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
|
3508 |
e9c0fae6be1e
fix segfaults if no listen directive was set in default server {} block:
Igor Sysoev <igor@sysoev.ru>
parents:
3225
diff
changeset
|
3509 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
|
3510 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
|
3511 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3512 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
|
3513 /* the array has 4 empty preallocated elements, so push cannot fail */ |
501 | 3514 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
|
3515 #if (NGX_PCRE) |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3516 sn->regex = NULL; |
c9a0f82deb7c
fix segfault if no server_name was defined
Igor Sysoev <igor@sysoev.ru>
parents:
1559
diff
changeset
|
3517 #endif |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
3518 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
|
3519 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
|
3520 } |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
46
diff
changeset
|
3521 |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3522 sn = conf->server_names.elts; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3523 name = sn[0].name; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3524 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3525 #if (NGX_PCRE) |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3526 if (sn->regex) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3527 name.len++; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3528 name.data--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3529 } else |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3530 #endif |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3531 |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3532 if (name.data[0] == '.') { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3533 name.len--; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3534 name.data++; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3535 } |
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 conf->server_name.len = name.len; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3538 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
|
3539 if (conf->server_name.data == NULL) { |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3540 return NGX_CONF_ERROR; |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3541 } |
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
3542 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3543 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
|
3544 } |
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 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3546 |
487 | 3547 static void * |
3548 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
|
3549 { |
3318 | 3550 ngx_http_core_loc_conf_t *clcf; |
3551 | |
3552 clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t)); | |
3553 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
|
3554 return NULL; |
487 | 3555 } |
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
|
3556 |
479 | 3557 /* |
3558 * set by ngx_pcalloc(): | |
3559 * | |
7848
1bde031b59ff
Location header escaping in redirects (ticket #882).
Ruslan Ermilov <ru@nginx.com>
parents:
7831
diff
changeset
|
3560 * clcf->escaped_name = { 0, NULL }; |
3318 | 3561 * clcf->root = { 0, NULL }; |
3562 * clcf->limit_except = 0; | |
3563 * clcf->post_action = { 0, NULL }; | |
3564 * clcf->types = NULL; | |
3565 * clcf->default_type = { 0, NULL }; | |
3566 * clcf->error_log = NULL; | |
3567 * clcf->error_pages = NULL; | |
3568 * clcf->client_body_path = NULL; | |
3569 * clcf->regex = NULL; | |
3570 * clcf->exact_match = 0; | |
3571 * clcf->auto_redirect = 0; | |
3572 * clcf->alias = 0; | |
3573 * clcf->gzip_proxied = 0; | |
4300 | 3574 * clcf->keepalive_disable = 0; |
479 | 3575 */ |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
3576 |
3318 | 3577 clcf->client_max_body_size = NGX_CONF_UNSET; |
3578 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | |
3579 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | |
3580 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
|
3581 clcf->auth_delay = NGX_CONF_UNSET_MSEC; |
3318 | 3582 clcf->if_modified_since = NGX_CONF_UNSET_UINT; |
4062 | 3583 clcf->max_ranges = NGX_CONF_UNSET_UINT; |
3318 | 3584 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3585 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | |
3586 clcf->internal = NGX_CONF_UNSET; | |
3587 clcf->sendfile = NGX_CONF_UNSET; | |
3588 clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; | |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3589 clcf->subrequest_output_buffer_size = NGX_CONF_UNSET_SIZE; |
3318 | 3590 clcf->aio = NGX_CONF_UNSET; |
6443
fc72784b1f52
Threads: writing via threads pools in event pipe.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6432
diff
changeset
|
3591 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
|
3592 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3593 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
|
3594 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
|
3595 #endif |
3318 | 3596 clcf->read_ahead = NGX_CONF_UNSET_SIZE; |
3597 clcf->directio = NGX_CONF_UNSET; | |
3598 clcf->directio_alignment = NGX_CONF_UNSET; | |
3599 clcf->tcp_nopush = NGX_CONF_UNSET; | |
3600 clcf->tcp_nodelay = NGX_CONF_UNSET; | |
3601 clcf->send_timeout = NGX_CONF_UNSET_MSEC; | |
3602 clcf->send_lowat = NGX_CONF_UNSET_SIZE; | |
3603 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
|
3604 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
|
3605 clcf->limit_rate_after = NGX_CONF_UNSET_PTR; |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3606 clcf->keepalive_time = NGX_CONF_UNSET_MSEC; |
3318 | 3607 clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC; |
3608 clcf->keepalive_header = NGX_CONF_UNSET; | |
3609 clcf->keepalive_requests = NGX_CONF_UNSET_UINT; | |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
3610 clcf->lingering_close = NGX_CONF_UNSET_UINT; |
3318 | 3611 clcf->lingering_time = NGX_CONF_UNSET_MSEC; |
3612 clcf->lingering_timeout = NGX_CONF_UNSET_MSEC; | |
3613 clcf->resolver_timeout = NGX_CONF_UNSET_MSEC; | |
3614 clcf->reset_timedout_connection = NGX_CONF_UNSET; | |
6852
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3615 clcf->absolute_redirect = NGX_CONF_UNSET; |
3318 | 3616 clcf->server_name_in_redirect = NGX_CONF_UNSET; |
3617 clcf->port_in_redirect = NGX_CONF_UNSET; | |
3618 clcf->msie_padding = NGX_CONF_UNSET; | |
3619 clcf->msie_refresh = NGX_CONF_UNSET; | |
3620 clcf->log_not_found = NGX_CONF_UNSET; | |
3621 clcf->log_subrequest = NGX_CONF_UNSET; | |
3622 clcf->recursive_error_pages = NGX_CONF_UNSET; | |
3484 | 3623 clcf->chunked_transfer_encoding = NGX_CONF_UNSET; |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
3624 clcf->etag = NGX_CONF_UNSET; |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3625 clcf->server_tokens = NGX_CONF_UNSET_UINT; |
3318 | 3626 clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; |
3627 clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; | |
3628 | |
3629 clcf->open_file_cache = NGX_CONF_UNSET_PTR; | |
3630 clcf->open_file_cache_valid = NGX_CONF_UNSET; | |
3631 clcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT; | |
3632 clcf->open_file_cache_errors = NGX_CONF_UNSET; | |
3633 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
|
3634 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3635 #if (NGX_HTTP_GZIP) |
3318 | 3636 clcf->gzip_vary = NGX_CONF_UNSET; |
3637 clcf->gzip_http_version = NGX_CONF_UNSET_UINT; | |
1800 | 3638 #if (NGX_PCRE) |
3318 | 3639 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
|
3640 #endif |
3318 | 3641 clcf->gzip_disable_msie6 = 3; |
3773 | 3642 #if (NGX_HTTP_DEGRADATION) |
3643 clcf->gzip_disable_degradation = 3; | |
3644 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3645 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3646 |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3647 #if (NGX_HAVE_OPENAT) |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3648 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
|
3649 clcf->disable_symlinks_from = NGX_CONF_UNSET_PTR; |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3650 #endif |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3651 |
3318 | 3652 return clcf; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3653 } |
54
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
3654 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3655 |
589 | 3656 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html"); |
3657 static ngx_str_t ngx_http_core_image_gif_type = ngx_string("image/gif"); | |
3658 static ngx_str_t ngx_http_core_image_jpeg_type = ngx_string("image/jpeg"); | |
3659 | |
3660 static ngx_hash_key_t ngx_http_core_default_types[] = { | |
3661 { ngx_string("html"), 0, &ngx_http_core_text_html_type }, | |
3662 { ngx_string("gif"), 0, &ngx_http_core_image_gif_type }, | |
3663 { ngx_string("jpg"), 0, &ngx_http_core_image_jpeg_type }, | |
3664 { 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
|
3665 }; |
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 |
487 | 3668 static char * |
589 | 3669 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
|
3670 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
3671 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
|
3672 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
|
3673 |
487 | 3674 ngx_uint_t i; |
589 | 3675 ngx_hash_key_t *type; |
3676 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
|
3677 |
603 | 3678 if (conf->root.data == NULL) { |
3679 | |
625 | 3680 conf->alias = prev->alias; |
603 | 3681 conf->root = prev->root; |
3682 conf->root_lengths = prev->root_lengths; | |
3683 conf->root_values = prev->root_values; | |
3684 | |
3685 if (prev->root.data == NULL) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
3686 ngx_str_set(&conf->root, "html"); |
603 | 3687 |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
3688 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { |
603 | 3689 return NGX_CONF_ERROR; |
3690 } | |
3691 } | |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3692 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
439
diff
changeset
|
3693 |
577 | 3694 if (conf->post_action.data == NULL) { |
3695 conf->post_action = prev->post_action; | |
3696 } | |
3697 | |
663 | 3698 ngx_conf_merge_uint_value(conf->types_hash_max_size, |
3699 prev->types_hash_max_size, 1024); | |
3700 | |
3701 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
|
3702 prev->types_hash_bucket_size, 64); |
589 | 3703 |
3704 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size, | |
3705 ngx_cacheline_size); | |
3706 | |
3707 /* | |
4203 | 3708 * the special handling of the "types" directive in the "http" section |
589 | 3709 * to inherit the http's conf->types_hash to all servers |
3710 */ | |
3711 | |
3712 if (prev->types && prev->types_hash.buckets == NULL) { | |
3713 | |
3714 types_hash.hash = &prev->types_hash; | |
3715 types_hash.key = ngx_hash_key_lc; | |
3716 types_hash.max_size = conf->types_hash_max_size; | |
3717 types_hash.bucket_size = conf->types_hash_bucket_size; | |
595 | 3718 types_hash.name = "types_hash"; |
589 | 3719 types_hash.pool = cf->pool; |
3720 types_hash.temp_pool = NULL; | |
3721 | |
3722 if (ngx_hash_init(&types_hash, prev->types->elts, prev->types->nelts) | |
3723 != NGX_OK) | |
3724 { | |
3725 return NGX_CONF_ERROR; | |
3726 } | |
3727 } | |
3728 | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3729 if (conf->types == NULL) { |
589 | 3730 conf->types = prev->types; |
3731 conf->types_hash = prev->types_hash; | |
3732 } | |
3733 | |
3734 if (conf->types == NULL) { | |
4200
4f5b3714eead
Preallocating exact number of default MIME types entries.
Igor Sysoev <igor@sysoev.ru>
parents:
4198
diff
changeset
|
3735 conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t)); |
589 | 3736 if (conf->types == NULL) { |
3737 return NGX_CONF_ERROR; | |
3738 } | |
3739 | |
3740 for (i = 0; ngx_http_core_default_types[i].key.len; i++) { | |
3741 type = ngx_array_push(conf->types); | |
3742 if (type == NULL) { | |
487 | 3743 return NGX_CONF_ERROR; |
3744 } | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3745 |
589 | 3746 type->key = ngx_http_core_default_types[i].key; |
3747 type->key_hash = | |
3748 ngx_hash_key_lc(ngx_http_core_default_types[i].key.data, | |
3749 ngx_http_core_default_types[i].key.len); | |
3750 type->value = ngx_http_core_default_types[i].value; | |
3751 } | |
3752 } | |
3753 | |
3754 if (conf->types_hash.buckets == NULL) { | |
3755 | |
3756 types_hash.hash = &conf->types_hash; | |
3757 types_hash.key = ngx_hash_key_lc; | |
3758 types_hash.max_size = conf->types_hash_max_size; | |
3759 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
|
3760 types_hash.name = "types_hash"; |
589 | 3761 types_hash.pool = cf->pool; |
3762 types_hash.temp_pool = NULL; | |
3763 | |
3764 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) | |
3765 != NGX_OK) | |
3766 { | |
3767 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
|
3768 } |
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 |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3771 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
|
3772 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
|
3773 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
|
3774 } else { |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2756
diff
changeset
|
3775 conf->error_log = &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
|
3776 } |
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 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3779 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
|
3780 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
|
3781 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
3782 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
95
diff
changeset
|
3783 ngx_conf_merge_str_value(conf->default_type, |
487 | 3784 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
|
3785 |
663 | 3786 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
|
3787 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
|
3788 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
|
3789 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
|
3790 (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
|
3791 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
|
3792 prev->client_body_timeout, 60000); |
509 | 3793 |
4266
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3794 ngx_conf_merge_bitmask_value(conf->keepalive_disable, |
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3795 prev->keepalive_disable, |
4c45306936bb
Fix of "keepalive_disable" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4225
diff
changeset
|
3796 (NGX_CONF_BITMASK_SET |
4551
22e613ba0925
Removed safari from keepalive_disable default.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4541
diff
changeset
|
3797 |NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)); |
1806 | 3798 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3799 NGX_HTTP_SATISFY_ALL); | |
7638
681b78a98a52
The new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov <ru@nginx.com>
parents:
7630
diff
changeset
|
3800 ngx_conf_merge_msec_value(conf->auth_delay, prev->auth_delay, 0); |
2361 | 3801 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
2496 | 3802 NGX_HTTP_IMS_EXACT); |
4062 | 3803 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
|
3804 NGX_MAX_INT32_VALUE); |
2841
faafc084a7a4
fix client_body_in_file_only type
Igor Sysoev <igor@sysoev.ru>
parents:
2820
diff
changeset
|
3805 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
|
3806 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
|
3807 NGX_HTTP_REQUEST_BODY_FILE_OFF); |
2845 | 3808 ngx_conf_merge_value(conf->client_body_in_single_buffer, |
3809 prev->client_body_in_single_buffer, 0); | |
509 | 3810 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
|
3811 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); |
1197 | 3812 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
|
3813 prev->sendfile_max_chunk, 2 * 1024 * 1024); |
7220
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3814 ngx_conf_merge_size_value(conf->subrequest_output_buffer_size, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3815 prev->subrequest_output_buffer_size, |
20f139e9ffa8
Generic subrequests in memory.
Roman Arutyunyan <arut@nginx.com>
parents:
7168
diff
changeset
|
3816 (size_t) ngx_pagesize); |
4202
7a739880b80c
Replaced magic constants representing default values of some directives
Ruslan Ermilov <ru@nginx.com>
parents:
4200
diff
changeset
|
3817 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
|
3818 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
|
3819 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3820 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
|
3821 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
|
3822 NULL); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
3823 #endif |
3178 | 3824 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); |
2129 | 3825 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
|
3826 NGX_OPEN_FILE_DIRECTIO_OFF); |
3053 | 3827 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, |
3828 512); | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
216
diff
changeset
|
3829 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); |
679 | 3830 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); |
509 | 3831 |
253
b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
3832 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
|
3833 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
|
3834 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
|
3835 1460); |
7504
c19ca381b2e6
Variables support in limit_rate and limit_rate_after (ticket #293).
Ruslan Ermilov <ru@nginx.com>
parents:
7478
diff
changeset
|
3836 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7822
diff
changeset
|
3837 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
|
3838 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
|
3839 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
|
3840 |
7820
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3841 ngx_conf_merge_msec_value(conf->keepalive_time, |
fdc3d40979b0
Introduced the "keepalive_time" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7811
diff
changeset
|
3842 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
|
3843 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
|
3844 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
|
3845 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
|
3846 prev->keepalive_header, 0); |
2888 | 3847 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
|
3848 prev->keepalive_requests, 1000); |
3990 | 3849 ngx_conf_merge_uint_value(conf->lingering_close, |
3984
3e51832c8215
lingering_close "off|on|always"
Igor Sysoev <igor@sysoev.ru>
parents:
3982
diff
changeset
|
3850 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
|
3851 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
|
3852 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
|
3853 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
|
3854 prev->lingering_timeout, 5000); |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3855 ngx_conf_merge_msec_value(conf->resolver_timeout, |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3856 prev->resolver_timeout, 30000); |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3857 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3858 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
|
3859 |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3860 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
|
3861 |
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 * 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
|
3864 * 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
|
3865 */ |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3866 |
4225
016352c19049
Support of several servers in the "resolver" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4210
diff
changeset
|
3867 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
|
3868 if (prev->resolver == NULL) { |
1881 | 3869 return NGX_CONF_ERROR; |
1683
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3870 } |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1675
diff
changeset
|
3871 } |
2006
b52cb9bf2064
style fix: remove tabs and trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1982
diff
changeset
|
3872 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
3873 conf->resolver = prev->resolver; |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
3874 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3875 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3876 if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path, |
479 | 3877 prev->client_body_temp_path, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3878 &ngx_http_client_temp_path) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3879 != NGX_OK) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3880 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3881 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2591
diff
changeset
|
3882 } |
479 | 3883 |
346
55e496a8ece3
nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
3884 ngx_conf_merge_value(conf->reset_timedout_connection, |
487 | 3885 prev->reset_timedout_connection, 0); |
6852
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3886 ngx_conf_merge_value(conf->absolute_redirect, |
d15172ebb400
Core: relative redirects (closes #1000).
Ruslan Ermilov <ru@nginx.com>
parents:
6796
diff
changeset
|
3887 prev->absolute_redirect, 1); |
1804
d457a1576532
several changes in server_name:
Igor Sysoev <igor@sysoev.ru>
parents:
1801
diff
changeset
|
3888 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
|
3889 prev->server_name_in_redirect, 0); |
521 | 3890 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
|
3891 ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1); |
679 | 3892 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); |
527 | 3893 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); |
2261 | 3894 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); |
679 | 3895 ngx_conf_merge_value(conf->recursive_error_pages, |
3896 prev->recursive_error_pages, 0); | |
3484 | 3897 ngx_conf_merge_value(conf->chunked_transfer_encoding, |
3898 prev->chunked_transfer_encoding, 1); | |
4749
613750237b36
Entity tags: the "etag" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
3899 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
|
3900 |
6885
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3901 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
|
3902 NGX_HTTP_SERVER_TOKENS_ON); |
25203fc377fb
Implemented the "server_tokens build" option.
Ruslan Ermilov <ru@nginx.com>
parents:
6853
diff
changeset
|
3903 |
1454 | 3904 ngx_conf_merge_ptr_value(conf->open_file_cache, |
1780 | 3905 prev->open_file_cache, NULL); |
1454 | 3906 |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1704
diff
changeset
|
3907 ngx_conf_merge_sec_value(conf->open_file_cache_valid, |
1780 | 3908 prev->open_file_cache_valid, 60); |
1454 | 3909 |
1772 | 3910 ngx_conf_merge_uint_value(conf->open_file_cache_min_uses, |
1780 | 3911 prev->open_file_cache_min_uses, 1); |
1772 | 3912 |
1454 | 3913 ngx_conf_merge_sec_value(conf->open_file_cache_errors, |
1780 | 3914 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
|
3915 |
1457 | 3916 ngx_conf_merge_sec_value(conf->open_file_cache_events, |
1780 | 3917 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
|
3918 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3919 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3920 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
|
3921 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
|
3922 NGX_HTTP_VERSION_11); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3923 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
|
3924 (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
|
3925 |
1800 | 3926 #if (NGX_PCRE) |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3927 ngx_conf_merge_ptr_value(conf->gzip_disable, prev->gzip_disable, NULL); |
1800 | 3928 #endif |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3929 |
2205 | 3930 if (conf->gzip_disable_msie6 == 3) { |
3931 conf->gzip_disable_msie6 = | |
3932 (prev->gzip_disable_msie6 == 3) ? 0 : prev->gzip_disable_msie6; | |
3933 } | |
3934 | |
3773 | 3935 #if (NGX_HTTP_DEGRADATION) |
3936 | |
3937 if (conf->gzip_disable_degradation == 3) { | |
3938 conf->gzip_disable_degradation = | |
3939 (prev->gzip_disable_degradation == 3) ? | |
3940 0 : prev->gzip_disable_degradation; | |
3941 } | |
3942 | |
3943 #endif | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
3944 #endif |
1457 | 3945 |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3946 #if (NGX_HAVE_OPENAT) |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3947 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
|
3948 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
|
3949 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
|
3950 prev->disable_symlinks_from, NULL); |
4477
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3951 #endif |
7033faf6dc3c
Added disable_symlinks directive.
Andrey Belov <defan@nginx.com>
parents:
4474
diff
changeset
|
3952 |
71
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3953 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
|
3954 } |
59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
69
diff
changeset
|
3955 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
87
diff
changeset
|
3956 |
487 | 3957 static char * |
3958 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
|
3959 { |
3217 | 3960 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
|
3961 |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3962 ngx_str_t *value, size; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3963 ngx_url_t u; |
9207
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
3964 ngx_uint_t n, i, backlog; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3965 ngx_http_listen_opt_t lsopt; |
3217 | 3966 |
3967 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
|
3968 |
523 | 3969 value = cf->args->elts; |
577 | 3970 |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3971 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
|
3972 |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3973 u.url = value[1]; |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3974 u.listen = 1; |
906 | 3975 u.default_port = 80; |
804
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3976 |
1559
fe11e2a3946d
use pool instead of ngx_conf_t
Igor Sysoev <igor@sysoev.ru>
parents:
1546
diff
changeset
|
3977 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
|
3978 if (u.err) { |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3979 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
|
3980 "%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
|
3981 u.err, &u.url); |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3982 } |
472cd9768ac2
now the "listen" directives use ngx_parse_url()
Igor Sysoev <igor@sysoev.ru>
parents:
777
diff
changeset
|
3983 |
577 | 3984 return NGX_CONF_ERROR; |
523 | 3985 } |
3986 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3987 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
|
3988 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
3989 lsopt.backlog = NGX_LISTEN_BACKLOG; |
8166
7999d3fbb765
HTTP UDP layer, QUIC support autotest.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7630
diff
changeset
|
3990 lsopt.type = SOCK_STREAM; |
3220
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 |
9207
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4003 backlog = 0; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4004 |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4005 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
|
4006 |
3225
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4007 if (ngx_strcmp(value[n].data, "default_server") == 0 |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4008 || ngx_strcmp(value[n].data, "default") == 0) |
f649453396f5
listen default_server parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3224
diff
changeset
|
4009 { |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4010 lsopt.default_server = 1; |
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4011 continue; |
523 | 4012 } |
4013 | |
4014 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
|
4015 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4016 lsopt.bind = 1; |
523 | 4017 continue; |
4018 } | |
4019 | |
3676 | 4020 #if (NGX_HAVE_SETFIB) |
4021 if (ngx_strncmp(value[n].data, "setfib=", 7) == 0) { | |
4022 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
|
4023 lsopt.set = 1; |
8f2c69418045
Fixed "setfib=" on non-first listening socket.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5428
diff
changeset
|
4024 lsopt.bind = 1; |
3676 | 4025 |
3687 | 4026 if (lsopt.setfib == NGX_ERROR) { |
3676 | 4027 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4028 "invalid setfib \"%V\"", &value[n]); | |
4029 return NGX_CONF_ERROR; | |
4030 } | |
4031 | |
4032 continue; | |
4033 } | |
4034 #endif | |
5456
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4035 |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4036 #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
|
4037 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
|
4038 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
|
4039 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
|
4040 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
|
4041 |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4042 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
|
4043 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
|
4044 "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
|
4045 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
|
4046 } |
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 continue; |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4049 } |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4050 #endif |
692afcea9d0d
Added support for TCP_FASTOPEN supported in Linux >= 3.7.1.
Mathew Rodley <mathew@rodley.com.au>
parents:
5455
diff
changeset
|
4051 |
563 | 4052 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
|
4053 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
|
4054 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4055 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4056 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4057 if (lsopt.backlog == NGX_ERROR || lsopt.backlog == 0) { |
523 | 4058 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4059 "invalid backlog \"%V\"", &value[n]); | |
4060 return NGX_CONF_ERROR; | |
4061 } | |
4062 | |
9207
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4063 backlog = 1; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4064 |
523 | 4065 continue; |
4066 } | |
4067 | |
563 | 4068 if (ngx_strncmp(value[n].data, "rcvbuf=", 7) == 0) { |
4069 size.len = value[n].len - 7; | |
4070 size.data = value[n].data + 7; | |
4071 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4072 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
|
4073 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4074 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4075 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4076 if (lsopt.rcvbuf == NGX_ERROR) { |
563 | 4077 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4078 "invalid rcvbuf \"%V\"", &value[n]); | |
4079 return NGX_CONF_ERROR; | |
4080 } | |
4081 | |
4082 continue; | |
4083 } | |
4084 | |
4085 if (ngx_strncmp(value[n].data, "sndbuf=", 7) == 0) { | |
4086 size.len = value[n].len - 7; | |
4087 size.data = value[n].data + 7; | |
4088 | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4089 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
|
4090 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4091 lsopt.bind = 1; |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4092 |
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4093 if (lsopt.sndbuf == NGX_ERROR) { |
563 | 4094 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4095 "invalid sndbuf \"%V\"", &value[n]); | |
4096 return NGX_CONF_ERROR; | |
4097 } | |
4098 | |
4099 continue; | |
4100 } | |
4101 | |
4102 if (ngx_strncmp(value[n].data, "accept_filter=", 14) == 0) { | |
523 | 4103 #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
|
4104 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
|
4105 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4106 lsopt.bind = 1; |
523 | 4107 #else |
4108 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4109 "accept filters \"%V\" are not supported " | |
4110 "on this platform, ignored", | |
4111 &value[n]); | |
4112 #endif | |
4113 continue; | |
4114 } | |
4115 | |
4116 if (ngx_strcmp(value[n].data, "deferred") == 0) { | |
4117 #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
|
4118 lsopt.deferred_accept = 1; |
3224
8e76e636ae3b
allow to set listen options in any server
Igor Sysoev <igor@sysoev.ru>
parents:
3221
diff
changeset
|
4119 lsopt.set = 1; |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4120 lsopt.bind = 1; |
523 | 4121 #else |
4122 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4123 "the deferred accept is not supported " | |
4124 "on this platform, ignored"); | |
4125 #endif | |
4126 continue; | |
4127 } | |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4128 |
2562 | 4129 if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) { |
4130 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4131 if (ngx_strcmp(&value[n].data[10], "n") == 0) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4132 lsopt.ipv6only = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4133 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4134 } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4135 lsopt.ipv6only = 0; |
2562 | 4136 |
4137 } else { | |
4138 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4139 "invalid ipv6only flags \"%s\"", |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4140 &value[n].data[9]); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4141 return NGX_CONF_ERROR; |
2562 | 4142 } |
4143 | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4144 lsopt.set = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4145 lsopt.bind = 1; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4146 |
2562 | 4147 continue; |
4148 #else | |
4149 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4150 "ipv6only is not supported " |
2562 | 4151 "on this platform"); |
4152 return NGX_CONF_ERROR; | |
4153 #endif | |
4154 } | |
4155 | |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4156 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
|
4157 #if (NGX_HAVE_REUSEPORT) |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4158 lsopt.reuseport = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4159 lsopt.set = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4160 lsopt.bind = 1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4161 #else |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4162 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
|
4163 "reuseport is not supported " |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4164 "on this platform, ignored"); |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4165 #endif |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4166 continue; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4167 } |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6140
diff
changeset
|
4168 |
2224 | 4169 if (ngx_strcmp(value[n].data, "ssl") == 0) { |
4170 #if (NGX_HTTP_SSL) | |
3220
cdcd9e29c589
*) move sockaddr to the listen options
Igor Sysoev <igor@sysoev.ru>
parents:
3219
diff
changeset
|
4171 lsopt.ssl = 1; |
2224 | 4172 continue; |
4173 #else | |
4174 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4175 "the \"ssl\" parameter requires " | |
4176 "ngx_http_ssl_module"); | |
4177 return NGX_CONF_ERROR; | |
4178 #endif | |
4179 } | |
4180 | |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4181 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
|
4182 #if (NGX_HTTP_V2) |
9119
08ef02ad5c54
HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9104
diff
changeset
|
4183 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
08ef02ad5c54
HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9104
diff
changeset
|
4184 "the \"listen ... http2\" directive " |
08ef02ad5c54
HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9104
diff
changeset
|
4185 "is deprecated, use " |
08ef02ad5c54
HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9104
diff
changeset
|
4186 "the \"http2\" directive instead"); |
08ef02ad5c54
HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9104
diff
changeset
|
4187 |
6246
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4188 lsopt.http2 = 1; |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4189 continue; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4190 #else |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4191 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
|
4192 "the \"http2\" parameter requires " |
257b51c37c5a
The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
6244
diff
changeset
|
4193 "ngx_http_v2_module"); |
5121
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4194 return NGX_CONF_ERROR; |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4195 #endif |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4196 } |
c0f7b94e88ba
Preliminary experimental support for SPDY draft 2.
Valentin Bartenev <vbart@nginx.com>
parents:
5086
diff
changeset
|
4197 |
9081
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4198 if (ngx_strcmp(value[n].data, "quic") == 0) { |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4199 #if (NGX_HTTP_V3) |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4200 lsopt.quic = 1; |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4201 lsopt.type = SOCK_DGRAM; |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4202 continue; |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4203 #else |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4204 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4205 "the \"quic\" parameter requires " |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4206 "ngx_http_v3_module"); |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4207 return NGX_CONF_ERROR; |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4208 #endif |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4209 } |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
9061
diff
changeset
|
4210 |
4323
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4211 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
|
4212 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4213 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
|
4214 lsopt.so_keepalive = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4215 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4216 } 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
|
4217 lsopt.so_keepalive = 2; |
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 } else { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4220 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4221 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4222 u_char *p, *end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4223 ngx_str_t s; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4224 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4225 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
|
4226 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
|
4227 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4228 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
|
4229 if (p == NULL) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4230 p = end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4231 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4232 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4233 if (p > s.data) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4234 s.len = p - s.data; |
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 lsopt.tcp_keepidle = ngx_parse_time(&s, 1); |
4474 | 4237 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
|
4238 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4239 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4240 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4241 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4242 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
|
4243 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4244 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
|
4245 if (p == NULL) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4246 p = end; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4247 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4248 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4249 if (p > s.data) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4250 s.len = p - s.data; |
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 lsopt.tcp_keepintvl = ngx_parse_time(&s, 1); |
4474 | 4253 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
|
4254 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4255 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4256 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4257 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4258 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
|
4259 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4260 if (s.data < end) { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4261 s.len = end - s.data; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4262 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4263 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
|
4264 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
|
4265 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4266 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4267 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4268 |
4522 | 4269 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
|
4270 && lsopt.tcp_keepcnt == 0) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4271 { |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4272 goto invalid_so_keepalive; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4273 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4274 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4275 lsopt.so_keepalive = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4276 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4277 #else |
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 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
|
4280 "the \"so_keepalive\" parameter accepts " |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4281 "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
|
4282 return NGX_CONF_ERROR; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4283 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4284 #endif |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4285 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4286 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4287 lsopt.set = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4288 lsopt.bind = 1; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4289 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4290 continue; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4291 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4292 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4293 invalid_so_keepalive: |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4294 |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4295 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
|
4296 "invalid so_keepalive value: \"%s\"", |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4297 &value[n].data[13]); |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4298 return NGX_CONF_ERROR; |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4299 #endif |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4300 } |
c4513d4dd024
Added the "so_keepalive=" parameter to the "listen" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4300
diff
changeset
|
4301 |
5605
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4302 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
|
4303 lsopt.proxy_protocol = 1; |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4304 continue; |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4305 } |
3a72b1805c52
Added server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan <arut@nginx.com>
parents:
5584
diff
changeset
|
4306 |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
4307 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4308 "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
|
4309 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
|
4310 } |
27b628ef907e
nginx-0.0.1-2003-01-28-18:56:37 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
4311 |
9082
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4312 if (lsopt.quic) { |
9207
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4313 #if (NGX_HAVE_TCP_FASTOPEN) |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4314 if (lsopt.fastopen != -1) { |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4315 return "\"fastopen\" parameter is incompatible with \"quic\""; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4316 } |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4317 #endif |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4318 |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4319 if (backlog) { |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4320 return "\"backlog\" parameter is incompatible with \"quic\""; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4321 } |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4322 |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4323 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4324 if (lsopt.accept_filter) { |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4325 return "\"accept_filter\" parameter is incompatible with \"quic\""; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4326 } |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4327 #endif |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4328 |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4329 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT) |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4330 if (lsopt.deferred_accept) { |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4331 return "\"deferred\" parameter is incompatible with \"quic\""; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4332 } |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4333 #endif |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4334 |
9082
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4335 #if (NGX_HTTP_SSL) |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4336 if (lsopt.ssl) { |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4337 return "\"ssl\" parameter is incompatible with \"quic\""; |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4338 } |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4339 #endif |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4340 |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4341 #if (NGX_HTTP_V2) |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4342 if (lsopt.http2) { |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4343 return "\"http2\" parameter is incompatible with \"quic\""; |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4344 } |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4345 #endif |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4346 |
9207
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4347 if (lsopt.so_keepalive) { |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4348 return "\"so_keepalive\" parameter is incompatible with \"quic\""; |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4349 } |
73eb75bee30f
HTTP/3: added more compatibility checks for "listen ... quic".
Sergey Kandaurov <pluknet@nginx.com>
parents:
9119
diff
changeset
|
4350 |
9082
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4351 if (lsopt.proxy_protocol) { |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4352 return "\"proxy_protocol\" parameter is incompatible with \"quic\""; |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4353 } |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4354 } |
f4279edda9fd
HTTP/3: trigger more compatibility errors for "listen quic".
Roman Arutyunyan <arut@nginx.com>
parents:
9081
diff
changeset
|
4355 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4356 for (n = 0; n < u.naddrs; n++) { |
8104
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4357 |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4358 for (i = 0; i < n; i++) { |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4359 if (ngx_cmp_sockaddr(u.addrs[n].sockaddr, u.addrs[n].socklen, |
8117
2af1287d2da7
Fixed port ranges support in the listen directive.
Valentin Bartenev <vbart@wbsrv.ru>
parents:
8104
diff
changeset
|
4360 u.addrs[i].sockaddr, u.addrs[i].socklen, 1) |
8104
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4361 == NGX_OK) |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4362 { |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4363 goto next; |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4364 } |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4365 } |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4366 |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4367 lsopt.sockaddr = u.addrs[n].sockaddr; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4368 lsopt.socklen = u.addrs[n].socklen; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4369 lsopt.addr_text = u.addrs[n].name; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4370 lsopt.wildcard = ngx_inet_wildcard(lsopt.sockaddr); |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4371 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4372 if (ngx_http_add_listen(cf, cscf, &lsopt) != NGX_OK) { |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4373 return NGX_CONF_ERROR; |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4374 } |
8104
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4375 |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4376 next: |
4cc2bfeff46c
Filtering duplicate addresses in listen (ticket #2400).
Maxim Dounin <mdounin@mdounin.ru>
parents:
8038
diff
changeset
|
4377 continue; |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4378 } |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4379 |
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
7427
diff
changeset
|
4380 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
|
4381 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4382 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4383 |
487 | 4384 static char * |
4385 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
|
4386 { |
593 | 4387 ngx_http_core_srv_conf_t *cscf = conf; |
4388 | |
4389 u_char ch; | |
3853
57d2533f98b3
move setting conf->server_name in merge phase
Igor Sysoev <igor@sysoev.ru>
parents:
3846
diff
changeset
|
4390 ngx_str_t *value; |
593 | 4391 ngx_uint_t i; |
4392 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
|
4393 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4394 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
|
4395 |
593 | 4396 for (i = 1; i < cf->args->nelts; i++) { |
4397 | |
4398 ch = value[i].data[0]; | |
4399 | |
2195 | 4400 if ((ch == '*' && (value[i].len < 3 || value[i].data[1] != '.')) |
593 | 4401 || (ch == '.' && value[i].len < 2)) |
4402 { | |
4403 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4404 "server name \"%V\" is invalid", &value[i]); | |
4405 return NGX_CONF_ERROR; | |
4406 } | |
4407 | |
1157 | 4408 if (ngx_strchr(value[i].data, '/')) { |
4409 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4410 "server name \"%V\" has suspicious symbols", |
1157 | 4411 &value[i]); |
4412 } | |
4413 | |
593 | 4414 sn = ngx_array_push(&cscf->server_names); |
501 | 4415 if (sn == NULL) { |
455 | 4416 return NGX_CONF_ERROR; |
4417 } | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4418 |
1387 | 4419 #if (NGX_PCRE) |
4420 sn->regex = NULL; | |
4421 #endif | |
3221
c8de5a8b6d17
rename core_srv_conf fields to more understandable default_server and server
Igor Sysoev <igor@sysoev.ru>
parents:
3220
diff
changeset
|
4422 sn->server = cscf; |
3855 | 4423 |
4424 if (ngx_strcasecmp(value[i].data, (u_char *) "$hostname") == 0) { | |
4425 sn->name = cf->cycle->hostname; | |
4426 | |
4427 } else { | |
4428 sn->name = value[i]; | |
4429 } | |
1387 | 4430 |
4431 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
|
4432 ngx_strlow(sn->name.data, sn->name.data, sn->name.len); |
1387 | 4433 continue; |
4434 } | |
4435 | |
4436 #if (NGX_PCRE) | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1683
diff
changeset
|
4437 { |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4438 u_char *p; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4439 ngx_regex_compile_t rc; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4440 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
|
4441 |
3122
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
4442 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
|
4443 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
|
4444 "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
|
4445 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
|
4446 } |
3e994ac670dc
test space between "~" and regex in server_name and invalid_referers
Igor Sysoev <igor@sysoev.ru>
parents:
3114
diff
changeset
|
4447 |
1387 | 4448 value[i].len--; |
4449 value[i].data++; | |
4450 | |
3325 | 4451 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
4452 | |
4453 rc.pattern = value[i]; | |
4454 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
4455 rc.err.data = errstr; | |
4456 | |
3368
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4457 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
|
4458 if (*p >= 'A' && *p <= 'Z') { |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4459 rc.options = NGX_REGEX_CASELESS; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4460 break; |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4461 } |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4462 } |
75b96847351a
fix server_name regex named captures given by "?P<...>"
Igor Sysoev <igor@sysoev.ru>
parents:
3345
diff
changeset
|
4463 |
3325 | 4464 sn->regex = ngx_http_regex_compile(cf, &rc); |
1387 | 4465 if (sn->regex == NULL) { |
4466 return NGX_CONF_ERROR; | |
4467 } | |
4468 | |
1781 | 4469 sn->name = value[i]; |
3325 | 4470 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
|
4471 } |
1387 | 4472 #else |
4473 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4474 "using regex \"%V\" " |
1387 | 4475 "requires PCRE library", &value[i]); |
4476 | |
4477 return NGX_CONF_ERROR; | |
4478 #endif | |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
4479 } |
97
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4480 |
70d2345a903f
nginx-0.0.1-2003-05-29-17:02:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
4481 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
|
4482 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4483 |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
4484 |
487 | 4485 static char * |
4486 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
|
4487 { |
3318 | 4488 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
|
4489 |
595 | 4490 ngx_str_t *value; |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4491 ngx_int_t alias; |
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4492 ngx_uint_t n; |
595 | 4493 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
|
4494 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4495 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
|
4496 |
3318 | 4497 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
|
4498 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4499 if ((clcf->alias != 0) == alias) { |
6941
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4500 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
|
4501 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4502 |
6941
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4503 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
|
4504 "\"%V\" directive is duplicate, " |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4505 "\"%s\" directive was specified earlier", |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4506 &cmd->name, clcf->alias ? "alias" : "root"); |
6e20a6479325
Simplified code about duplicate root/alias directive.
Ruslan Ermilov <ru@nginx.com>
parents:
6940
diff
changeset
|
4507 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4508 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
|
4509 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4510 |
3318 | 4511 if (clcf->named && alias) { |
1353 | 4512 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4513 "the \"alias\" directive cannot be used " |
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4514 "inside the named location"); |
1353 | 4515 |
4516 return NGX_CONF_ERROR; | |
4517 } | |
4518 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4519 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
|
4520 |
1156 | 4521 if (ngx_strstr(value[1].data, "$document_root") |
4522 || 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
|
4523 { |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4524 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4525 "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
|
4526 "in the \"%V\" directive", |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4527 &cmd->name); |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4528 |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4529 return NGX_CONF_ERROR; |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4530 } |
39a3aa08eefe
disable $document_root variable in the "root/alias" directive
Igor Sysoev <igor@sysoev.ru>
parents:
1149
diff
changeset
|
4531 |
2263
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4532 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
|
4533 || 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
|
4534 { |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4535 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4131
1b05b9bbcebf
Overhauled diagnostic messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4062
diff
changeset
|
4536 "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
|
4537 "in the \"%V\" directive", |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4538 &cmd->name); |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4539 |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4540 return NGX_CONF_ERROR; |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4541 } |
41b51261b726
disable $realpath_root variable in a "root" directive
Igor Sysoev <igor@sysoev.ru>
parents:
2261
diff
changeset
|
4542 |
3535
abb3901be800
fix handling an inherited alias in inclusive location
Igor Sysoev <igor@sysoev.ru>
parents:
3534
diff
changeset
|
4543 clcf->alias = alias ? clcf->name.len : 0; |
3318 | 4544 clcf->root = value[1]; |
4545 | |
6262
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4546 if (!alias && clcf->root.len > 0 |
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4547 && clcf->root.data[clcf->root.len - 1] == '/') |
1063097b22b6
Fixed handling of empty root.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6246
diff
changeset
|
4548 { |
3318 | 4549 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
|
4550 } |
4765ded59eaa
nginx-0.0.10-2004-08-30-23:24:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
404
diff
changeset
|
4551 |
3318 | 4552 if (clcf->root.data[0] != '$') { |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
4553 if (ngx_conf_full_name(cf->cycle, &clcf->root, 0) != NGX_OK) { |
667 | 4554 return NGX_CONF_ERROR; |
4555 } | |
603 | 4556 } |
4557 | |
3318 | 4558 n = ngx_http_script_variables_count(&clcf->root); |
595 | 4559 |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4560 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
|
4561 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
|
4562 |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4563 #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
|
4564 if (alias && clcf->regex) { |
5697
c985d90a8d1f
Fixed alias in regex locations with limit_except/if.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5651
diff
changeset
|
4565 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
|
4566 n = 1; |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4567 } |
3ee39f593642
if a location is specified by regex, then always compile an "alias",
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
4568 #endif |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4569 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4570 if (n) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4571 sc.cf = cf; |
3318 | 4572 sc.source = &clcf->root; |
4573 sc.lengths = &clcf->root_lengths; | |
4574 sc.values = &clcf->root_values; | |
2548
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4575 sc.complete_lengths = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4576 sc.complete_values = 1; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4577 |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4578 if (ngx_http_script_compile(&sc) != NGX_OK) { |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4579 return NGX_CONF_ERROR; |
163114282d2c
captures support in location and alias
Igor Sysoev <igor@sysoev.ru>
parents:
2541
diff
changeset
|
4580 } |
595 | 4581 } |
4582 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4583 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
|
4584 } |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4585 |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
287
diff
changeset
|
4586 |
631 | 4587 static ngx_http_method_name_t ngx_methods_names[] = { |
6474 | 4588 { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, |
4589 { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, | |
4590 { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, | |
4591 { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, | |
4592 { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, | |
4593 { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, | |
4594 { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, | |
4595 { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, | |
4596 { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, | |
4597 { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND }, | |
4598 { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, | |
4599 { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, | |
4600 { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, | |
4601 { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH }, | |
4602 { NULL, 0 } | |
631 | 4603 }; |
4604 | |
4605 | |
4606 static char * | |
4607 ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4608 { | |
2027 | 4609 ngx_http_core_loc_conf_t *pclcf = conf; |
631 | 4610 |
4611 char *rv; | |
4612 void *mconf; | |
4613 ngx_str_t *value; | |
4614 ngx_uint_t i; | |
4615 ngx_conf_t save; | |
4616 ngx_http_module_t *module; | |
4617 ngx_http_conf_ctx_t *ctx, *pctx; | |
4618 ngx_http_method_name_t *name; | |
2027 | 4619 ngx_http_core_loc_conf_t *clcf; |
4620 | |
4621 if (pclcf->limit_except) { | |
6940
39ff6939266e
Unified error messages about duplicate directives.
Ruslan Ermilov <ru@nginx.com>
parents:
6920
diff
changeset
|
4622 return "is duplicate"; |
631 | 4623 } |
4624 | |
2027 | 4625 pclcf->limit_except = 0xffffffff; |
631 | 4626 |
4627 value = cf->args->elts; | |
4628 | |
4629 for (i = 1; i < cf->args->nelts; i++) { | |
4630 for (name = ngx_methods_names; name->name; name++) { | |
4631 | |
4632 if (ngx_strcasecmp(value[i].data, name->name) == 0) { | |
2027 | 4633 pclcf->limit_except &= name->method; |
631 | 4634 goto next; |
4635 } | |
4636 } | |
4637 | |
4638 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4639 "invalid method \"%V\"", &value[i]); | |
4640 return NGX_CONF_ERROR; | |
4641 | |
4642 next: | |
4643 continue; | |
4644 } | |
4645 | |
2027 | 4646 if (!(pclcf->limit_except & NGX_HTTP_GET)) { |
4647 pclcf->limit_except &= (uint32_t) ~NGX_HTTP_HEAD; | |
631 | 4648 } |
4649 | |
4650 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); | |
4651 if (ctx == NULL) { | |
4652 return NGX_CONF_ERROR; | |
4653 } | |
4654 | |
4655 pctx = cf->ctx; | |
4656 ctx->main_conf = pctx->main_conf; | |
4657 ctx->srv_conf = pctx->srv_conf; | |
4658 | |
4659 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module); | |
4660 if (ctx->loc_conf == NULL) { | |
4661 return NGX_CONF_ERROR; | |
4662 } | |
4663 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4664 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
|
4665 if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) { |
631 | 4666 continue; |
4667 } | |
4668 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4669 module = cf->cycle->modules[i]->ctx; |
631 | 4670 |
4671 if (module->create_loc_conf) { | |
4672 | |
4673 mconf = module->create_loc_conf(cf); | |
4674 if (mconf == NULL) { | |
6474 | 4675 return NGX_CONF_ERROR; |
631 | 4676 } |
4677 | |
6379
cf5e822cf470
Dynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6314
diff
changeset
|
4678 ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; |
631 | 4679 } |
4680 } | |
4681 | |
4682 | |
2027 | 4683 clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; |
4684 pclcf->limit_except_loc_conf = ctx->loc_conf; | |
4685 clcf->loc_conf = ctx->loc_conf; | |
4686 clcf->name = pclcf->name; | |
4687 clcf->noname = 1; | |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3721
diff
changeset
|
4688 clcf->lmt_excpt = 1; |
2027 | 4689 |
4690 if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { | |
631 | 4691 return NGX_CONF_ERROR; |
4692 } | |
4693 | |
4694 save = *cf; | |
4695 cf->ctx = ctx; | |
4696 cf->cmd_type = NGX_HTTP_LMT_CONF; | |
4697 | |
4698 rv = ngx_conf_parse(cf, NULL); | |
4699 | |
4700 *cf = save; | |
4701 | |
4702 return rv; | |
4703 } | |
4704 | |
4705 | |
487 | 4706 static char * |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4707 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
|
4708 { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4709 ngx_http_core_loc_conf_t *clcf = conf; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4710 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4711 ngx_str_t *value; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4712 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4713 if (clcf->aio != NGX_CONF_UNSET) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4714 return "is duplicate"; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4715 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4716 |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4717 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4718 clcf->thread_pool = NULL; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4719 clcf->thread_pool_value = NULL; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4720 #endif |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4721 |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4722 value = cf->args->elts; |
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 if (ngx_strcmp(value[1].data, "off") == 0) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4725 clcf->aio = NGX_HTTP_AIO_OFF; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4726 return NGX_CONF_OK; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4727 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4728 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4729 if (ngx_strcmp(value[1].data, "on") == 0) { |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4730 #if (NGX_HAVE_FILE_AIO) |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4731 clcf->aio = NGX_HTTP_AIO_ON; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4732 return NGX_CONF_OK; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4733 #else |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4734 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
|
4735 "\"aio on\" " |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4736 "is unsupported on this platform"); |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4737 return NGX_CONF_ERROR; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4738 #endif |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4739 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4740 |
6022
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4741 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
|
4742 && (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
|
4743 { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4744 #if (NGX_THREADS) |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4745 ngx_str_t name; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4746 ngx_thread_pool_t *tp; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4747 ngx_http_complex_value_t cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4748 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
|
4749 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4750 clcf->aio = NGX_HTTP_AIO_THREADS; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4751 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4752 if (value[1].len >= 8) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4753 name.len = value[1].len - 8; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4754 name.data = value[1].data + 8; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4755 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4756 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
|
4757 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4758 ccv.cf = cf; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4759 ccv.value = &name; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4760 ccv.complex_value = &cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4761 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4762 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
|
4763 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4764 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4765 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4766 if (cv.lengths != NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4767 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
|
4768 sizeof(ngx_http_complex_value_t)); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4769 if (clcf->thread_pool_value == NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4770 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4771 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4772 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4773 *clcf->thread_pool_value = cv; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4774 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4775 return NGX_CONF_OK; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4776 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4777 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4778 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
|
4779 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4780 } else { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4781 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
|
4782 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4783 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4784 if (tp == NULL) { |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4785 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4786 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4787 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4788 clcf->thread_pool = tp; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4789 |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4790 return NGX_CONF_OK; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4791 #else |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4792 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
|
4793 "\"aio threads\" " |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4794 "is unsupported on this platform"); |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4795 return NGX_CONF_ERROR; |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4796 #endif |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4797 } |
1fdba317ee6d
Added support for offloading read() in thread pools.
Valentin Bartenev <vbart@nginx.com>
parents:
6006
diff
changeset
|
4798 |
6006
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4799 return "invalid value"; |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4800 } |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4801 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4802 |
942283a53c28
The "aio" directive parser made smarter.
Ruslan Ermilov <ru@nginx.com>
parents:
6004
diff
changeset
|
4803 static char * |
2129 | 4804 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4805 { | |
4806 ngx_http_core_loc_conf_t *clcf = conf; | |
4807 | |
4808 ngx_str_t *value; | |
4809 | |
4810 if (clcf->directio != NGX_CONF_UNSET) { | |
4811 return "is duplicate"; | |
4812 } | |
4813 | |
4814 value = cf->args->elts; | |
4815 | |
4816 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2277 | 4817 clcf->directio = NGX_OPEN_FILE_DIRECTIO_OFF; |
2129 | 4818 return NGX_CONF_OK; |
4819 } | |
4820 | |
4821 clcf->directio = ngx_parse_offset(&value[1]); | |
4822 if (clcf->directio == (off_t) NGX_ERROR) { | |
4823 return "invalid value"; | |
4824 } | |
4825 | |
4826 return NGX_CONF_OK; | |
4827 } | |
4828 | |
4829 | |
4830 static char * | |
487 | 4831 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
|
4832 { |
3318 | 4833 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
|
4834 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4835 u_char *p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4836 ngx_int_t overwrite; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4837 ngx_str_t *value, uri, args; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4838 ngx_uint_t i, n; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4839 ngx_http_err_page_t *err; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4840 ngx_http_complex_value_t cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4841 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
|
4842 |
3318 | 4843 if (clcf->error_pages == NULL) { |
4844 clcf->error_pages = ngx_array_create(cf->pool, 4, | |
4845 sizeof(ngx_http_err_page_t)); | |
4846 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
|
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 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4850 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4851 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
|
4852 |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4853 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
|
4854 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4855 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
|
4856 if (i == 1) { |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4857 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4858 "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
|
4859 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
|
4860 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4861 |
555 | 4862 if (value[i].len > 1) { |
4863 overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1); | |
4864 | |
4865 if (overwrite == NGX_ERROR) { | |
4866 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4867 "invalid value \"%V\"", &value[i]); | |
4868 return NGX_CONF_ERROR; | |
4869 } | |
4870 | |
4871 } else { | |
4872 overwrite = 0; | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4873 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4874 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4875 n = 2; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4876 |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4877 } else { |
555 | 4878 overwrite = -1; |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4879 n = 1; |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4880 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4881 |
673 | 4882 uri = value[cf->args->nelts - 1]; |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4883 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4884 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
|
4885 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4886 ccv.cf = cf; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4887 ccv.value = &uri; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4888 ccv.complex_value = &cv; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4889 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4890 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
|
4891 return NGX_CONF_ERROR; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4892 } |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4893 |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3484
diff
changeset
|
4894 ngx_str_null(&args); |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4895 |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4930
diff
changeset
|
4896 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
|
4897 p = (u_char *) ngx_strchr(uri.data, '?'); |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4898 |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4899 if (p) { |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4900 cv.value.len = p - uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4901 cv.value.data = uri.data; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4902 p++; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4903 args.len = (uri.data + uri.len) - p; |
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4904 args.data = p; |
673 | 4905 } |
4906 } | |
4907 | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4908 for (i = 1; i < cf->args->nelts - n; i++) { |
3318 | 4909 err = ngx_array_push(clcf->error_pages); |
501 | 4910 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
|
4911 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
|
4912 } |
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
4913 |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
4914 err->status = ngx_atoi(value[i].data, value[i].len); |
487 | 4915 |
715 | 4916 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
|
4917 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
461 | 4918 "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
|
4919 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
|
4920 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4921 |
3401
9e7926763f87
allow to handle 301/302 in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3395
diff
changeset
|
4922 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
|
4923 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
|
4924 "value \"%V\" must be between 300 and 599", |
461 | 4925 &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
|
4926 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
|
4927 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4928 |
3781
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4929 err->overwrite = overwrite; |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4930 |
173a45374a97
allow override redirect status in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
3775
diff
changeset
|
4931 if (overwrite == -1) { |
1923
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4932 switch (err->status) { |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4933 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
|
4934 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
|
4935 case NGX_HTTPS_NO_CERT: |
7630
f001d9384293
Added default overwrite in error_page 494.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7624
diff
changeset
|
4936 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
|
4937 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
|
4938 } |
c72fe0a8d9b4
fix large memory allocation in "error_page 495-497 /uri"
Igor Sysoev <igor@sysoev.ru>
parents:
1919
diff
changeset
|
4939 } |
555 | 4940 |
2589
859f6675a553
use complex value in error_page
Igor Sysoev <igor@sysoev.ru>
parents:
2586
diff
changeset
|
4941 err->value = cv; |
2591 | 4942 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
|
4943 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4944 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4945 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
|
4946 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4947 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
4948 |
487 | 4949 static char * |
1454 | 4950 ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4951 { | |
3318 | 4952 ngx_http_core_loc_conf_t *clcf = conf; |
1454 | 4953 |
4954 time_t inactive; | |
4955 ngx_str_t *value, s; | |
4956 ngx_int_t max; | |
4957 ngx_uint_t i; | |
4958 | |
3318 | 4959 if (clcf->open_file_cache != NGX_CONF_UNSET_PTR) { |
1454 | 4960 return "is duplicate"; |
4961 } | |
4962 | |
4963 value = cf->args->elts; | |
4964 | |
4965 max = 0; | |
4966 inactive = 60; | |
4967 | |
4968 for (i = 1; i < cf->args->nelts; i++) { | |
4969 | |
4970 if (ngx_strncmp(value[i].data, "max=", 4) == 0) { | |
4971 | |
4972 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
|
4973 if (max <= 0) { |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4974 goto failed; |
1454 | 4975 } |
4976 | |
4977 continue; | |
4978 } | |
4979 | |
4980 if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) { | |
4981 | |
4982 s.len = value[i].len - 9; | |
4983 s.data = value[i].data + 9; | |
4984 | |
4985 inactive = ngx_parse_time(&s, 1); | |
4474 | 4986 if (inactive == (time_t) NGX_ERROR) { |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
4987 goto failed; |
1454 | 4988 } |
4989 | |
4990 continue; | |
4991 } | |
4992 | |
4993 if (ngx_strcmp(value[i].data, "off") == 0) { | |
4994 | |
3318 | 4995 clcf->open_file_cache = NULL; |
1454 | 4996 |
4997 continue; | |
4998 } | |
4999 | |
2085
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
5000 failed: |
505af86ac9cb
show an error message for invalid parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2067
diff
changeset
|
5001 |
1454 | 5002 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
5003 "invalid \"open_file_cache\" parameter \"%V\"", | |
5004 &value[i]); | |
5005 return NGX_CONF_ERROR; | |
5006 } | |
5007 | |
3318 | 5008 if (clcf->open_file_cache == NULL) { |
1454 | 5009 return NGX_CONF_OK; |
5010 } | |
5011 | |
5012 if (max == 0) { | |
5013 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4522 | 5014 "\"open_file_cache\" must have the \"max\" parameter"); |
1454 | 5015 return NGX_CONF_ERROR; |
5016 } | |
5017 | |
3318 | 5018 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); |
5019 if (clcf->open_file_cache) { | |
1454 | 5020 return NGX_CONF_OK; |
5021 } | |
5022 | |
5023 return NGX_CONF_ERROR; | |
5024 } | |
5025 | |
5026 | |
5027 static char * | |
509 | 5028 ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
5029 { | |
3318 | 5030 ngx_http_core_loc_conf_t *clcf = conf; |
509 | 5031 |
5254
7ecaa9e4bf1b
Core: support several "error_log" directives.
Vladimir Homutov <vl@nginx.com>
parents:
5240
diff
changeset
|
5032 return ngx_log_set_log(cf, &clcf->error_log); |
509 | 5033 } |
5034 | |
5035 | |
5036 static char * | |
487 | 5037 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
|
5038 { |
3318 | 5039 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
|
5040 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5041 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
|
5042 |
3318 | 5043 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
|
5044 return "is duplicate"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5045 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5046 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5047 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
|
5048 |
3318 | 5049 clcf->keepalive_timeout = ngx_parse_time(&value[1], 0); |
5050 | |
5051 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
|
5052 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5053 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5054 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5055 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
|
5056 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
|
5057 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5058 |
3318 | 5059 clcf->keepalive_header = ngx_parse_time(&value[2], 1); |
5060 | |
4474 | 5061 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
|
5062 return "invalid value"; |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5063 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5064 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5065 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
|
5066 } |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5067 |
694cd6cdb714
nginx-0.0.11-2004-09-17-20:07:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5068 |
487 | 5069 static char * |
509 | 5070 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
|
5071 { |
3318 | 5072 ngx_http_core_loc_conf_t *clcf = conf; |
5073 | |
5074 if (clcf->internal != NGX_CONF_UNSET) { | |
509 | 5075 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
|
5076 } |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
5077 |
3318 | 5078 clcf->internal = 1; |
509 | 5079 |
5080 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
|
5081 } |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5082 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5083 |
487 | 5084 static char * |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5085 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
|
5086 { |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5087 ngx_http_core_loc_conf_t *clcf = conf; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5088 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5089 ngx_str_t *value; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5090 |
1919
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
5091 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
|
5092 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
|
5093 } |
dc0f5013f674
create dummy resolver in http context to inherit it in all servers
Igor Sysoev <igor@sysoev.ru>
parents:
1915
diff
changeset
|
5094 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5095 value = cf->args->elts; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5096 |
4225
016352c19049
Support of several servers in the "resolver" directive.
Igor Sysoev <igor@sysoev.ru>
parents:
4210
diff
changeset
|
5097 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
|
5098 if (clcf->resolver == NULL) { |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5099 return NGX_CONF_ERROR; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5100 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5101 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5102 return NGX_CONF_OK; |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5103 } |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5104 |
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5105 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5106 #if (NGX_HTTP_GZIP) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5107 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5108 static char * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5109 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
|
5110 { |
2205 | 5111 ngx_http_core_loc_conf_t *clcf = conf; |
5112 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5113 #if (NGX_PCRE) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5114 |
3325 | 5115 ngx_str_t *value; |
5116 ngx_uint_t i; | |
5117 ngx_regex_elt_t *re; | |
5118 ngx_regex_compile_t rc; | |
5119 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
|
5120 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5121 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
|
5122 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
|
5123 sizeof(ngx_regex_elt_t)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5124 if (clcf->gzip_disable == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5125 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5126 } |
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 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5129 value = cf->args->elts; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5130 |
3325 | 5131 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
5132 | |
5133 rc.pool = cf->pool; | |
5134 rc.err.len = NGX_MAX_CONF_ERRSTR; | |
5135 rc.err.data = errstr; | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5136 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5137 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
|
5138 |
3754
5f58badd13ed
gzip_disable msie6 ignored other patterns
Igor Sysoev <igor@sysoev.ru>
parents:
3753
diff
changeset
|
5139 if (ngx_strcmp(value[i].data, "msie6") == 0) { |
2205 | 5140 clcf->gzip_disable_msie6 = 1; |
5141 continue; | |
5142 } | |
5143 | |
3773 | 5144 #if (NGX_HTTP_DEGRADATION) |
5145 | |
5146 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
5147 clcf->gzip_disable_degradation = 1; | |
5148 continue; | |
5149 } | |
5150 | |
5151 #endif | |
5152 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5153 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
|
5154 if (re == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5155 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5156 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5157 |
3753
9da3a04fc845
gzip_disable compiled always the first pattern only
Igor Sysoev <igor@sysoev.ru>
parents:
3752
diff
changeset
|
5158 rc.pattern = value[i]; |
3325 | 5159 rc.options = NGX_REGEX_CASELESS; |
5160 | |
5161 if (ngx_regex_compile(&rc) != NGX_OK) { | |
5162 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
|
5163 return NGX_CONF_ERROR; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5164 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5165 |
3325 | 5166 re->regex = rc.regex; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5167 re->name = value[i].data; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5168 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5169 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5170 return NGX_CONF_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5171 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5172 #else |
3773 | 5173 ngx_str_t *value; |
5174 ngx_uint_t i; | |
2205 | 5175 |
5176 value = cf->args->elts; | |
5177 | |
3773 | 5178 for (i = 1; i < cf->args->nelts; i++) { |
5179 if (ngx_strcmp(value[i].data, "msie6") == 0) { | |
5180 clcf->gzip_disable_msie6 = 1; | |
5181 continue; | |
5182 } | |
5183 | |
5184 #if (NGX_HTTP_DEGRADATION) | |
5185 | |
5186 if (ngx_strcmp(value[i].data, "degradation") == 0) { | |
5187 clcf->gzip_disable_degradation = 1; | |
5188 continue; | |
5189 } | |
5190 | |
5191 #endif | |
5192 | |
5193 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5194 "without PCRE library \"gzip_disable\" supports " | |
5195 "builtin \"msie6\" and \"degradation\" mask only"); | |
5196 | |
5197 return NGX_CONF_ERROR; | |
2205 | 5198 } |
5199 | |
3773 | 5200 return NGX_CONF_OK; |
5201 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5202 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5203 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5204 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5205 #endif |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5206 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1781
diff
changeset
|
5207 |
4495
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5208 #if (NGX_HAVE_OPENAT) |
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 static char * |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5211 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
|
5212 { |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5213 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
|
5214 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5215 ngx_str_t *value; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5216 ngx_uint_t i; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5217 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
|
5218 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5219 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
|
5220 return "is duplicate"; |
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 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5223 value = cf->args->elts; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5224 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5225 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
|
5226 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5227 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
|
5228 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
|
5229 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5230 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5231 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5232 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
|
5233 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
|
5234 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5235 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5236 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5237 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
|
5238 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
|
5239 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5240 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5241 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5242 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
|
5243 value[i].len -= 5; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5244 value[i].data += 5; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5245 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5246 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
|
5247 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5248 ccv.cf = cf; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5249 ccv.value = &value[i]; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5250 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
|
5251 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
|
5252 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
|
5253 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5254 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5255 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5256 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
|
5257 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5258 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5259 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5260 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
|
5261 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5262 continue; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5263 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5264 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5265 ngx_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
|
5266 "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
|
5267 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5268 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5269 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5270 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
|
5271 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
|
5272 "\"%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
|
5273 "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
|
5274 &cmd->name); |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5275 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5276 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5277 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5278 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
|
5279 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
|
5280 return NGX_CONF_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5281 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5282 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5283 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
|
5284 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
|
5285 "duplicate parameters \"%V %V\"", |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5286 &value[1], &value[2]); |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5287 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5288 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5289 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5290 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
|
5291 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
|
5292 "\"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
|
5293 return NGX_CONF_ERROR; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5294 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5295 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5296 return NGX_CONF_OK; |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5297 } |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5298 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5299 #endif |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5300 |
b4379a91f9b5
Disable symlinks: added the "from=" parameter to the "disable_symlinks"
Valentin Bartenev <vbart@nginx.com>
parents:
4494
diff
changeset
|
5301 |
1652
cc7a7d0b89e8
http resolver and resolver_timeout
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
5302 static char * |
487 | 5303 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
|
5304 { |
473 | 5305 #if (NGX_FREEBSD) |
452 | 5306 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
|
5307 |
673 | 5308 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
|
5309 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
|
5310 "\"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
|
5311 "(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
|
5312 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
|
5313 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5314 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
|
5315 } |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5316 |
469 | 5317 #elif !(NGX_HAVE_SO_SNDLOWAT) |
473 | 5318 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
|
5319 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5320 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
|
5321 "\"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
|
5322 |
452 | 5323 *np = 0; |
5324 | |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5325 #endif |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5326 |
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
5327 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
|
5328 } |
1200 | 5329 |
5330 | |
5331 static char * | |
5332 ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data) | |
5333 { | |
5334 size_t *sp = data; | |
5335 | |
5336 if (*sp < NGX_MIN_POOL_SIZE) { | |
5337 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3388 | 5338 "the pool size must be no less than %uz", |
5339 NGX_MIN_POOL_SIZE); | |
5340 return NGX_CONF_ERROR; | |
5341 } | |
5342 | |
5343 if (*sp % NGX_POOL_ALIGNMENT) { | |
5344 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
5345 "the pool size must be a multiple of %uz", | |
5346 NGX_POOL_ALIGNMENT); | |
1200 | 5347 return NGX_CONF_ERROR; |
5348 } | |
5349 | |
5350 return NGX_CONF_OK; | |
5351 } |