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