Mercurial > hg > nginx
annotate src/http/modules/ngx_http_proxy_module.c @ 7884:b87b7092cedb
Improved logging of invalid headers.
In 71edd9192f24 logging of invalid headers which were rejected with the
NGX_HTTP_PARSE_INVALID_HEADER error was restricted to just the "client
sent invalid header line" message, without any attempts to log the header
itself.
This patch returns logging of the header up to the invalid character and
the character itself. The r->header_end pointer is now properly set
in all cases to make logging possible.
The same logging is also introduced when parsing headers from upstream
servers.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 28 Jun 2021 18:01:20 +0300 |
parents | 52338ddf9e2f |
children | 419c066cb710 |
rev | line source |
---|---|
507 | 1 |
577 | 2 /* |
507 | 3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
507 | 5 */ |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
13 #define NGX_HTTP_PROXY_COOKIE_SECURE 0x0001 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
14 #define NGX_HTTP_PROXY_COOKIE_SECURE_ON 0x0002 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
15 #define NGX_HTTP_PROXY_COOKIE_SECURE_OFF 0x0004 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
16 #define NGX_HTTP_PROXY_COOKIE_HTTPONLY 0x0008 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
17 #define NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON 0x0010 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
18 #define NGX_HTTP_PROXY_COOKIE_HTTPONLY_OFF 0x0020 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
19 #define NGX_HTTP_PROXY_COOKIE_SAMESITE 0x0040 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
20 #define NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT 0x0080 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
21 #define NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX 0x0100 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
22 #define NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE 0x0200 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
23 #define NGX_HTTP_PROXY_COOKIE_SAMESITE_OFF 0x0400 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
24 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
25 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
26 typedef struct { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
27 ngx_array_t caches; /* ngx_http_file_cache_t * */ |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
28 } ngx_http_proxy_main_conf_t; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
29 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
30 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
31 typedef struct ngx_http_proxy_rewrite_s ngx_http_proxy_rewrite_t; |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
32 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
33 typedef ngx_int_t (*ngx_http_proxy_rewrite_pt)(ngx_http_request_t *r, |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
34 ngx_str_t *value, size_t prefix, size_t len, |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
35 ngx_http_proxy_rewrite_t *pr); |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
36 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
37 struct ngx_http_proxy_rewrite_s { |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
38 ngx_http_proxy_rewrite_pt handler; |
507 | 39 |
509 | 40 union { |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
41 ngx_http_complex_value_t complex; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
42 #if (NGX_PCRE) |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
43 ngx_http_regex_t *regex; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
44 #endif |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
45 } pattern; |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
46 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
47 ngx_http_complex_value_t replacement; |
509 | 48 }; |
49 | |
50 | |
51 typedef struct { | |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
52 union { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
53 ngx_http_complex_value_t complex; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
54 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
55 ngx_http_regex_t *regex; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
56 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
57 } cookie; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
58 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
59 ngx_array_t flags_values; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
60 ngx_uint_t regex; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
61 } ngx_http_proxy_cookie_flags_t; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
62 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
63 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
64 typedef struct { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
65 ngx_str_t key_start; |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
66 ngx_str_t schema; |
1658 | 67 ngx_str_t host_header; |
68 ngx_str_t port; | |
69 ngx_str_t uri; | |
70 } ngx_http_proxy_vars_t; | |
71 | |
72 | |
73 typedef struct { | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
74 ngx_array_t *flushes; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
75 ngx_array_t *lengths; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
76 ngx_array_t *values; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
77 ngx_hash_t hash; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
78 } ngx_http_proxy_headers_t; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
79 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
80 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
81 typedef struct { |
651 | 82 ngx_http_upstream_conf_t upstream; |
83 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
84 ngx_array_t *body_flushes; |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
85 ngx_array_t *body_lengths; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
86 ngx_array_t *body_values; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
87 ngx_str_t body_source; |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
88 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
89 ngx_http_proxy_headers_t headers; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
90 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
91 ngx_http_proxy_headers_t headers_cache; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
92 #endif |
651 | 93 ngx_array_t *headers_source; |
94 | |
1658 | 95 ngx_array_t *proxy_lengths; |
96 ngx_array_t *proxy_values; | |
97 | |
651 | 98 ngx_array_t *redirects; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
99 ngx_array_t *cookie_domains; |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
100 ngx_array_t *cookie_paths; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
101 ngx_array_t *cookie_flags; |
651 | 102 |
6781
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
103 ngx_http_complex_value_t *method; |
1658 | 104 ngx_str_t location; |
105 ngx_str_t url; | |
106 | |
2672 | 107 #if (NGX_HTTP_CACHE) |
108 ngx_http_complex_value_t cache_key; | |
109 #endif | |
110 | |
1658 | 111 ngx_http_proxy_vars_t vars; |
651 | 112 |
113 ngx_flag_t redirect; | |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
114 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
115 ngx_uint_t http_version; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
116 |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
117 ngx_uint_t headers_hash_max_size; |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
118 ngx_uint_t headers_hash_bucket_size; |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
119 |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
120 #if (NGX_HTTP_SSL) |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
121 ngx_uint_t ssl; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
122 ngx_uint_t ssl_protocols; |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
123 ngx_str_t ssl_ciphers; |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
124 ngx_uint_t ssl_verify_depth; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
125 ngx_str_t ssl_trusted_certificate; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
126 ngx_str_t ssl_crl; |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
127 ngx_array_t *ssl_conf_commands; |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
128 #endif |
507 | 129 } ngx_http_proxy_loc_conf_t; |
130 | |
131 | |
132 typedef struct { | |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
133 ngx_http_status_t status; |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
134 ngx_http_chunked_t chunked; |
1658 | 135 ngx_http_proxy_vars_t vars; |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
136 off_t internal_body_length; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
137 |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
138 ngx_chain_t *free; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
139 ngx_chain_t *busy; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
140 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
141 unsigned head:1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
142 unsigned internal_chunked:1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
143 unsigned header_sent:1; |
509 | 144 } ngx_http_proxy_ctx_t; |
507 | 145 |
146 | |
1658 | 147 static ngx_int_t ngx_http_proxy_eval(ngx_http_request_t *r, |
148 ngx_http_proxy_ctx_t *ctx, ngx_http_proxy_loc_conf_t *plcf); | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
149 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
150 static ngx_int_t ngx_http_proxy_create_key(ngx_http_request_t *r); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
151 #endif |
507 | 152 static ngx_int_t ngx_http_proxy_create_request(ngx_http_request_t *r); |
153 static ngx_int_t ngx_http_proxy_reinit_request(ngx_http_request_t *r); | |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
154 static ngx_int_t ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in); |
509 | 155 static ngx_int_t ngx_http_proxy_process_status_line(ngx_http_request_t *r); |
507 | 156 static ngx_int_t ngx_http_proxy_process_header(ngx_http_request_t *r); |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
157 static ngx_int_t ngx_http_proxy_input_filter_init(void *data); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
158 static ngx_int_t ngx_http_proxy_copy_filter(ngx_event_pipe_t *p, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
159 ngx_buf_t *buf); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
160 static ngx_int_t ngx_http_proxy_chunked_filter(ngx_event_pipe_t *p, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
161 ngx_buf_t *buf); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
162 static ngx_int_t ngx_http_proxy_non_buffered_copy_filter(void *data, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
163 ssize_t bytes); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
164 static ngx_int_t ngx_http_proxy_non_buffered_chunked_filter(void *data, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
165 ssize_t bytes); |
507 | 166 static void ngx_http_proxy_abort_request(ngx_http_request_t *r); |
167 static void ngx_http_proxy_finalize_request(ngx_http_request_t *r, | |
168 ngx_int_t rc); | |
169 | |
573 | 170 static ngx_int_t ngx_http_proxy_host_variable(ngx_http_request_t *r, |
171 ngx_http_variable_value_t *v, uintptr_t data); | |
172 static ngx_int_t ngx_http_proxy_port_variable(ngx_http_request_t *r, | |
173 ngx_http_variable_value_t *v, uintptr_t data); | |
174 static ngx_int_t | |
509 | 175 ngx_http_proxy_add_x_forwarded_for_variable(ngx_http_request_t *r, |
573 | 176 ngx_http_variable_value_t *v, uintptr_t data); |
577 | 177 static ngx_int_t |
178 ngx_http_proxy_internal_body_length_variable(ngx_http_request_t *r, | |
179 ngx_http_variable_value_t *v, uintptr_t data); | |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
180 static ngx_int_t ngx_http_proxy_internal_chunked_variable(ngx_http_request_t *r, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
181 ngx_http_variable_value_t *v, uintptr_t data); |
509 | 182 static ngx_int_t ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r, |
183 ngx_table_elt_t *h, size_t prefix); | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
184 static ngx_int_t ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
185 ngx_table_elt_t *h); |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
186 static ngx_int_t ngx_http_proxy_parse_cookie(ngx_str_t *value, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
187 ngx_array_t *attrs); |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
188 static ngx_int_t ngx_http_proxy_rewrite_cookie_value(ngx_http_request_t *r, |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
189 ngx_str_t *value, ngx_array_t *rewrites); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
190 static ngx_int_t ngx_http_proxy_rewrite_cookie_flags(ngx_http_request_t *r, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
191 ngx_array_t *attrs, ngx_array_t *flags); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
192 static ngx_int_t ngx_http_proxy_edit_cookie_flags(ngx_http_request_t *r, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
193 ngx_array_t *attrs, ngx_uint_t flags); |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
194 static ngx_int_t ngx_http_proxy_rewrite(ngx_http_request_t *r, |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
195 ngx_str_t *value, size_t prefix, size_t len, ngx_str_t *replacement); |
507 | 196 |
509 | 197 static ngx_int_t ngx_http_proxy_add_variables(ngx_conf_t *cf); |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
198 static void *ngx_http_proxy_create_main_conf(ngx_conf_t *cf); |
507 | 199 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); |
200 static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, | |
201 void *parent, void *child); | |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
202 static ngx_int_t ngx_http_proxy_init_headers(ngx_conf_t *cf, |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
203 ngx_http_proxy_loc_conf_t *conf, ngx_http_proxy_headers_t *headers, |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
204 ngx_keyval_t *default_headers); |
507 | 205 |
206 static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, | |
207 void *conf); | |
509 | 208 static char *ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, |
209 void *conf); | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
210 static char *ngx_http_proxy_cookie_domain(ngx_conf_t *cf, ngx_command_t *cmd, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
211 void *conf); |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
212 static char *ngx_http_proxy_cookie_path(ngx_conf_t *cf, ngx_command_t *cmd, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
213 void *conf); |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
214 static char *ngx_http_proxy_cookie_flags(ngx_conf_t *cf, ngx_command_t *cmd, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
215 void *conf); |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
216 static char *ngx_http_proxy_store(ngx_conf_t *cf, ngx_command_t *cmd, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
217 void *conf); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
218 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
219 static char *ngx_http_proxy_cache(ngx_conf_t *cf, ngx_command_t *cmd, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
220 void *conf); |
2672 | 221 static char *ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, |
222 void *conf); | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
223 #endif |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
224 #if (NGX_HTTP_SSL) |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
225 static char *ngx_http_proxy_ssl_password_file(ngx_conf_t *cf, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
226 ngx_command_t *cmd, void *conf); |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
227 #endif |
507 | 228 |
229 static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data); | |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
230 #if (NGX_HTTP_SSL) |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
231 static char *ngx_http_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
232 void *data); |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
233 #endif |
507 | 234 |
4463
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
235 static ngx_int_t ngx_http_proxy_rewrite_regex(ngx_conf_t *cf, |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
236 ngx_http_proxy_rewrite_t *pr, ngx_str_t *regex, ngx_uint_t caseless); |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
237 |
1658 | 238 #if (NGX_HTTP_SSL) |
239 static ngx_int_t ngx_http_proxy_set_ssl(ngx_conf_t *cf, | |
240 ngx_http_proxy_loc_conf_t *plcf); | |
241 #endif | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
242 static void ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v); |
1658 | 243 |
509 | 244 |
507 | 245 static ngx_conf_post_t ngx_http_proxy_lowat_post = |
509 | 246 { ngx_http_proxy_lowat_check }; |
247 | |
507 | 248 |
249 static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = { | |
250 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, | |
251 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, | |
252 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, | |
6467
91c8d990fb45
Upstream: proxy_next_upstream non_idempotent.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6311
diff
changeset
|
253 { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT }, |
507 | 254 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, |
2268
33556140681a
*) ngx_http_upstream_test_next()
Igor Sysoev <igor@sysoev.ru>
parents:
2256
diff
changeset
|
255 { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 }, |
623 | 256 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, |
2268
33556140681a
*) ngx_http_upstream_test_next()
Igor Sysoev <igor@sysoev.ru>
parents:
2256
diff
changeset
|
257 { ngx_string("http_504"), NGX_HTTP_UPSTREAM_FT_HTTP_504 }, |
5231
05c53652e7b4
Upstream: http_403 support in proxy_next_upstream (and friends).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5211
diff
changeset
|
258 { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 }, |
507 | 259 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 }, |
6966
fa56ab75cffc
Upstream: allow recovery from "429 Too Many Requests" response.
Piotr Sikora <piotrsikora@google.com>
parents:
6906
diff
changeset
|
260 { ngx_string("http_429"), NGX_HTTP_UPSTREAM_FT_HTTP_429 }, |
2927
55ceaef03d34
proxy_cache_use_stale/fastcgi_cache_use_stale updating
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
261 { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING }, |
665 | 262 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, |
507 | 263 { ngx_null_string, 0 } |
264 }; | |
265 | |
266 | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
267 #if (NGX_HTTP_SSL) |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
268 |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
269 static ngx_conf_bitmask_t ngx_http_proxy_ssl_protocols[] = { |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
270 { ngx_string("SSLv2"), NGX_SSL_SSLv2 }, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
271 { ngx_string("SSLv3"), NGX_SSL_SSLv3 }, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
272 { ngx_string("TLSv1"), NGX_SSL_TLSv1 }, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
273 { ngx_string("TLSv1.1"), NGX_SSL_TLSv1_1 }, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
274 { ngx_string("TLSv1.2"), NGX_SSL_TLSv1_2 }, |
6981
08dc60979133
SSL: added support for TLSv1.3 in ssl_protocols directive.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6966
diff
changeset
|
275 { ngx_string("TLSv1.3"), NGX_SSL_TLSv1_3 }, |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
276 { ngx_null_string, 0 } |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
277 }; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
278 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
279 static ngx_conf_post_t ngx_http_proxy_ssl_conf_command_post = |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
280 { ngx_http_proxy_ssl_conf_command_check }; |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
281 |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
282 #endif |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
283 |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
284 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
285 static ngx_conf_enum_t ngx_http_proxy_http_version[] = { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
286 { ngx_string("1.0"), NGX_HTTP_VERSION_10 }, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
287 { ngx_string("1.1"), NGX_HTTP_VERSION_11 }, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
288 { ngx_null_string, 0 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
289 }; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
290 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
291 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
292 ngx_module_t ngx_http_proxy_module; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
293 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
294 |
507 | 295 static ngx_command_t ngx_http_proxy_commands[] = { |
296 | |
297 { ngx_string("proxy_pass"), | |
843
ebab9490204c
allow proxy_pass inside limit_except
Igor Sysoev <igor@sysoev.ru>
parents:
812
diff
changeset
|
298 NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_HTTP_LMT_CONF|NGX_CONF_TAKE1, |
507 | 299 ngx_http_proxy_pass, |
300 NGX_HTTP_LOC_CONF_OFFSET, | |
301 0, | |
302 NULL }, | |
303 | |
509 | 304 { ngx_string("proxy_redirect"), |
305 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, | |
306 ngx_http_proxy_redirect, | |
307 NGX_HTTP_LOC_CONF_OFFSET, | |
308 0, | |
309 NULL }, | |
310 | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
311 { ngx_string("proxy_cookie_domain"), |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
312 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
313 ngx_http_proxy_cookie_domain, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
314 NGX_HTTP_LOC_CONF_OFFSET, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
315 0, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
316 NULL }, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
317 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
318 { ngx_string("proxy_cookie_path"), |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
319 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
320 ngx_http_proxy_cookie_path, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
321 NGX_HTTP_LOC_CONF_OFFSET, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
322 0, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
323 NULL }, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
324 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
325 { ngx_string("proxy_cookie_flags"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
326 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
327 ngx_http_proxy_cookie_flags, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
328 NGX_HTTP_LOC_CONF_OFFSET, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
329 0, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
330 NULL }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
331 |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
332 { ngx_string("proxy_store"), |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
333 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
334 ngx_http_proxy_store, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
335 NGX_HTTP_LOC_CONF_OFFSET, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
336 0, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
337 NULL }, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
338 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
339 { ngx_string("proxy_store_access"), |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
340 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, |
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
341 ngx_conf_set_access_slot, |
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
342 NGX_HTTP_LOC_CONF_OFFSET, |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
343 offsetof(ngx_http_proxy_loc_conf_t, upstream.store_access), |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
344 NULL }, |
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
345 |
581 | 346 { ngx_string("proxy_buffering"), |
347 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
348 ngx_conf_set_flag_slot, | |
349 NGX_HTTP_LOC_CONF_OFFSET, | |
350 offsetof(ngx_http_proxy_loc_conf_t, upstream.buffering), | |
351 NULL }, | |
352 | |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
353 { ngx_string("proxy_request_buffering"), |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
354 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
355 ngx_conf_set_flag_slot, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
356 NGX_HTTP_LOC_CONF_OFFSET, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
357 offsetof(ngx_http_proxy_loc_conf_t, upstream.request_buffering), |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
358 NULL }, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
359 |
629 | 360 { ngx_string("proxy_ignore_client_abort"), |
361 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
362 ngx_conf_set_flag_slot, | |
363 NGX_HTTP_LOC_CONF_OFFSET, | |
364 offsetof(ngx_http_proxy_loc_conf_t, upstream.ignore_client_abort), | |
365 NULL }, | |
366 | |
3271
fcd98af88df3
proxy_bind, fastcgi_bind, and memcached_bind
Igor Sysoev <igor@sysoev.ru>
parents:
3006
diff
changeset
|
367 { ngx_string("proxy_bind"), |
6530
1d0e03db9f8e
Upstream: the "transparent" parameter of proxy_bind and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6480
diff
changeset
|
368 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, |
3399 | 369 ngx_http_upstream_bind_set_slot, |
3271
fcd98af88df3
proxy_bind, fastcgi_bind, and memcached_bind
Igor Sysoev <igor@sysoev.ru>
parents:
3006
diff
changeset
|
370 NGX_HTTP_LOC_CONF_OFFSET, |
fcd98af88df3
proxy_bind, fastcgi_bind, and memcached_bind
Igor Sysoev <igor@sysoev.ru>
parents:
3006
diff
changeset
|
371 offsetof(ngx_http_proxy_loc_conf_t, upstream.local), |
fcd98af88df3
proxy_bind, fastcgi_bind, and memcached_bind
Igor Sysoev <igor@sysoev.ru>
parents:
3006
diff
changeset
|
372 NULL }, |
fcd98af88df3
proxy_bind, fastcgi_bind, and memcached_bind
Igor Sysoev <igor@sysoev.ru>
parents:
3006
diff
changeset
|
373 |
7371
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
374 { ngx_string("proxy_socket_keepalive"), |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
375 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
376 ngx_conf_set_flag_slot, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
377 NGX_HTTP_LOC_CONF_OFFSET, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
378 offsetof(ngx_http_proxy_loc_conf_t, upstream.socket_keepalive), |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
379 NULL }, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
380 |
507 | 381 { ngx_string("proxy_connect_timeout"), |
382 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
383 ngx_conf_set_msec_slot, | |
384 NGX_HTTP_LOC_CONF_OFFSET, | |
385 offsetof(ngx_http_proxy_loc_conf_t, upstream.connect_timeout), | |
386 NULL }, | |
387 | |
388 { ngx_string("proxy_send_timeout"), | |
389 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
390 ngx_conf_set_msec_slot, | |
391 NGX_HTTP_LOC_CONF_OFFSET, | |
392 offsetof(ngx_http_proxy_loc_conf_t, upstream.send_timeout), | |
393 NULL }, | |
394 | |
395 { ngx_string("proxy_send_lowat"), | |
396 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
397 ngx_conf_set_size_slot, | |
398 NGX_HTTP_LOC_CONF_OFFSET, | |
399 offsetof(ngx_http_proxy_loc_conf_t, upstream.send_lowat), | |
400 &ngx_http_proxy_lowat_post }, | |
401 | |
657 | 402 { ngx_string("proxy_intercept_errors"), |
403 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
404 ngx_conf_set_flag_slot, | |
405 NGX_HTTP_LOC_CONF_OFFSET, | |
406 offsetof(ngx_http_proxy_loc_conf_t, upstream.intercept_errors), | |
407 NULL }, | |
408 | |
509 | 409 { ngx_string("proxy_set_header"), |
410 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, | |
649 | 411 ngx_conf_set_keyval_slot, |
507 | 412 NGX_HTTP_LOC_CONF_OFFSET, |
509 | 413 offsetof(ngx_http_proxy_loc_conf_t, headers_source), |
507 | 414 NULL }, |
415 | |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
416 { ngx_string("proxy_headers_hash_max_size"), |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
417 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
418 ngx_conf_set_num_slot, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
419 NGX_HTTP_LOC_CONF_OFFSET, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
420 offsetof(ngx_http_proxy_loc_conf_t, headers_hash_max_size), |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
421 NULL }, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
422 |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
423 { ngx_string("proxy_headers_hash_bucket_size"), |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
424 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
425 ngx_conf_set_num_slot, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
426 NGX_HTTP_LOC_CONF_OFFSET, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
427 offsetof(ngx_http_proxy_loc_conf_t, headers_hash_bucket_size), |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
428 NULL }, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
429 |
577 | 430 { ngx_string("proxy_set_body"), |
431 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
432 ngx_conf_set_str_slot, | |
433 NGX_HTTP_LOC_CONF_OFFSET, | |
434 offsetof(ngx_http_proxy_loc_conf_t, body_source), | |
435 NULL }, | |
436 | |
509 | 437 { ngx_string("proxy_method"), |
438 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
6781
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
439 ngx_http_set_complex_value_slot, |
509 | 440 NGX_HTTP_LOC_CONF_OFFSET, |
561 | 441 offsetof(ngx_http_proxy_loc_conf_t, method), |
442 NULL }, | |
509 | 443 |
444 { ngx_string("proxy_pass_request_headers"), | |
507 | 445 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
446 ngx_conf_set_flag_slot, | |
447 NGX_HTTP_LOC_CONF_OFFSET, | |
509 | 448 offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_request_headers), |
507 | 449 NULL }, |
450 | |
509 | 451 { ngx_string("proxy_pass_request_body"), |
507 | 452 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
453 ngx_conf_set_flag_slot, | |
454 NGX_HTTP_LOC_CONF_OFFSET, | |
509 | 455 offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_request_body), |
507 | 456 NULL }, |
457 | |
581 | 458 { ngx_string("proxy_buffer_size"), |
459 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
460 ngx_conf_set_size_slot, | |
461 NGX_HTTP_LOC_CONF_OFFSET, | |
462 offsetof(ngx_http_proxy_loc_conf_t, upstream.buffer_size), | |
463 NULL }, | |
464 | |
507 | 465 { ngx_string("proxy_read_timeout"), |
466 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
467 ngx_conf_set_msec_slot, | |
468 NGX_HTTP_LOC_CONF_OFFSET, | |
469 offsetof(ngx_http_proxy_loc_conf_t, upstream.read_timeout), | |
470 NULL }, | |
471 | |
472 { ngx_string("proxy_buffers"), | |
473 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, | |
474 ngx_conf_set_bufs_slot, | |
475 NGX_HTTP_LOC_CONF_OFFSET, | |
476 offsetof(ngx_http_proxy_loc_conf_t, upstream.bufs), | |
477 NULL }, | |
478 | |
479 { ngx_string("proxy_busy_buffers_size"), | |
480 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
481 ngx_conf_set_size_slot, | |
482 NGX_HTTP_LOC_CONF_OFFSET, | |
529 | 483 offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size_conf), |
507 | 484 NULL }, |
485 | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
486 { ngx_string("proxy_force_ranges"), |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
487 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
488 ngx_conf_set_flag_slot, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
489 NGX_HTTP_LOC_CONF_OFFSET, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
490 offsetof(ngx_http_proxy_loc_conf_t, upstream.force_ranges), |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
491 NULL }, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
492 |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
493 { ngx_string("proxy_limit_rate"), |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
494 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
495 ngx_conf_set_size_slot, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
496 NGX_HTTP_LOC_CONF_OFFSET, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
497 offsetof(ngx_http_proxy_loc_conf_t, upstream.limit_rate), |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
498 NULL }, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
499 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
500 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
501 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
502 { ngx_string("proxy_cache"), |
3729 | 503 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
504 ngx_http_proxy_cache, |
2597 | 505 NGX_HTTP_LOC_CONF_OFFSET, |
2596 | 506 0, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
507 NULL }, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
508 |
2672 | 509 { ngx_string("proxy_cache_key"), |
3729 | 510 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
2672 | 511 ngx_http_proxy_cache_key, |
512 NGX_HTTP_LOC_CONF_OFFSET, | |
513 0, | |
514 NULL }, | |
515 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
516 { ngx_string("proxy_cache_path"), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
517 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
518 ngx_http_file_cache_set_slot, |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
519 NGX_HTTP_MAIN_CONF_OFFSET, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
520 offsetof(ngx_http_proxy_main_conf_t, caches), |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
521 &ngx_http_proxy_module }, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
522 |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
523 { ngx_string("proxy_cache_bypass"), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
524 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
525 ngx_http_set_predicate_slot, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
526 NGX_HTTP_LOC_CONF_OFFSET, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
527 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_bypass), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
528 NULL }, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
529 |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
530 { ngx_string("proxy_no_cache"), |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
531 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
3692
045ea40cbfe8
use ngx_http_test_predicates(), ngx_http_set_predicate_slot()
Igor Sysoev <igor@sysoev.ru>
parents:
3670
diff
changeset
|
532 ngx_http_set_predicate_slot, |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
533 NGX_HTTP_LOC_CONF_OFFSET, |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
534 offsetof(ngx_http_proxy_loc_conf_t, upstream.no_cache), |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
535 NULL }, |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
536 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
537 { ngx_string("proxy_cache_valid"), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
538 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
539 ngx_http_file_cache_valid_set_slot, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
540 NGX_HTTP_LOC_CONF_OFFSET, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
541 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_valid), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
542 NULL }, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
543 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
544 { ngx_string("proxy_cache_min_uses"), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
545 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
546 ngx_conf_set_num_slot, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
547 NGX_HTTP_LOC_CONF_OFFSET, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
548 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_min_uses), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
549 NULL }, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
550 |
6793
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
551 { ngx_string("proxy_cache_max_range_offset"), |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
552 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
553 ngx_conf_set_off_slot, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
554 NGX_HTTP_LOC_CONF_OFFSET, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
555 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_max_range_offset), |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
556 NULL }, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
557 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
558 { ngx_string("proxy_cache_use_stale"), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
559 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
560 ngx_conf_set_bitmask_slot, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
561 NGX_HTTP_LOC_CONF_OFFSET, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
562 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_use_stale), |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
563 &ngx_http_proxy_next_upstream_masks }, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
564 |
2875
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
565 { ngx_string("proxy_cache_methods"), |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
566 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
567 ngx_conf_set_bitmask_slot, |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
568 NGX_HTTP_LOC_CONF_OFFSET, |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
569 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_methods), |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
570 &ngx_http_upstream_cache_method_mask }, |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
571 |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
572 { ngx_string("proxy_cache_lock"), |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
573 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
574 ngx_conf_set_flag_slot, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
575 NGX_HTTP_LOC_CONF_OFFSET, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
576 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock), |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
577 NULL }, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
578 |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
579 { ngx_string("proxy_cache_lock_timeout"), |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
580 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
581 ngx_conf_set_msec_slot, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
582 NGX_HTTP_LOC_CONF_OFFSET, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
583 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_timeout), |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
584 NULL }, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
585 |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
586 { ngx_string("proxy_cache_lock_age"), |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
587 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
588 ngx_conf_set_msec_slot, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
589 NGX_HTTP_LOC_CONF_OFFSET, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
590 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_age), |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
591 NULL }, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
592 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
593 { ngx_string("proxy_cache_revalidate"), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
594 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
595 ngx_conf_set_flag_slot, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
596 NGX_HTTP_LOC_CONF_OFFSET, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
597 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_revalidate), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
598 NULL }, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
599 |
6290
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
600 { ngx_string("proxy_cache_convert_head"), |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
601 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
602 ngx_conf_set_flag_slot, |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
603 NGX_HTTP_LOC_CONF_OFFSET, |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
604 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_convert_head), |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
605 NULL }, |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
606 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
607 { ngx_string("proxy_cache_background_update"), |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
608 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
609 ngx_conf_set_flag_slot, |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
610 NGX_HTTP_LOC_CONF_OFFSET, |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
611 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_background_update), |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
612 NULL }, |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
613 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
614 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
615 |
507 | 616 { ngx_string("proxy_temp_path"), |
617 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, | |
618 ngx_conf_set_path_slot, | |
619 NGX_HTTP_LOC_CONF_OFFSET, | |
620 offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_path), | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
621 NULL }, |
507 | 622 |
623 { ngx_string("proxy_max_temp_file_size"), | |
624 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
625 ngx_conf_set_size_slot, | |
626 NGX_HTTP_LOC_CONF_OFFSET, | |
529 | 627 offsetof(ngx_http_proxy_loc_conf_t, upstream.max_temp_file_size_conf), |
507 | 628 NULL }, |
629 | |
630 { ngx_string("proxy_temp_file_write_size"), | |
631 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
632 ngx_conf_set_size_slot, | |
633 NGX_HTTP_LOC_CONF_OFFSET, | |
529 | 634 offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_file_write_size_conf), |
507 | 635 NULL }, |
636 | |
637 { ngx_string("proxy_next_upstream"), | |
547 | 638 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
507 | 639 ngx_conf_set_bitmask_slot, |
640 NGX_HTTP_LOC_CONF_OFFSET, | |
641 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream), | |
642 &ngx_http_proxy_next_upstream_masks }, | |
643 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
644 { ngx_string("proxy_next_upstream_tries"), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
645 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
646 ngx_conf_set_num_slot, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
647 NGX_HTTP_LOC_CONF_OFFSET, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
648 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_tries), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
649 NULL }, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
650 |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
651 { ngx_string("proxy_next_upstream_timeout"), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
652 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
653 ngx_conf_set_msec_slot, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
654 NGX_HTTP_LOC_CONF_OFFSET, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
655 offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_timeout), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
656 NULL }, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
657 |
649 | 658 { ngx_string("proxy_pass_header"), |
3729 | 659 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
649 | 660 ngx_conf_set_str_array_slot, |
507 | 661 NGX_HTTP_LOC_CONF_OFFSET, |
649 | 662 offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_headers), |
507 | 663 NULL }, |
664 | |
649 | 665 { ngx_string("proxy_hide_header"), |
3729 | 666 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
649 | 667 ngx_conf_set_str_array_slot, |
507 | 668 NGX_HTTP_LOC_CONF_OFFSET, |
649 | 669 offsetof(ngx_http_proxy_loc_conf_t, upstream.hide_headers), |
507 | 670 NULL }, |
671 | |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
672 { ngx_string("proxy_ignore_headers"), |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
673 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
674 ngx_conf_set_bitmask_slot, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
675 NGX_HTTP_LOC_CONF_OFFSET, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
676 offsetof(ngx_http_proxy_loc_conf_t, upstream.ignore_headers), |
3667
12bd9e26fadb
use shared ngx_http_upstream_ignore_headers_masks[]
Igor Sysoev <igor@sysoev.ru>
parents:
3629
diff
changeset
|
677 &ngx_http_upstream_ignore_headers_masks }, |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
678 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
679 { ngx_string("proxy_http_version"), |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
680 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
681 ngx_conf_set_enum_slot, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
682 NGX_HTTP_LOC_CONF_OFFSET, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
683 offsetof(ngx_http_proxy_loc_conf_t, http_version), |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
684 &ngx_http_proxy_http_version }, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
685 |
2184 | 686 #if (NGX_HTTP_SSL) |
687 | |
688 { ngx_string("proxy_ssl_session_reuse"), | |
689 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
690 ngx_conf_set_flag_slot, | |
691 NGX_HTTP_LOC_CONF_OFFSET, | |
692 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_session_reuse), | |
693 NULL }, | |
694 | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
695 { ngx_string("proxy_ssl_protocols"), |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
696 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
697 ngx_conf_set_bitmask_slot, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
698 NGX_HTTP_LOC_CONF_OFFSET, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
699 offsetof(ngx_http_proxy_loc_conf_t, ssl_protocols), |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
700 &ngx_http_proxy_ssl_protocols }, |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
701 |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
702 { ngx_string("proxy_ssl_ciphers"), |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
703 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
704 ngx_conf_set_str_slot, |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
705 NGX_HTTP_LOC_CONF_OFFSET, |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
706 offsetof(ngx_http_proxy_loc_conf_t, ssl_ciphers), |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
707 NULL }, |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
708 |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
709 { ngx_string("proxy_ssl_name"), |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
710 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
711 ngx_http_set_complex_value_slot, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
712 NGX_HTTP_LOC_CONF_OFFSET, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
713 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_name), |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
714 NULL }, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
715 |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
716 { ngx_string("proxy_ssl_server_name"), |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
717 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
718 ngx_conf_set_flag_slot, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
719 NGX_HTTP_LOC_CONF_OFFSET, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
720 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_server_name), |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
721 NULL }, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
722 |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
723 { ngx_string("proxy_ssl_verify"), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
724 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
725 ngx_conf_set_flag_slot, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
726 NGX_HTTP_LOC_CONF_OFFSET, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
727 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_verify), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
728 NULL }, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
729 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
730 { ngx_string("proxy_ssl_verify_depth"), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
731 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
732 ngx_conf_set_num_slot, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
733 NGX_HTTP_LOC_CONF_OFFSET, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
734 offsetof(ngx_http_proxy_loc_conf_t, ssl_verify_depth), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
735 NULL }, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
736 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
737 { ngx_string("proxy_ssl_trusted_certificate"), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
738 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
739 ngx_conf_set_str_slot, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
740 NGX_HTTP_LOC_CONF_OFFSET, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
741 offsetof(ngx_http_proxy_loc_conf_t, ssl_trusted_certificate), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
742 NULL }, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
743 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
744 { ngx_string("proxy_ssl_crl"), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
745 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
746 ngx_conf_set_str_slot, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
747 NGX_HTTP_LOC_CONF_OFFSET, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
748 offsetof(ngx_http_proxy_loc_conf_t, ssl_crl), |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
749 NULL }, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
750 |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
751 { ngx_string("proxy_ssl_certificate"), |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
752 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
753 ngx_http_set_complex_value_zero_slot, |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
754 NGX_HTTP_LOC_CONF_OFFSET, |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
755 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_certificate), |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
756 NULL }, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
757 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
758 { ngx_string("proxy_ssl_certificate_key"), |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
759 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
760 ngx_http_set_complex_value_zero_slot, |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
761 NGX_HTTP_LOC_CONF_OFFSET, |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
762 offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_certificate_key), |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
763 NULL }, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
764 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
765 { ngx_string("proxy_ssl_password_file"), |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
766 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
767 ngx_http_proxy_ssl_password_file, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
768 NGX_HTTP_LOC_CONF_OFFSET, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
769 0, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
770 NULL }, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
771 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
772 { ngx_string("proxy_ssl_conf_command"), |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
773 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
774 ngx_conf_set_keyval_slot, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
775 NGX_HTTP_LOC_CONF_OFFSET, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
776 offsetof(ngx_http_proxy_loc_conf_t, ssl_conf_commands), |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
777 &ngx_http_proxy_ssl_conf_command_post }, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
778 |
2184 | 779 #endif |
780 | |
507 | 781 ngx_null_command |
782 }; | |
783 | |
784 | |
667 | 785 static ngx_http_module_t ngx_http_proxy_module_ctx = { |
509 | 786 ngx_http_proxy_add_variables, /* preconfiguration */ |
787 NULL, /* postconfiguration */ | |
507 | 788 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
789 ngx_http_proxy_create_main_conf, /* create main configuration */ |
507 | 790 NULL, /* init main configuration */ |
791 | |
792 NULL, /* create server configuration */ | |
793 NULL, /* merge server configuration */ | |
794 | |
4499
778ef9c3fd2d
Fixed spelling in single-line comments.
Ruslan Ermilov <ru@nginx.com>
parents:
4466
diff
changeset
|
795 ngx_http_proxy_create_loc_conf, /* create location configuration */ |
778ef9c3fd2d
Fixed spelling in single-line comments.
Ruslan Ermilov <ru@nginx.com>
parents:
4466
diff
changeset
|
796 ngx_http_proxy_merge_loc_conf /* merge location configuration */ |
507 | 797 }; |
798 | |
799 | |
800 ngx_module_t ngx_http_proxy_module = { | |
509 | 801 NGX_MODULE_V1, |
507 | 802 &ngx_http_proxy_module_ctx, /* module context */ |
803 ngx_http_proxy_commands, /* module directives */ | |
804 NGX_HTTP_MODULE, /* module type */ | |
541 | 805 NULL, /* init master */ |
509 | 806 NULL, /* init module */ |
541 | 807 NULL, /* init process */ |
808 NULL, /* init thread */ | |
809 NULL, /* exit thread */ | |
810 NULL, /* exit process */ | |
811 NULL, /* exit master */ | |
812 NGX_MODULE_V1_PADDING | |
507 | 813 }; |
814 | |
815 | |
816 static char ngx_http_proxy_version[] = " HTTP/1.0" CRLF; | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
817 static char ngx_http_proxy_version_11[] = " HTTP/1.1" CRLF; |
507 | 818 |
509 | 819 |
649 | 820 static ngx_keyval_t ngx_http_proxy_headers[] = { |
821 { ngx_string("Host"), ngx_string("$proxy_host") }, | |
822 { ngx_string("Connection"), ngx_string("close") }, | |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
823 { ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") }, |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
824 { ngx_string("Transfer-Encoding"), ngx_string("$proxy_internal_chunked") }, |
5936
2d3908516101
Proxy: the "TE" header now stripped by default (ticket #537).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5910
diff
changeset
|
825 { ngx_string("TE"), ngx_string("") }, |
649 | 826 { ngx_string("Keep-Alive"), ngx_string("") }, |
2067 | 827 { ngx_string("Expect"), ngx_string("") }, |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
828 { ngx_string("Upgrade"), ngx_string("") }, |
649 | 829 { ngx_null_string, ngx_null_string } |
830 }; | |
831 | |
832 | |
2706
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
833 static ngx_str_t ngx_http_proxy_hide_headers[] = { |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
834 ngx_string("Date"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
835 ngx_string("Server"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
836 ngx_string("X-Pad"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
837 ngx_string("X-Accel-Expires"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
838 ngx_string("X-Accel-Redirect"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
839 ngx_string("X-Accel-Limit-Rate"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
840 ngx_string("X-Accel-Buffering"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
841 ngx_string("X-Accel-Charset"), |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
842 ngx_null_string |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
843 }; |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
844 |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
845 |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
846 #if (NGX_HTTP_CACHE) |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
847 |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
848 static ngx_keyval_t ngx_http_proxy_cache_headers[] = { |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
849 { ngx_string("Host"), ngx_string("$proxy_host") }, |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
850 { ngx_string("Connection"), ngx_string("close") }, |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
851 { ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") }, |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
852 { ngx_string("Transfer-Encoding"), ngx_string("$proxy_internal_chunked") }, |
5936
2d3908516101
Proxy: the "TE" header now stripped by default (ticket #537).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5910
diff
changeset
|
853 { ngx_string("TE"), ngx_string("") }, |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
854 { ngx_string("Keep-Alive"), ngx_string("") }, |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
855 { ngx_string("Expect"), ngx_string("") }, |
4276
a0f18c78db3b
Fixed Upgrade header clearing with proxy_cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4275
diff
changeset
|
856 { ngx_string("Upgrade"), ngx_string("") }, |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
857 { ngx_string("If-Modified-Since"), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
858 ngx_string("$upstream_cache_last_modified") }, |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
859 { ngx_string("If-Unmodified-Since"), ngx_string("") }, |
5738
c95d7882dfc9
Upstream: cache revalidation using If-None-Match.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5685
diff
changeset
|
860 { ngx_string("If-None-Match"), ngx_string("$upstream_cache_etag") }, |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
861 { ngx_string("If-Match"), ngx_string("") }, |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
862 { ngx_string("Range"), ngx_string("") }, |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
863 { ngx_string("If-Range"), ngx_string("") }, |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
864 { ngx_null_string, ngx_null_string } |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
865 }; |
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
866 |
2706
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
867 #endif |
f905a6ab0ca8
hide cacheable Set-Cookie and P3P response headers
Igor Sysoev <igor@sysoev.ru>
parents:
2705
diff
changeset
|
868 |
509 | 869 |
870 static ngx_http_variable_t ngx_http_proxy_vars[] = { | |
871 | |
637 | 872 { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0, |
1925
6fd26b0e1009
non cacheable $proxy_host and $proxy_port
Igor Sysoev <igor@sysoev.ru>
parents:
1912
diff
changeset
|
873 NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, |
509 | 874 |
637 | 875 { ngx_string("proxy_port"), NULL, ngx_http_proxy_port_variable, 0, |
1925
6fd26b0e1009
non cacheable $proxy_host and $proxy_port
Igor Sysoev <igor@sysoev.ru>
parents:
1912
diff
changeset
|
876 NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, |
509 | 877 |
637 | 878 { ngx_string("proxy_add_x_forwarded_for"), NULL, |
583 | 879 ngx_http_proxy_add_x_forwarded_for_variable, 0, NGX_HTTP_VAR_NOHASH, 0 }, |
509 | 880 |
881 #if 0 | |
637 | 882 { ngx_string("proxy_add_via"), NULL, NULL, 0, NGX_HTTP_VAR_NOHASH, 0 }, |
509 | 883 #endif |
884 | |
637 | 885 { ngx_string("proxy_internal_body_length"), NULL, |
5203
bfb99b75833b
Proxy: $proxy_internal_body_length fixed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5188
diff
changeset
|
886 ngx_http_proxy_internal_body_length_variable, 0, |
bfb99b75833b
Proxy: $proxy_internal_body_length fixed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5188
diff
changeset
|
887 NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, |
577 | 888 |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
889 { ngx_string("proxy_internal_chunked"), NULL, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
890 ngx_http_proxy_internal_chunked_variable, 0, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
891 NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
892 |
7077
2a288909abc6
Variables: macros for null variables.
Ruslan Ermilov <ru@nginx.com>
parents:
7047
diff
changeset
|
893 ngx_http_null_variable |
509 | 894 }; |
507 | 895 |
896 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
897 static ngx_path_init_t ngx_http_proxy_temp_path = { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
898 ngx_string(NGX_HTTP_PROXY_TEMP_PATH), { 1, 2, 0 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
899 }; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
900 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
901 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
902 static ngx_conf_bitmask_t ngx_http_proxy_cookie_flags_masks[] = { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
903 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
904 { ngx_string("secure"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
905 NGX_HTTP_PROXY_COOKIE_SECURE|NGX_HTTP_PROXY_COOKIE_SECURE_ON }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
906 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
907 { ngx_string("nosecure"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
908 NGX_HTTP_PROXY_COOKIE_SECURE|NGX_HTTP_PROXY_COOKIE_SECURE_OFF }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
909 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
910 { ngx_string("httponly"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
911 NGX_HTTP_PROXY_COOKIE_HTTPONLY|NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
912 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
913 { ngx_string("nohttponly"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
914 NGX_HTTP_PROXY_COOKIE_HTTPONLY|NGX_HTTP_PROXY_COOKIE_HTTPONLY_OFF }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
915 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
916 { ngx_string("samesite=strict"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
917 NGX_HTTP_PROXY_COOKIE_SAMESITE|NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
918 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
919 { ngx_string("samesite=lax"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
920 NGX_HTTP_PROXY_COOKIE_SAMESITE|NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
921 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
922 { ngx_string("samesite=none"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
923 NGX_HTTP_PROXY_COOKIE_SAMESITE|NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
924 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
925 { ngx_string("nosamesite"), |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
926 NGX_HTTP_PROXY_COOKIE_SAMESITE|NGX_HTTP_PROXY_COOKIE_SAMESITE_OFF }, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
927 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
928 { ngx_null_string, 0 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
929 }; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
930 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
931 |
507 | 932 static ngx_int_t |
933 ngx_http_proxy_handler(ngx_http_request_t *r) | |
577 | 934 { |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
935 ngx_int_t rc; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
936 ngx_http_upstream_t *u; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
937 ngx_http_proxy_ctx_t *ctx; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
938 ngx_http_proxy_loc_conf_t *plcf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
939 #if (NGX_HTTP_CACHE) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
940 ngx_http_proxy_main_conf_t *pmcf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
941 #endif |
577 | 942 |
3006
95972b9e790b
ngx_http_upstream_create() to cleanup the previous upstream after
Igor Sysoev <igor@sysoev.ru>
parents:
2989
diff
changeset
|
943 if (ngx_http_upstream_create(r) != NGX_OK) { |
507 | 944 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
945 } | |
577 | 946 |
1658 | 947 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t)); |
948 if (ctx == NULL) { | |
6003
cf2f8d91cf09
Proxy: use an appropriate error on memory allocation failure.
Ruslan Ermilov <ru@nginx.com>
parents:
5951
diff
changeset
|
949 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
1658 | 950 } |
951 | |
952 ngx_http_set_ctx(r, ctx, ngx_http_proxy_module); | |
953 | |
954 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); | |
955 | |
3006
95972b9e790b
ngx_http_upstream_create() to cleanup the previous upstream after
Igor Sysoev <igor@sysoev.ru>
parents:
2989
diff
changeset
|
956 u = r->upstream; |
95972b9e790b
ngx_http_upstream_create() to cleanup the previous upstream after
Igor Sysoev <igor@sysoev.ru>
parents:
2989
diff
changeset
|
957 |
3733 | 958 if (plcf->proxy_lengths == NULL) { |
1658 | 959 ctx->vars = plcf->vars; |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
960 u->schema = plcf->vars.schema; |
1658 | 961 #if (NGX_HTTP_SSL) |
962 u->ssl = (plcf->upstream.ssl != NULL); | |
963 #endif | |
964 | |
965 } else { | |
966 if (ngx_http_proxy_eval(r, ctx, plcf) != NGX_OK) { | |
967 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
968 } | |
969 } | |
970 | |
507 | 971 u->output.tag = (ngx_buf_tag_t) &ngx_http_proxy_module; |
972 | |
973 u->conf = &plcf->upstream; | |
974 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
975 #if (NGX_HTTP_CACHE) |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
976 pmcf = ngx_http_get_module_main_conf(r, ngx_http_proxy_module); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
977 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
978 u->caches = &pmcf->caches; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
979 u->create_key = ngx_http_proxy_create_key; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
980 #endif |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
981 |
507 | 982 u->create_request = ngx_http_proxy_create_request; |
983 u->reinit_request = ngx_http_proxy_reinit_request; | |
509 | 984 u->process_header = ngx_http_proxy_process_status_line; |
507 | 985 u->abort_request = ngx_http_proxy_abort_request; |
986 u->finalize_request = ngx_http_proxy_finalize_request; | |
3477
fb0b7450c2e8
reset a parsing state to parse correctly an upstream response,
Igor Sysoev <igor@sysoev.ru>
parents:
3471
diff
changeset
|
987 r->state = 0; |
507 | 988 |
509 | 989 if (plcf->redirects) { |
990 u->rewrite_redirect = ngx_http_proxy_rewrite_redirect; | |
991 } | |
992 | |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
993 if (plcf->cookie_domains || plcf->cookie_paths || plcf->cookie_flags) { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
994 u->rewrite_cookie = ngx_http_proxy_rewrite_cookie; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
995 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
996 |
649 | 997 u->buffering = plcf->upstream.buffering; |
998 | |
999 u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t)); | |
1000 if (u->pipe == NULL) { | |
1001 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
581 | 1002 } |
507 | 1003 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1004 u->pipe->input_filter = ngx_http_proxy_copy_filter; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1005 u->pipe->input_ctx = r; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1006 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1007 u->input_filter_init = ngx_http_proxy_input_filter_init; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1008 u->input_filter = ngx_http_proxy_non_buffered_copy_filter; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1009 u->input_filter_ctx = r; |
649 | 1010 |
509 | 1011 u->accel = 1; |
577 | 1012 |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1013 if (!plcf->upstream.request_buffering |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1014 && plcf->body_values == NULL && plcf->upstream.pass_request_body |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1015 && (!r->headers_in.chunked |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1016 || plcf->http_version == NGX_HTTP_VERSION_11)) |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1017 { |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1018 r->request_body_no_buffering = 1; |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1019 } |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1020 |
507 | 1021 rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); |
1022 | |
1023 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { | |
1024 return rc; | |
1025 } | |
1026 | |
1027 return NGX_DONE; | |
1028 } | |
1029 | |
1030 | |
1031 static ngx_int_t | |
1658 | 1032 ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx, |
1033 ngx_http_proxy_loc_conf_t *plcf) | |
1034 { | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1035 u_char *p; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1036 size_t add; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1037 u_short port; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1038 ngx_str_t proxy; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1039 ngx_url_t url; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1040 ngx_http_upstream_t *u; |
1658 | 1041 |
1042 if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0, | |
1043 plcf->proxy_values->elts) | |
1044 == NULL) | |
1045 { | |
1046 return NGX_ERROR; | |
1047 } | |
1048 | |
3977
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1049 if (proxy.len > 7 |
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1050 && ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0) |
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1051 { |
1658 | 1052 add = 7; |
1053 port = 80; | |
1054 | |
1055 #if (NGX_HTTP_SSL) | |
1056 | |
3977
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1057 } else if (proxy.len > 8 |
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1058 && ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0) |
2527cdb8d31f
test length of proxy_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
3976
diff
changeset
|
1059 { |
1658 | 1060 add = 8; |
1061 port = 443; | |
1062 r->upstream->ssl = 1; | |
1063 | |
1064 #endif | |
1065 | |
1066 } else { | |
1067 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1068 "invalid URL prefix in \"%V\"", &proxy); | |
1069 return NGX_ERROR; | |
1070 } | |
1071 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1072 u = r->upstream; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1073 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1074 u->schema.len = add; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1075 u->schema.data = proxy.data; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1076 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1077 ngx_memzero(&url, sizeof(ngx_url_t)); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1078 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1079 url.url.len = proxy.len - add; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1080 url.url.data = proxy.data + add; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1081 url.default_port = port; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1082 url.uri_part = 1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1083 url.no_resolve = 1; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1084 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1085 if (ngx_parse_url(r->pool, &url) != NGX_OK) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1086 if (url.err) { |
1658 | 1087 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1088 "%s in upstream \"%V\"", url.err, &url.url); |
1658 | 1089 } |
1090 | |
1091 return NGX_ERROR; | |
1092 } | |
1093 | |
3323
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1094 if (url.uri.len) { |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1095 if (url.uri.data[0] == '?') { |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1096 p = ngx_pnalloc(r->pool, url.uri.len + 1); |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1097 if (p == NULL) { |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1098 return NGX_ERROR; |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1099 } |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1100 |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1101 *p++ = '/'; |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1102 ngx_memcpy(p, url.uri.data, url.uri.len); |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1103 |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1104 url.uri.len++; |
9421e997c2c4
allow "proxy_pass http://$backend" without URI part
Igor Sysoev <igor@sysoev.ru>
parents:
3271
diff
changeset
|
1105 url.uri.data = p - 1; |
2284
c3035feb6638
fix case proxy_pass URL is evaluted to http://host?args
Igor Sysoev <igor@sysoev.ru>
parents:
2268
diff
changeset
|
1106 } |
c3035feb6638
fix case proxy_pass URL is evaluted to http://host?args
Igor Sysoev <igor@sysoev.ru>
parents:
2268
diff
changeset
|
1107 } |
c3035feb6638
fix case proxy_pass URL is evaluted to http://host?args
Igor Sysoev <igor@sysoev.ru>
parents:
2268
diff
changeset
|
1108 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1109 ctx->vars.key_start = u->schema; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1110 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1111 ngx_http_proxy_set_vars(&url, &ctx->vars); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1112 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1113 u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1114 if (u->resolved == NULL) { |
1658 | 1115 return NGX_ERROR; |
1116 } | |
1117 | |
6784
1af120241cde
Upstream: removed unnecessary condition in proxy_eval() and friends.
Ruslan Ermilov <ru@nginx.com>
parents:
6781
diff
changeset
|
1118 if (url.addrs) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1119 u->resolved->sockaddr = url.addrs[0].sockaddr; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1120 u->resolved->socklen = url.addrs[0].socklen; |
6785
d1d0dd69a419
Upstream: added the ngx_http_upstream_resolved_t.name field.
Ruslan Ermilov <ru@nginx.com>
parents:
6784
diff
changeset
|
1121 u->resolved->name = url.addrs[0].name; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1122 u->resolved->naddrs = 1; |
2422
7af1e5fe102c
variable support for unix sockets in fastcgi_pass and proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
2391
diff
changeset
|
1123 } |
1658 | 1124 |
6785
d1d0dd69a419
Upstream: added the ngx_http_upstream_resolved_t.name field.
Ruslan Ermilov <ru@nginx.com>
parents:
6784
diff
changeset
|
1125 u->resolved->host = url.host; |
6303
a93345ee8f52
Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents:
6290
diff
changeset
|
1126 u->resolved->port = (in_port_t) (url.no_port ? port : url.port); |
a93345ee8f52
Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents:
6290
diff
changeset
|
1127 u->resolved->no_port = url.no_port; |
a93345ee8f52
Upstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov <ru@nginx.com>
parents:
6290
diff
changeset
|
1128 |
1658 | 1129 return NGX_OK; |
1130 } | |
1131 | |
1132 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1133 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1134 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1135 static ngx_int_t |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1136 ngx_http_proxy_create_key(ngx_http_request_t *r) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1137 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1138 size_t len, loc_len; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1139 u_char *p; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1140 uintptr_t escape; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1141 ngx_str_t *key; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1142 ngx_http_upstream_t *u; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1143 ngx_http_proxy_ctx_t *ctx; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1144 ngx_http_proxy_loc_conf_t *plcf; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1145 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1146 u = r->upstream; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1147 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1148 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1149 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1150 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1151 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1152 key = ngx_array_push(&r->cache->keys); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1153 if (key == NULL) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1154 return NGX_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1155 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1156 |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4927
diff
changeset
|
1157 if (plcf->cache_key.value.data) { |
2672 | 1158 |
1159 if (ngx_http_complex_value(r, &plcf->cache_key, key) != NGX_OK) { | |
1160 return NGX_ERROR; | |
1161 } | |
1162 | |
1163 return NGX_OK; | |
1164 } | |
1165 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1166 *key = ctx->vars.key_start; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1167 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1168 key = ngx_array_push(&r->cache->keys); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1169 if (key == NULL) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1170 return NGX_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1171 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1172 |
4377
726a1ca9b52b
Proxy: made proxy_pass with variables more consistent.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4336
diff
changeset
|
1173 if (plcf->proxy_lengths && ctx->vars.uri.len) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1174 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1175 *key = ctx->vars.uri; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1176 u->uri = ctx->vars.uri; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1177 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1178 return NGX_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1179 |
7167
8530aea9aa50
Proxy: simplified conditions of using unparsed uri.
Roman Arutyunyan <arut@nginx.com>
parents:
7077
diff
changeset
|
1180 } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1181 *key = r->unparsed_uri; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1182 u->uri = r->unparsed_uri; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1183 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1184 return NGX_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1185 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1186 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1187 loc_len = (r->valid_location && ctx->vars.uri.len) ? plcf->location.len : 0; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1188 |
7881
52338ddf9e2f
Disabled spaces in URIs (ticket #196).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7833
diff
changeset
|
1189 if (r->quoted_uri || r->internal) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1190 escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1191 r->uri.len - loc_len, NGX_ESCAPE_URI); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1192 } else { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1193 escape = 0; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1194 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1195 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1196 len = ctx->vars.uri.len + r->uri.len - loc_len + escape |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1197 + sizeof("?") - 1 + r->args.len; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1198 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1199 p = ngx_pnalloc(r->pool, len); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1200 if (p == NULL) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1201 return NGX_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1202 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1203 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1204 key->data = p; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1205 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1206 if (r->valid_location) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1207 p = ngx_copy(p, ctx->vars.uri.data, ctx->vars.uri.len); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1208 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1209 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1210 if (escape) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1211 ngx_escape_uri(p, r->uri.data + loc_len, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1212 r->uri.len - loc_len, NGX_ESCAPE_URI); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1213 p += r->uri.len - loc_len + escape; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1214 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1215 } else { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1216 p = ngx_copy(p, r->uri.data + loc_len, r->uri.len - loc_len); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1217 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1218 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1219 if (r->args.len > 0) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1220 *p++ = '?'; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1221 p = ngx_copy(p, r->args.data, r->args.len); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1222 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1223 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1224 key->len = p - key->data; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1225 u->uri = *key; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1226 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1227 return NGX_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1228 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1229 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1230 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1231 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1232 |
1658 | 1233 static ngx_int_t |
507 | 1234 ngx_http_proxy_create_request(ngx_http_request_t *r) |
1235 { | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1236 size_t len, uri_len, loc_len, body_len, |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1237 key_len, val_len; |
509 | 1238 uintptr_t escape; |
1239 ngx_buf_t *b; | |
649 | 1240 ngx_str_t method; |
1241 ngx_uint_t i, unparsed_uri; | |
509 | 1242 ngx_chain_t *cl, *body; |
1243 ngx_list_part_t *part; | |
1244 ngx_table_elt_t *header; | |
1245 ngx_http_upstream_t *u; | |
1658 | 1246 ngx_http_proxy_ctx_t *ctx; |
509 | 1247 ngx_http_script_code_pt code; |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1248 ngx_http_proxy_headers_t *headers; |
509 | 1249 ngx_http_script_engine_t e, le; |
1250 ngx_http_proxy_loc_conf_t *plcf; | |
1251 ngx_http_script_len_code_pt lcode; | |
507 | 1252 |
1253 u = r->upstream; | |
1254 | |
1255 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); | |
1256 | |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1257 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1258 headers = u->cacheable ? &plcf->headers_cache : &plcf->headers; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1259 #else |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1260 headers = &plcf->headers; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1261 #endif |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1262 |
561 | 1263 if (u->method.len) { |
1264 /* HEAD was changed to GET to cache response */ | |
1265 method = u->method; | |
1266 | |
6781
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
1267 } else if (plcf->method) { |
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
1268 if (ngx_http_complex_value(r, plcf->method, &method) != NGX_OK) { |
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
1269 return NGX_ERROR; |
ca27074f8f0f
Proxy: support variables for proxy_method directive.
Dmitry Lazurkin <dilaz03@gmail.com>
parents:
6747
diff
changeset
|
1270 } |
561 | 1271 |
507 | 1272 } else { |
561 | 1273 method = r->method_name; |
507 | 1274 } |
1275 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1276 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1277 |
6311
44122bddd9a1
Proxy: improved code readability.
Ruslan Ermilov <ru@nginx.com>
parents:
6303
diff
changeset
|
1278 if (method.len == 4 |
44122bddd9a1
Proxy: improved code readability.
Ruslan Ermilov <ru@nginx.com>
parents:
6303
diff
changeset
|
1279 && ngx_strncasecmp(method.data, (u_char *) "HEAD", 4) == 0) |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1280 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1281 ctx->head = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1282 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1283 |
6311
44122bddd9a1
Proxy: improved code readability.
Ruslan Ermilov <ru@nginx.com>
parents:
6303
diff
changeset
|
1284 len = method.len + 1 + sizeof(ngx_http_proxy_version) - 1 |
44122bddd9a1
Proxy: improved code readability.
Ruslan Ermilov <ru@nginx.com>
parents:
6303
diff
changeset
|
1285 + sizeof(CRLF) - 1; |
1667 | 1286 |
507 | 1287 escape = 0; |
1658 | 1288 loc_len = 0; |
1289 unparsed_uri = 0; | |
1290 | |
4377
726a1ca9b52b
Proxy: made proxy_pass with variables more consistent.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4336
diff
changeset
|
1291 if (plcf->proxy_lengths && ctx->vars.uri.len) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1292 uri_len = ctx->vars.uri.len; |
1658 | 1293 |
7167
8530aea9aa50
Proxy: simplified conditions of using unparsed uri.
Roman Arutyunyan <arut@nginx.com>
parents:
7077
diff
changeset
|
1294 } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri) { |
609 | 1295 unparsed_uri = 1; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1296 uri_len = r->unparsed_uri.len; |
507 | 1297 |
1298 } else { | |
1658 | 1299 loc_len = (r->valid_location && ctx->vars.uri.len) ? |
1300 plcf->location.len : 0; | |
1301 | |
7881
52338ddf9e2f
Disabled spaces in URIs (ticket #196).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7833
diff
changeset
|
1302 if (r->quoted_uri || r->internal) { |
509 | 1303 escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len, |
1304 r->uri.len - loc_len, NGX_ESCAPE_URI); | |
507 | 1305 } |
1306 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1307 uri_len = ctx->vars.uri.len + r->uri.len - loc_len + escape |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1308 + sizeof("?") - 1 + r->args.len; |
507 | 1309 } |
1310 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1311 if (uri_len == 0) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1312 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1313 "zero length URI to proxy"); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1314 return NGX_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1315 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1316 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1317 len += uri_len; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1318 |
5211
ecd762770729
Proxy: clear script engine used to calculate lengths.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5203
diff
changeset
|
1319 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
ecd762770729
Proxy: clear script engine used to calculate lengths.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5203
diff
changeset
|
1320 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1321 ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes); |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1322 ngx_http_script_flush_no_cacheable_variables(r, headers->flushes); |
573 | 1323 |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
1324 if (plcf->body_lengths) { |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
1325 le.ip = plcf->body_lengths->elts; |
577 | 1326 le.request = r; |
1327 le.flushed = 1; | |
1328 body_len = 0; | |
1329 | |
1330 while (*(uintptr_t *) le.ip) { | |
1331 lcode = *(ngx_http_script_len_code_pt *) le.ip; | |
1332 body_len += lcode(&le); | |
1333 } | |
1334 | |
1658 | 1335 ctx->internal_body_length = body_len; |
577 | 1336 len += body_len; |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
1337 |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1338 } else if (r->headers_in.chunked && r->reading_body) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1339 ctx->internal_body_length = -1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1340 ctx->internal_chunked = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1341 |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
1342 } else { |
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
1343 ctx->internal_body_length = r->headers_in.content_length_n; |
577 | 1344 } |
1345 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1346 le.ip = headers->lengths->elts; |
509 | 1347 le.request = r; |
573 | 1348 le.flushed = 1; |
507 | 1349 |
509 | 1350 while (*(uintptr_t *) le.ip) { |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1351 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1352 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1353 key_len = lcode(&le); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1354 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1355 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { |
509 | 1356 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
1357 } | |
1358 le.ip += sizeof(uintptr_t); | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1359 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1360 if (val_len == 0) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1361 continue; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1362 } |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1363 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1364 len += key_len + sizeof(": ") - 1 + val_len + sizeof(CRLF) - 1; |
507 | 1365 } |
1366 | |
1367 | |
509 | 1368 if (plcf->upstream.pass_request_headers) { |
1369 part = &r->headers_in.headers.part; | |
1370 header = part->elts; | |
1371 | |
1372 for (i = 0; /* void */; i++) { | |
507 | 1373 |
509 | 1374 if (i >= part->nelts) { |
1375 if (part->next == NULL) { | |
1376 break; | |
1377 } | |
1378 | |
1379 part = part->next; | |
1380 header = part->elts; | |
577 | 1381 i = 0; |
507 | 1382 } |
1383 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1384 if (ngx_hash_find(&headers->hash, header[i].hash, |
649 | 1385 header[i].lowcase_key, header[i].key.len)) |
509 | 1386 { |
1387 continue; | |
1388 } | |
1389 | |
1390 len += header[i].key.len + sizeof(": ") - 1 | |
1391 + header[i].value.len + sizeof(CRLF) - 1; | |
507 | 1392 } |
509 | 1393 } |
507 | 1394 |
1395 | |
1396 b = ngx_create_temp_buf(r->pool, len); | |
1397 if (b == NULL) { | |
1398 return NGX_ERROR; | |
1399 } | |
1400 | |
1401 cl = ngx_alloc_chain_link(r->pool); | |
1402 if (cl == NULL) { | |
1403 return NGX_ERROR; | |
1404 } | |
1405 | |
1406 cl->buf = b; | |
1407 | |
1408 | |
1409 /* the request line */ | |
1410 | |
573 | 1411 b->last = ngx_copy(b->last, method.data, method.len); |
6311
44122bddd9a1
Proxy: improved code readability.
Ruslan Ermilov <ru@nginx.com>
parents:
6303
diff
changeset
|
1412 *b->last++ = ' '; |
507 | 1413 |
555 | 1414 u->uri.data = b->last; |
1415 | |
4377
726a1ca9b52b
Proxy: made proxy_pass with variables more consistent.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4336
diff
changeset
|
1416 if (plcf->proxy_lengths && ctx->vars.uri.len) { |
1658 | 1417 b->last = ngx_copy(b->last, ctx->vars.uri.data, ctx->vars.uri.len); |
1418 | |
1419 } else if (unparsed_uri) { | |
573 | 1420 b->last = ngx_copy(b->last, r->unparsed_uri.data, r->unparsed_uri.len); |
1421 | |
507 | 1422 } else { |
555 | 1423 if (r->valid_location) { |
1658 | 1424 b->last = ngx_copy(b->last, ctx->vars.uri.data, ctx->vars.uri.len); |
555 | 1425 } |
551 | 1426 |
507 | 1427 if (escape) { |
509 | 1428 ngx_escape_uri(b->last, r->uri.data + loc_len, |
1429 r->uri.len - loc_len, NGX_ESCAPE_URI); | |
1430 b->last += r->uri.len - loc_len + escape; | |
507 | 1431 |
577 | 1432 } else { |
573 | 1433 b->last = ngx_copy(b->last, r->uri.data + loc_len, |
1434 r->uri.len - loc_len); | |
507 | 1435 } |
1436 | |
1437 if (r->args.len > 0) { | |
1438 *b->last++ = '?'; | |
573 | 1439 b->last = ngx_copy(b->last, r->args.data, r->args.len); |
507 | 1440 } |
1441 } | |
1442 | |
555 | 1443 u->uri.len = b->last - u->uri.data; |
1444 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1445 if (plcf->http_version == NGX_HTTP_VERSION_11) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1446 b->last = ngx_cpymem(b->last, ngx_http_proxy_version_11, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1447 sizeof(ngx_http_proxy_version_11) - 1); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1448 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1449 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1450 b->last = ngx_cpymem(b->last, ngx_http_proxy_version, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1451 sizeof(ngx_http_proxy_version) - 1); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1452 } |
507 | 1453 |
577 | 1454 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); |
507 | 1455 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1456 e.ip = headers->values->elts; |
507 | 1457 e.pos = b->last; |
509 | 1458 e.request = r; |
573 | 1459 e.flushed = 1; |
507 | 1460 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1461 le.ip = headers->lengths->elts; |
509 | 1462 |
1463 while (*(uintptr_t *) le.ip) { | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1464 |
509 | 1465 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
515 | 1466 (void) lcode(&le); |
509 | 1467 |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1468 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1469 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1470 } |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1471 le.ip += sizeof(uintptr_t); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1472 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1473 if (val_len == 0) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1474 e.skip = 1; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1475 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1476 while (*(uintptr_t *) e.ip) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1477 code = *(ngx_http_script_code_pt *) e.ip; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1478 code((ngx_http_script_engine_t *) &e); |
509 | 1479 } |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1480 e.ip += sizeof(uintptr_t); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1481 |
509 | 1482 e.skip = 0; |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1483 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1484 continue; |
509 | 1485 } |
1486 | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1487 code = *(ngx_http_script_code_pt *) e.ip; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1488 code((ngx_http_script_engine_t *) &e); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1489 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1490 *e.pos++ = ':'; *e.pos++ = ' '; |
509 | 1491 |
1492 while (*(uintptr_t *) e.ip) { | |
1493 code = *(ngx_http_script_code_pt *) e.ip; | |
1494 code((ngx_http_script_engine_t *) &e); | |
577 | 1495 } |
509 | 1496 e.ip += sizeof(uintptr_t); |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1497 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
1498 *e.pos++ = CR; *e.pos++ = LF; |
507 | 1499 } |
1500 | |
1501 b->last = e.pos; | |
1502 | |
1503 | |
509 | 1504 if (plcf->upstream.pass_request_headers) { |
1505 part = &r->headers_in.headers.part; | |
1506 header = part->elts; | |
577 | 1507 |
509 | 1508 for (i = 0; /* void */; i++) { |
507 | 1509 |
509 | 1510 if (i >= part->nelts) { |
1511 if (part->next == NULL) { | |
1512 break; | |
1513 } | |
1514 | |
1515 part = part->next; | |
1516 header = part->elts; | |
577 | 1517 i = 0; |
507 | 1518 } |
1519 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1520 if (ngx_hash_find(&headers->hash, header[i].hash, |
649 | 1521 header[i].lowcase_key, header[i].key.len)) |
509 | 1522 { |
1523 continue; | |
1524 } | |
507 | 1525 |
573 | 1526 b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len); |
507 | 1527 |
509 | 1528 *b->last++ = ':'; *b->last++ = ' '; |
507 | 1529 |
573 | 1530 b->last = ngx_copy(b->last, header[i].value.data, |
1531 header[i].value.len); | |
507 | 1532 |
509 | 1533 *b->last++ = CR; *b->last++ = LF; |
507 | 1534 |
509 | 1535 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1536 "http proxy header: \"%V: %V\"", | |
1537 &header[i].key, &header[i].value); | |
1538 } | |
507 | 1539 } |
1540 | |
577 | 1541 |
507 | 1542 /* add "\r\n" at the header end */ |
1543 *b->last++ = CR; *b->last++ = LF; | |
1544 | |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
1545 if (plcf->body_values) { |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
1546 e.ip = plcf->body_values->elts; |
577 | 1547 e.pos = b->last; |
6043
613b14b305c7
Proxy: fixed proxy_set_body with proxy_cache.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6003
diff
changeset
|
1548 e.skip = 0; |
577 | 1549 |
1550 while (*(uintptr_t *) e.ip) { | |
1551 code = *(ngx_http_script_code_pt *) e.ip; | |
1552 code((ngx_http_script_engine_t *) &e); | |
1553 } | |
579 | 1554 |
1555 b->last = e.pos; | |
577 | 1556 } |
1557 | |
1774 | 1558 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
5685
0cbefdcf82a6
Style: use %N instead of '\n' where appropriate.
Ruslan Ermilov <ru@nginx.com>
parents:
5676
diff
changeset
|
1559 "http proxy header:%N\"%*s\"", |
1774 | 1560 (size_t) (b->last - b->pos), b->pos); |
507 | 1561 |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1562 if (r->request_body_no_buffering) { |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1563 |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1564 u->request_bufs = cl; |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1565 |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1566 if (ctx->internal_chunked) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1567 u->output.output_filter = ngx_http_proxy_body_output_filter; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1568 u->output.filter_ctx = r; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1569 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1570 |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
1571 } else if (plcf->body_values == NULL && plcf->upstream.pass_request_body) { |
509 | 1572 |
1573 body = u->request_bufs; | |
1574 u->request_bufs = cl; | |
1575 | |
1576 while (body) { | |
1577 b = ngx_alloc_buf(r->pool); | |
1578 if (b == NULL) { | |
1579 return NGX_ERROR; | |
1580 } | |
1581 | |
1582 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t)); | |
1583 | |
1584 cl->next = ngx_alloc_chain_link(r->pool); | |
1585 if (cl->next == NULL) { | |
1586 return NGX_ERROR; | |
1587 } | |
1588 | |
1589 cl = cl->next; | |
1590 cl->buf = b; | |
1591 | |
1592 body = body->next; | |
1593 } | |
1594 | |
1595 } else { | |
1596 u->request_bufs = cl; | |
1597 } | |
1598 | |
4009
3183165283cc
Fixing proxy_set_body and proxy_pass_request_body with SSL.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3977
diff
changeset
|
1599 b->flush = 1; |
509 | 1600 cl->next = NULL; |
1601 | |
507 | 1602 return NGX_OK; |
1603 } | |
1604 | |
1605 | |
1606 static ngx_int_t | |
1607 ngx_http_proxy_reinit_request(ngx_http_request_t *r) | |
1608 { | |
1658 | 1609 ngx_http_proxy_ctx_t *ctx; |
1610 | |
1611 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
1612 | |
1613 if (ctx == NULL) { | |
509 | 1614 return NGX_OK; |
1615 } | |
1616 | |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1617 ctx->status.code = 0; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1618 ctx->status.count = 0; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1619 ctx->status.start = NULL; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1620 ctx->status.end = NULL; |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
1621 ctx->chunked.state = 0; |
509 | 1622 |
1623 r->upstream->process_header = ngx_http_proxy_process_status_line; | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1624 r->upstream->pipe->input_filter = ngx_http_proxy_copy_filter; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1625 r->upstream->input_filter = ngx_http_proxy_non_buffered_copy_filter; |
3477
fb0b7450c2e8
reset a parsing state to parse correctly an upstream response,
Igor Sysoev <igor@sysoev.ru>
parents:
3471
diff
changeset
|
1626 r->state = 0; |
509 | 1627 |
1628 return NGX_OK; | |
1629 } | |
1630 | |
1631 | |
1632 static ngx_int_t | |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1633 ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in) |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1634 { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1635 ngx_http_request_t *r = data; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1636 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1637 off_t size; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1638 u_char *chunk; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1639 ngx_int_t rc; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1640 ngx_buf_t *b; |
6056
24ccec3c4a87
Proxy: fixed proxy_request_buffering and chunked with preread body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6051
diff
changeset
|
1641 ngx_chain_t *out, *cl, *tl, **ll, **fl; |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1642 ngx_http_proxy_ctx_t *ctx; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1643 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1644 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1645 "proxy output filter"); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1646 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1647 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1648 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1649 if (in == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1650 out = in; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1651 goto out; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1652 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1653 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1654 out = NULL; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1655 ll = &out; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1656 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1657 if (!ctx->header_sent) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1658 /* first buffer contains headers, pass it unmodified */ |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1659 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1660 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1661 "proxy output header"); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1662 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1663 ctx->header_sent = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1664 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1665 tl = ngx_alloc_chain_link(r->pool); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1666 if (tl == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1667 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1668 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1669 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1670 tl->buf = in->buf; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1671 *ll = tl; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1672 ll = &tl->next; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1673 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1674 in = in->next; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1675 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1676 if (in == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1677 tl->next = NULL; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1678 goto out; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1679 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1680 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1681 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1682 size = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1683 cl = in; |
6056
24ccec3c4a87
Proxy: fixed proxy_request_buffering and chunked with preread body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6051
diff
changeset
|
1684 fl = ll; |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1685 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1686 for ( ;; ) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1687 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6480 | 1688 "proxy output chunk: %O", ngx_buf_size(cl->buf)); |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1689 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1690 size += ngx_buf_size(cl->buf); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1691 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1692 if (cl->buf->flush |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1693 || cl->buf->sync |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1694 || ngx_buf_in_memory(cl->buf) |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1695 || cl->buf->in_file) |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1696 { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1697 tl = ngx_alloc_chain_link(r->pool); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1698 if (tl == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1699 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1700 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1701 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1702 tl->buf = cl->buf; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1703 *ll = tl; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1704 ll = &tl->next; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1705 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1706 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1707 if (cl->next == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1708 break; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1709 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1710 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1711 cl = cl->next; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1712 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1713 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1714 if (size) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1715 tl = ngx_chain_get_free_buf(r->pool, &ctx->free); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1716 if (tl == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1717 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1718 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1719 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1720 b = tl->buf; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1721 chunk = b->start; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1722 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1723 if (chunk == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1724 /* the "0000000000000000" is 64-bit hexadecimal string */ |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1725 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1726 chunk = ngx_palloc(r->pool, sizeof("0000000000000000" CRLF) - 1); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1727 if (chunk == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1728 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1729 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1730 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1731 b->start = chunk; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1732 b->end = chunk + sizeof("0000000000000000" CRLF) - 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1733 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1734 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1735 b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1736 b->memory = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1737 b->temporary = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1738 b->pos = chunk; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1739 b->last = ngx_sprintf(chunk, "%xO" CRLF, size); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1740 |
6056
24ccec3c4a87
Proxy: fixed proxy_request_buffering and chunked with preread body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6051
diff
changeset
|
1741 tl->next = *fl; |
24ccec3c4a87
Proxy: fixed proxy_request_buffering and chunked with preread body.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6051
diff
changeset
|
1742 *fl = tl; |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1743 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1744 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1745 if (cl->buf->last_buf) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1746 tl = ngx_chain_get_free_buf(r->pool, &ctx->free); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1747 if (tl == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1748 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1749 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1750 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1751 b = tl->buf; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1752 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1753 b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1754 b->temporary = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1755 b->memory = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1756 b->last_buf = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1757 b->pos = (u_char *) CRLF "0" CRLF CRLF; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1758 b->last = b->pos + 7; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1759 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1760 cl->buf->last_buf = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1761 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1762 *ll = tl; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1763 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1764 if (size == 0) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1765 b->pos += 2; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1766 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1767 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1768 } else if (size > 0) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1769 tl = ngx_chain_get_free_buf(r->pool, &ctx->free); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1770 if (tl == NULL) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1771 return NGX_ERROR; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1772 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1773 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1774 b = tl->buf; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1775 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1776 b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1777 b->temporary = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1778 b->memory = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1779 b->pos = (u_char *) CRLF; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1780 b->last = b->pos + 2; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1781 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1782 *ll = tl; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1783 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1784 } else { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1785 *ll = NULL; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1786 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1787 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1788 out: |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1789 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1790 rc = ngx_chain_writer(&r->upstream->writer, out); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1791 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1792 ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &out, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1793 (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1794 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1795 return rc; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1796 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1797 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1798 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
1799 static ngx_int_t |
509 | 1800 ngx_http_proxy_process_status_line(ngx_http_request_t *r) |
1801 { | |
3628 | 1802 size_t len; |
509 | 1803 ngx_int_t rc; |
1804 ngx_http_upstream_t *u; | |
1658 | 1805 ngx_http_proxy_ctx_t *ctx; |
1806 | |
1807 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
1808 | |
1809 if (ctx == NULL) { | |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1810 return NGX_ERROR; |
509 | 1811 } |
1812 | |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1813 u = r->upstream; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1814 |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1815 rc = ngx_http_parse_status_line(r, &u->buffer, &ctx->status); |
509 | 1816 |
1817 if (rc == NGX_AGAIN) { | |
1818 return rc; | |
1819 } | |
1820 | |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1821 if (rc == NGX_ERROR) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1822 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1823 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1824 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1825 if (r->cache) { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1826 r->http_version = NGX_HTTP_VERSION_9; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1827 return NGX_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1828 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1829 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1830 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1831 |
509 | 1832 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
577 | 1833 "upstream sent no valid HTTP/1.0 header"); |
509 | 1834 |
619 | 1835 #if 0 |
509 | 1836 if (u->accel) { |
1837 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
1838 } | |
619 | 1839 #endif |
509 | 1840 |
1841 r->http_version = NGX_HTTP_VERSION_9; | |
1616 | 1842 u->state->status = NGX_HTTP_OK; |
4125
e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4009
diff
changeset
|
1843 u->headers_in.connection_close = 1; |
577 | 1844 |
509 | 1845 return NGX_OK; |
1846 } | |
1847 | |
5575
d15822784cf9
Upstream: fix $upstream_status variable.
Piotr Sikora <piotr@cloudflare.com>
parents:
5466
diff
changeset
|
1848 if (u->state && u->state->status == 0) { |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1849 u->state->status = ctx->status.code; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1850 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
1851 |
3627
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1852 u->headers_in.status_n = ctx->status.code; |
9061fdb2ed8c
use ngx_http_parse_status_line()
Igor Sysoev <igor@sysoev.ru>
parents:
3615
diff
changeset
|
1853 |
3628 | 1854 len = ctx->status.end - ctx->status.start; |
1855 u->headers_in.status_line.len = len; | |
1856 | |
1857 u->headers_in.status_line.data = ngx_pnalloc(r->pool, len); | |
529 | 1858 if (u->headers_in.status_line.data == NULL) { |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1859 return NGX_ERROR; |
509 | 1860 } |
573 | 1861 |
3628 | 1862 ngx_memcpy(u->headers_in.status_line.data, ctx->status.start, len); |
509 | 1863 |
1864 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1865 "http proxy status %ui \"%V\"", | |
936 | 1866 u->headers_in.status_n, &u->headers_in.status_line); |
509 | 1867 |
4125
e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4009
diff
changeset
|
1868 if (ctx->status.http_version < NGX_HTTP_VERSION_11) { |
e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4009
diff
changeset
|
1869 u->headers_in.connection_close = 1; |
e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4009
diff
changeset
|
1870 } |
e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4009
diff
changeset
|
1871 |
509 | 1872 u->process_header = ngx_http_proxy_process_header; |
1873 | |
1874 return ngx_http_proxy_process_header(r); | |
1875 } | |
1876 | |
1877 | |
1878 static ngx_int_t | |
507 | 1879 ngx_http_proxy_process_header(ngx_http_request_t *r) |
1880 { | |
509 | 1881 ngx_int_t rc; |
1882 ngx_table_elt_t *h; | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1883 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1884 ngx_http_proxy_ctx_t *ctx; |
509 | 1885 ngx_http_upstream_header_t *hh; |
1886 ngx_http_upstream_main_conf_t *umcf; | |
1887 | |
1888 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); | |
1889 | |
2024 | 1890 for ( ;; ) { |
509 | 1891 |
2256 | 1892 rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1); |
509 | 1893 |
1894 if (rc == NGX_OK) { | |
1895 | |
1896 /* a header line has been parsed successfully */ | |
507 | 1897 |
509 | 1898 h = ngx_list_push(&r->upstream->headers_in.headers); |
1899 if (h == NULL) { | |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1900 return NGX_ERROR; |
509 | 1901 } |
1902 | |
1903 h->hash = r->header_hash; | |
1904 | |
1905 h->key.len = r->header_name_end - r->header_name_start; | |
1906 h->value.len = r->header_end - r->header_start; | |
1907 | |
2049 | 1908 h->key.data = ngx_pnalloc(r->pool, |
649 | 1909 h->key.len + 1 + h->value.len + 1 + h->key.len); |
509 | 1910 if (h->key.data == NULL) { |
7001
08537eab4f23
Upstream: fixed u->headers_in.headers allocation error handling.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6981
diff
changeset
|
1911 h->hash = 0; |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1912 return NGX_ERROR; |
509 | 1913 } |
1914 | |
1915 h->value.data = h->key.data + h->key.len + 1; | |
649 | 1916 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; |
507 | 1917 |
4529
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4499
diff
changeset
|
1918 ngx_memcpy(h->key.data, r->header_name_start, h->key.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4499
diff
changeset
|
1919 h->key.data[h->key.len] = '\0'; |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4499
diff
changeset
|
1920 ngx_memcpy(h->value.data, r->header_start, h->value.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4499
diff
changeset
|
1921 h->value.data[h->value.len] = '\0'; |
509 | 1922 |
649 | 1923 if (h->key.len == r->lowcase_index) { |
1924 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); | |
1925 | |
1926 } else { | |
2135 | 1927 ngx_strlow(h->lowcase_key, h->key.data, h->key.len); |
509 | 1928 } |
1929 | |
649 | 1930 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, |
1931 h->lowcase_key, h->key.len); | |
1932 | |
1933 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { | |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1934 return NGX_ERROR; |
649 | 1935 } |
1936 | |
509 | 1937 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1938 "http proxy header: \"%V: %V\"", | |
1939 &h->key, &h->value); | |
1940 | |
1941 continue; | |
1942 } | |
1943 | |
1944 if (rc == NGX_HTTP_PARSE_HEADER_DONE) { | |
1945 | |
1946 /* a whole header has been parsed successfully */ | |
1947 | |
1948 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1949 "http proxy header done"); | |
1950 | |
649 | 1951 /* |
1952 * if no "Server" and "Date" in header line, | |
1953 * then add the special empty headers | |
1954 */ | |
1955 | |
1956 if (r->upstream->headers_in.server == NULL) { | |
1957 h = ngx_list_push(&r->upstream->headers_in.headers); | |
1958 if (h == NULL) { | |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1959 return NGX_ERROR; |
649 | 1960 } |
1961 | |
1962 h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash( | |
1963 ngx_hash('s', 'e'), 'r'), 'v'), 'e'), 'r'); | |
1964 | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1965 ngx_str_set(&h->key, "Server"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1966 ngx_str_null(&h->value); |
649 | 1967 h->lowcase_key = (u_char *) "server"; |
1968 } | |
1969 | |
1970 if (r->upstream->headers_in.date == NULL) { | |
1971 h = ngx_list_push(&r->upstream->headers_in.headers); | |
1972 if (h == NULL) { | |
1699
976db8c6fb64
return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
Igor Sysoev <igor@sysoev.ru>
parents:
1688
diff
changeset
|
1973 return NGX_ERROR; |
649 | 1974 } |
1975 | |
1976 h->hash = ngx_hash(ngx_hash(ngx_hash('d', 'a'), 't'), 'e'); | |
1977 | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1978 ngx_str_set(&h->key, "Date"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1979 ngx_str_null(&h->value); |
649 | 1980 h->lowcase_key = (u_char *) "date"; |
1981 } | |
1982 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1983 /* clear content length if response is chunked */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1984 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1985 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1986 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1987 if (u->headers_in.chunked) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1988 u->headers_in.content_length_n = -1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1989 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1990 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1991 /* |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1992 * set u->keepalive if response has no body; this allows to keep |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1993 * connections alive in case of r->header_only or X-Accel-Redirect |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1994 */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1995 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1996 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1997 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1998 if (u->headers_in.status_n == NGX_HTTP_NO_CONTENT |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1999 || u->headers_in.status_n == NGX_HTTP_NOT_MODIFIED |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2000 || ctx->head |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2001 || (!u->headers_in.chunked |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2002 && u->headers_in.content_length_n == 0)) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2003 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2004 u->keepalive = !u->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2005 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2006 |
5072
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2007 if (u->headers_in.status_n == NGX_HTTP_SWITCHING_PROTOCOLS) { |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2008 u->keepalive = 0; |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2009 |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2010 if (r->headers_in.upgrade) { |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2011 u->upgrade = 1; |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2012 } |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2013 } |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2014 |
509 | 2015 return NGX_OK; |
2016 } | |
2017 | |
521 | 2018 if (rc == NGX_AGAIN) { |
2019 return NGX_AGAIN; | |
2020 } | |
2021 | |
7884
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2022 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2023 |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2024 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2025 "upstream sent invalid header: \"%*s\\x%02xd...\"", |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2026 r->header_end - r->header_name_start, |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2027 r->header_name_start, *r->header_end); |
509 | 2028 |
2029 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
2030 } | |
507 | 2031 } |
2032 | |
2033 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2034 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2035 ngx_http_proxy_input_filter_init(void *data) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2036 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2037 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2038 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2039 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2040 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2041 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2042 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2043 |
4602
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2044 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2045 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2046 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2047 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2048 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6480 | 2049 "http proxy filter init s:%ui h:%d c:%d l:%O", |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2050 u->headers_in.status_n, ctx->head, u->headers_in.chunked, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2051 u->headers_in.content_length_n); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2052 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2053 /* as per RFC2616, 4.4 Message Length */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2054 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2055 if (u->headers_in.status_n == NGX_HTTP_NO_CONTENT |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2056 || u->headers_in.status_n == NGX_HTTP_NOT_MODIFIED |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2057 || ctx->head) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2058 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2059 /* 1xx, 204, and 304 and replies to HEAD requests */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2060 /* no 1xx since we don't send Expect and Upgrade */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2061 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2062 u->pipe->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2063 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2064 u->keepalive = !u->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2065 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2066 } else if (u->headers_in.chunked) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2067 /* chunked */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2068 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2069 u->pipe->input_filter = ngx_http_proxy_chunked_filter; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2070 u->pipe->length = 3; /* "0" LF LF */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2071 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2072 u->input_filter = ngx_http_proxy_non_buffered_chunked_filter; |
5301
a50e26148d21
Upstream: added check if a response is complete.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5231
diff
changeset
|
2073 u->length = 1; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2074 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2075 } else if (u->headers_in.content_length_n == 0) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2076 /* empty body: special case as filter won't be called */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2077 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2078 u->pipe->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2079 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2080 u->keepalive = !u->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2081 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2082 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2083 /* content length or connection close */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2084 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2085 u->pipe->length = u->headers_in.content_length_n; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2086 u->length = u->headers_in.content_length_n; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2087 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2088 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2089 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2090 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2091 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2092 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2093 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2094 ngx_http_proxy_copy_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2095 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2096 ngx_buf_t *b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2097 ngx_chain_t *cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2098 ngx_http_request_t *r; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2099 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2100 if (buf->pos == buf->last) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2101 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2102 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2103 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2104 if (p->upstream_done) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2105 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0, |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2106 "http proxy data after close"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2107 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2108 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2109 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2110 if (p->length == 0) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2111 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2112 ngx_log_error(NGX_LOG_WARN, p->log, 0, |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2113 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2114 "\"Content-Length\" header"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2115 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2116 r = p->input_ctx; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2117 r->upstream->keepalive = 0; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2118 p->upstream_done = 1; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2119 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2120 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2121 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2122 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2123 cl = ngx_chain_get_free_buf(p->pool, &p->free); |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2124 if (cl == NULL) { |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2125 return NGX_ERROR; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2126 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2127 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2128 b = cl->buf; |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2129 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2130 ngx_memcpy(b, buf, sizeof(ngx_buf_t)); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2131 b->shadow = buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2132 b->tag = p->tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2133 b->last_shadow = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2134 b->recycled = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2135 buf->shadow = b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2136 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2137 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2138 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2139 if (p->in) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2140 *p->last_in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2141 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2142 p->in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2143 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2144 p->last_in = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2145 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2146 if (p->length == -1) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2147 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2148 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2149 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2150 if (b->last - b->pos > p->length) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2151 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2152 ngx_log_error(NGX_LOG_WARN, p->log, 0, |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2153 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2154 "\"Content-Length\" header"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2155 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2156 b->last = b->pos + p->length; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2157 p->upstream_done = 1; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2158 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2159 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2160 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2161 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2162 p->length -= b->last - b->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2163 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2164 if (p->length == 0) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2165 r = p->input_ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2166 r->upstream->keepalive = !r->upstream->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2167 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2168 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2169 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2170 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2171 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2172 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2173 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2174 ngx_http_proxy_chunked_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2175 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2176 ngx_int_t rc; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2177 ngx_buf_t *b, **prev; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2178 ngx_chain_t *cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2179 ngx_http_request_t *r; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2180 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2181 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2182 if (buf->pos == buf->last) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2183 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2184 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2185 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2186 r = p->input_ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2187 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2188 |
4602
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2189 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2190 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2191 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2192 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2193 if (p->upstream_done) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2194 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0, |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2195 "http proxy data after close"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2196 return NGX_OK; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2197 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2198 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2199 if (p->length == 0) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2200 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2201 ngx_log_error(NGX_LOG_WARN, p->log, 0, |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2202 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2203 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2204 r->upstream->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2205 p->upstream_done = 1; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2206 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2207 return NGX_OK; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2208 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2209 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2210 b = NULL; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2211 prev = &buf->shadow; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2212 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2213 for ( ;; ) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2214 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2215 rc = ngx_http_parse_chunked(r, buf, &ctx->chunked); |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2216 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2217 if (rc == NGX_OK) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2218 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2219 /* a chunk has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2220 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2221 cl = ngx_chain_get_free_buf(p->pool, &p->free); |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2222 if (cl == NULL) { |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2223 return NGX_ERROR; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2224 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2225 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2226 b = cl->buf; |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2227 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2228 ngx_memzero(b, sizeof(ngx_buf_t)); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2229 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2230 b->pos = buf->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2231 b->start = buf->start; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2232 b->end = buf->end; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2233 b->tag = p->tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2234 b->temporary = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2235 b->recycled = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2236 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2237 *prev = b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2238 prev = &b->shadow; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2239 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2240 if (p->in) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2241 *p->last_in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2242 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2243 p->in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2244 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2245 p->last_in = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2246 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2247 /* STUB */ b->num = buf->num; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2248 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2249 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2250 "input buf #%d %p", b->num, b->pos); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2251 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2252 if (buf->last - buf->pos >= ctx->chunked.size) { |
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2253 |
5359
2fda9065d0f4
Win32: Borland C compatibility fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5301
diff
changeset
|
2254 buf->pos += (size_t) ctx->chunked.size; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2255 b->last = buf->pos; |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2256 ctx->chunked.size = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2257 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2258 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2259 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2260 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2261 ctx->chunked.size -= buf->last - buf->pos; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2262 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2263 b->last = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2264 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2265 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2266 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2267 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2268 if (rc == NGX_DONE) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2269 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2270 /* a whole response has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2271 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2272 p->length = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2273 r->upstream->keepalive = !r->upstream->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2274 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2275 if (buf->pos != buf->last) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2276 ngx_log_error(NGX_LOG_WARN, p->log, 0, |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2277 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2278 r->upstream->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2279 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2280 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2281 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2282 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2283 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2284 if (rc == NGX_AGAIN) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2285 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2286 /* set p->length, minimal amount of data we want to see */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2287 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2288 p->length = ctx->chunked.length; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2289 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2290 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2291 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2292 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2293 /* invalid response */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2294 |
7677 | 2295 ngx_log_error(NGX_LOG_ERR, p->log, 0, |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2296 "upstream sent invalid chunked response"); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2297 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2298 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2299 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2300 |
7677 | 2301 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, p->log, 0, |
6480 | 2302 "http proxy chunked state %ui, length %O", |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2303 ctx->chunked.state, p->length); |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2304 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2305 if (b) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2306 b->shadow = buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2307 b->last_shadow = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2308 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2309 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2310 "input buf %p %z", b->pos, b->last - b->pos); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2311 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2312 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2313 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2314 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2315 /* there is no data record in the buf, add it to free chain */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2316 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2317 if (ngx_event_pipe_add_free_buf(p, buf) != NGX_OK) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2318 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2319 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2320 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2321 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2322 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2323 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2324 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2325 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2326 ngx_http_proxy_non_buffered_copy_filter(void *data, ssize_t bytes) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2327 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2328 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2329 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2330 ngx_buf_t *b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2331 ngx_chain_t *cl, **ll; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2332 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2333 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2334 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2335 |
7760
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2336 if (u->length == 0) { |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2337 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2338 "upstream sent more data than specified in " |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2339 "\"Content-Length\" header"); |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2340 return NGX_OK; |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2341 } |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2342 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2343 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2344 ll = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2345 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2346 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2347 cl = ngx_chain_get_free_buf(r->pool, &u->free_bufs); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2348 if (cl == NULL) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2349 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2350 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2351 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2352 *ll = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2353 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2354 cl->buf->flush = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2355 cl->buf->memory = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2356 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2357 b = &u->buffer; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2358 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2359 cl->buf->pos = b->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2360 b->last += bytes; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2361 cl->buf->last = b->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2362 cl->buf->tag = u->output.tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2363 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2364 if (u->length == -1) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2365 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2366 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2367 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2368 if (bytes > u->length) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2369 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2370 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2371 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2372 "\"Content-Length\" header"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2373 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2374 cl->buf->last = cl->buf->pos + u->length; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2375 u->length = 0; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2376 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2377 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2378 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2379 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2380 u->length -= bytes; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2381 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2382 if (u->length == 0) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2383 u->keepalive = !u->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2384 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2385 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2386 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2387 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2388 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2389 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2390 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2391 ngx_http_proxy_non_buffered_chunked_filter(void *data, ssize_t bytes) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2392 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2393 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2394 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2395 ngx_int_t rc; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2396 ngx_buf_t *b, *buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2397 ngx_chain_t *cl, **ll; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2398 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2399 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2400 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2401 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
4602
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2402 |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2403 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2404 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2405 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2406 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2407 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2408 buf = &u->buffer; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2409 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2410 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2411 buf->last += bytes; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2412 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2413 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2414 ll = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2415 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2416 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2417 for ( ;; ) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2418 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2419 rc = ngx_http_parse_chunked(r, buf, &ctx->chunked); |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2420 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2421 if (rc == NGX_OK) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2422 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2423 /* a chunk has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2424 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2425 cl = ngx_chain_get_free_buf(r->pool, &u->free_bufs); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2426 if (cl == NULL) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2427 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2428 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2429 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2430 *ll = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2431 ll = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2432 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2433 b = cl->buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2434 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2435 b->flush = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2436 b->memory = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2437 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2438 b->pos = buf->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2439 b->tag = u->output.tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2440 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2441 if (buf->last - buf->pos >= ctx->chunked.size) { |
5359
2fda9065d0f4
Win32: Borland C compatibility fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5301
diff
changeset
|
2442 buf->pos += (size_t) ctx->chunked.size; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2443 b->last = buf->pos; |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2444 ctx->chunked.size = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2445 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2446 } else { |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2447 ctx->chunked.size -= buf->last - buf->pos; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2448 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2449 b->last = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2450 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2451 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2452 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2453 "http proxy out buf %p %z", |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2454 b->pos, b->last - b->pos); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2455 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2456 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2457 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2458 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2459 if (rc == NGX_DONE) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2460 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2461 /* a whole response has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2462 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2463 u->keepalive = !u->headers_in.connection_close; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2464 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2465 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2466 if (buf->pos != buf->last) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2467 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2468 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2469 u->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2470 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2471 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2472 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2473 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2474 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2475 if (rc == NGX_AGAIN) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2476 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2477 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2478 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2479 /* invalid response */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2480 |
4145
f321e9750c8c
Proxy: logging levels tuned, double logging fixed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4144
diff
changeset
|
2481 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2482 "upstream sent invalid chunked response"); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2483 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2484 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2485 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2486 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2487 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2488 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2489 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2490 |
507 | 2491 static void |
2492 ngx_http_proxy_abort_request(ngx_http_request_t *r) | |
2493 { | |
2494 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2495 "abort http proxy request"); | |
577 | 2496 |
507 | 2497 return; |
2498 } | |
2499 | |
2500 | |
2501 static void | |
2502 ngx_http_proxy_finalize_request(ngx_http_request_t *r, ngx_int_t rc) | |
577 | 2503 { |
507 | 2504 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2505 "finalize http proxy request"); | |
2506 | |
2507 return; | |
2508 } | |
2509 | |
2510 | |
573 | 2511 static ngx_int_t |
2512 ngx_http_proxy_host_variable(ngx_http_request_t *r, | |
2513 ngx_http_variable_value_t *v, uintptr_t data) | |
507 | 2514 { |
1658 | 2515 ngx_http_proxy_ctx_t *ctx; |
2516 | |
2517 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2518 | |
2519 if (ctx == NULL) { | |
2520 v->not_found = 1; | |
2521 return NGX_OK; | |
2522 } | |
2523 | |
2524 v->len = ctx->vars.host_header.len; | |
577 | 2525 v->valid = 1; |
1565 | 2526 v->no_cacheable = 0; |
573 | 2527 v->not_found = 0; |
1658 | 2528 v->data = ctx->vars.host_header.data; |
507 | 2529 |
573 | 2530 return NGX_OK; |
507 | 2531 } |
2532 | |
2533 | |
573 | 2534 static ngx_int_t |
2535 ngx_http_proxy_port_variable(ngx_http_request_t *r, | |
2536 ngx_http_variable_value_t *v, uintptr_t data) | |
507 | 2537 { |
1658 | 2538 ngx_http_proxy_ctx_t *ctx; |
2539 | |
2540 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2541 | |
2542 if (ctx == NULL) { | |
2543 v->not_found = 1; | |
2544 return NGX_OK; | |
2545 } | |
2546 | |
2547 v->len = ctx->vars.port.len; | |
577 | 2548 v->valid = 1; |
1565 | 2549 v->no_cacheable = 0; |
573 | 2550 v->not_found = 0; |
1658 | 2551 v->data = ctx->vars.port.data; |
509 | 2552 |
573 | 2553 return NGX_OK; |
509 | 2554 } |
2555 | |
2556 | |
573 | 2557 static ngx_int_t |
509 | 2558 ngx_http_proxy_add_x_forwarded_for_variable(ngx_http_request_t *r, |
573 | 2559 ngx_http_variable_value_t *v, uintptr_t data) |
509 | 2560 { |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2561 size_t len; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2562 u_char *p; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2563 ngx_uint_t i, n; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2564 ngx_table_elt_t **h; |
509 | 2565 |
577 | 2566 v->valid = 1; |
1565 | 2567 v->no_cacheable = 0; |
573 | 2568 v->not_found = 0; |
509 | 2569 |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2570 n = r->headers_in.x_forwarded_for.nelts; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2571 h = r->headers_in.x_forwarded_for.elts; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2572 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2573 len = 0; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2574 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2575 for (i = 0; i < n; i++) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2576 len += h[i]->value.len + sizeof(", ") - 1; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2577 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2578 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2579 if (len == 0) { |
573 | 2580 v->len = r->connection->addr_text.len; |
2581 v->data = r->connection->addr_text.data; | |
2582 return NGX_OK; | |
509 | 2583 } |
2584 | |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2585 len += r->connection->addr_text.len; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2586 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2587 p = ngx_pnalloc(r->pool, len); |
509 | 2588 if (p == NULL) { |
573 | 2589 return NGX_ERROR; |
509 | 2590 } |
2591 | |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2592 v->len = len; |
573 | 2593 v->data = p; |
509 | 2594 |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2595 for (i = 0; i < n; i++) { |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2596 p = ngx_copy(p, h[i]->value.data, h[i]->value.len); |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2597 *p++ = ','; *p++ = ' '; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2598 } |
509 | 2599 |
2600 ngx_memcpy(p, r->connection->addr_text.data, r->connection->addr_text.len); | |
2601 | |
573 | 2602 return NGX_OK; |
509 | 2603 } |
2604 | |
2605 | |
2606 static ngx_int_t | |
577 | 2607 ngx_http_proxy_internal_body_length_variable(ngx_http_request_t *r, |
2608 ngx_http_variable_value_t *v, uintptr_t data) | |
2609 { | |
1658 | 2610 ngx_http_proxy_ctx_t *ctx; |
2611 | |
2612 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2613 | |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
2614 if (ctx == NULL || ctx->internal_body_length < 0) { |
577 | 2615 v->not_found = 1; |
2616 return NGX_OK; | |
2617 } | |
2618 | |
2619 v->valid = 1; | |
1565 | 2620 v->no_cacheable = 0; |
577 | 2621 v->not_found = 0; |
2622 | |
5188
886800caf360
Proxy: allocate $proxy_internal_body_length from request pool.
Ruslan Ermilov <ru@nginx.com>
parents:
5084
diff
changeset
|
2623 v->data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); |
577 | 2624 |
2625 if (v->data == NULL) { | |
2626 return NGX_ERROR; | |
2627 } | |
2628 | |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
2629 v->len = ngx_sprintf(v->data, "%O", ctx->internal_body_length) - v->data; |
577 | 2630 |
2631 return NGX_OK; | |
2632 } | |
2633 | |
2634 | |
2635 static ngx_int_t | |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2636 ngx_http_proxy_internal_chunked_variable(ngx_http_request_t *r, |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2637 ngx_http_variable_value_t *v, uintptr_t data) |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2638 { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2639 ngx_http_proxy_ctx_t *ctx; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2640 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2641 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2642 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2643 if (ctx == NULL || !ctx->internal_chunked) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2644 v->not_found = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2645 return NGX_OK; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2646 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2647 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2648 v->valid = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2649 v->no_cacheable = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2650 v->not_found = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2651 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2652 v->data = (u_char *) "chunked"; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2653 v->len = sizeof("chunked") - 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2654 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2655 return NGX_OK; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2656 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2657 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2658 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2659 static ngx_int_t |
509 | 2660 ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r, ngx_table_elt_t *h, |
2661 size_t prefix) | |
2662 { | |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
2663 size_t len; |
509 | 2664 ngx_int_t rc; |
2665 ngx_uint_t i; | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
2666 ngx_http_proxy_rewrite_t *pr; |
509 | 2667 ngx_http_proxy_loc_conf_t *plcf; |
2668 | |
2669 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); | |
2670 | |
2671 pr = plcf->redirects->elts; | |
2672 | |
2673 if (pr == NULL) { | |
2674 return NGX_DECLINED; | |
2675 } | |
2676 | |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
2677 len = h->value.len - prefix; |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
2678 |
509 | 2679 for (i = 0; i < plcf->redirects->nelts; i++) { |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
2680 rc = pr[i].handler(r, &h->value, prefix, len, &pr[i]); |
509 | 2681 |
2682 if (rc != NGX_DECLINED) { | |
2683 return rc; | |
2684 } | |
2685 } | |
2686 | |
2687 return NGX_DECLINED; | |
2688 } | |
2689 | |
2690 | |
2691 static ngx_int_t | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2692 ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r, ngx_table_elt_t *h) |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2693 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2694 u_char *p; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2695 size_t len; |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2696 ngx_int_t rc, rv; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2697 ngx_str_t *key, *value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2698 ngx_uint_t i; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2699 ngx_array_t attrs; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2700 ngx_keyval_t *attr; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2701 ngx_http_proxy_loc_conf_t *plcf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2702 |
7720
a88384c69d1e
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7716
diff
changeset
|
2703 if (ngx_array_init(&attrs, r->pool, 2, sizeof(ngx_keyval_t)) != NGX_OK) { |
a88384c69d1e
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7716
diff
changeset
|
2704 return NGX_ERROR; |
a88384c69d1e
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7716
diff
changeset
|
2705 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2706 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2707 if (ngx_http_proxy_parse_cookie(&h->value, &attrs) != NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2708 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2709 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2710 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2711 attr = attrs.elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2712 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2713 if (attr[0].value.data == NULL) { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2714 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2715 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2716 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2717 rv = NGX_DECLINED; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2718 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2719 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2720 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2721 for (i = 1; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2722 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2723 key = &attr[i].key; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2724 value = &attr[i].value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2725 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2726 if (plcf->cookie_domains && key->len == 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2727 && ngx_strncasecmp(key->data, (u_char *) "domain", 6) == 0 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2728 && value->data) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2729 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2730 rc = ngx_http_proxy_rewrite_cookie_value(r, value, |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2731 plcf->cookie_domains); |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2732 if (rc == NGX_ERROR) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2733 return NGX_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2734 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2735 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2736 if (rc != NGX_DECLINED) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2737 rv = rc; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2738 } |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2739 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2740 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2741 if (plcf->cookie_paths && key->len == 4 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2742 && ngx_strncasecmp(key->data, (u_char *) "path", 4) == 0 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2743 && value->data) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2744 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2745 rc = ngx_http_proxy_rewrite_cookie_value(r, value, |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2746 plcf->cookie_paths); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2747 if (rc == NGX_ERROR) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2748 return NGX_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2749 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2750 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2751 if (rc != NGX_DECLINED) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2752 rv = rc; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2753 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2754 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2755 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2756 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2757 if (plcf->cookie_flags) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2758 rc = ngx_http_proxy_rewrite_cookie_flags(r, &attrs, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2759 plcf->cookie_flags); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2760 if (rc == NGX_ERROR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2761 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2762 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2763 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2764 if (rc != NGX_DECLINED) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2765 rv = rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2766 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2767 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2768 attr = attrs.elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2769 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2770 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2771 if (rv != NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2772 return rv; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2773 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2774 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2775 len = 0; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2776 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2777 for (i = 0; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2778 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2779 if (attr[i].key.data == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2780 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2781 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2782 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2783 if (i > 0) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2784 len += 2; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2785 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2786 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2787 len += attr[i].key.len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2788 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2789 if (attr[i].value.data) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2790 len += 1 + attr[i].value.len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2791 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2792 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2793 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2794 p = ngx_pnalloc(r->pool, len + 1); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2795 if (p == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2796 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2797 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2798 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2799 h->value.data = p; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2800 h->value.len = len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2801 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2802 for (i = 0; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2803 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2804 if (attr[i].key.data == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2805 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2806 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2807 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2808 if (i > 0) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2809 *p++ = ';'; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2810 *p++ = ' '; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2811 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2812 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2813 p = ngx_cpymem(p, attr[i].key.data, attr[i].key.len); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2814 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2815 if (attr[i].value.data) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2816 *p++ = '='; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2817 p = ngx_cpymem(p, attr[i].value.data, attr[i].value.len); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2818 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2819 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2820 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2821 *p = '\0'; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2822 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2823 return NGX_OK; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2824 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2825 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2826 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2827 static ngx_int_t |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2828 ngx_http_proxy_parse_cookie(ngx_str_t *value, ngx_array_t *attrs) |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2829 { |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2830 u_char *start, *end, *p, *last; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2831 ngx_str_t name, val; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2832 ngx_keyval_t *attr; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2833 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2834 start = value->data; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2835 end = value->data + value->len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2836 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2837 for ( ;; ) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2838 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2839 last = (u_char *) ngx_strchr(start, ';'); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2840 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2841 if (last == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2842 last = end; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2843 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2844 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2845 while (start < last && *start == ' ') { start++; } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2846 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2847 for (p = start; p < last && *p != '='; p++) { /* void */ } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2848 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2849 name.data = start; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2850 name.len = p - start; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2851 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2852 while (name.len && name.data[name.len - 1] == ' ') { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2853 name.len--; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2854 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2855 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2856 if (p < last) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2857 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2858 p++; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2859 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2860 while (p < last && *p == ' ') { p++; } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2861 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2862 val.data = p; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2863 val.len = last - val.data; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2864 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2865 while (val.len && val.data[val.len - 1] == ' ') { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2866 val.len--; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2867 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2868 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2869 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2870 ngx_str_null(&val); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2871 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2872 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2873 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2874 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2875 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2876 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2877 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2878 attr->key = name; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2879 attr->value = val; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2880 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2881 if (last == end) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2882 break; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2883 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2884 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2885 start = last + 1; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2886 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2887 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2888 return NGX_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2889 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2890 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2891 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2892 static ngx_int_t |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2893 ngx_http_proxy_rewrite_cookie_value(ngx_http_request_t *r, ngx_str_t *value, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2894 ngx_array_t *rewrites) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2895 { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2896 ngx_int_t rc; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2897 ngx_uint_t i; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2898 ngx_http_proxy_rewrite_t *pr; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2899 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2900 pr = rewrites->elts; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2901 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2902 for (i = 0; i < rewrites->nelts; i++) { |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2903 rc = pr[i].handler(r, value, 0, value->len, &pr[i]); |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2904 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2905 if (rc != NGX_DECLINED) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2906 return rc; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2907 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2908 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2909 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2910 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2911 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2912 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2913 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2914 static ngx_int_t |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2915 ngx_http_proxy_rewrite_cookie_flags(ngx_http_request_t *r, ngx_array_t *attrs, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2916 ngx_array_t *flags) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2917 { |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2918 ngx_str_t pattern, value; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2919 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2920 ngx_int_t rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2921 #endif |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2922 ngx_uint_t i, m, f, nelts; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2923 ngx_keyval_t *attr; |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2924 ngx_conf_bitmask_t *mask; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2925 ngx_http_complex_value_t *flags_values; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2926 ngx_http_proxy_cookie_flags_t *pcf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2927 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2928 attr = attrs->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2929 pcf = flags->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2930 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2931 for (i = 0; i < flags->nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2932 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2933 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2934 if (pcf[i].regex) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2935 rc = ngx_http_regex_exec(r, pcf[i].cookie.regex, &attr[0].key); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2936 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2937 if (rc == NGX_ERROR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2938 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2939 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2940 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2941 if (rc == NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2942 break; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2943 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2944 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2945 /* NGX_DECLINED */ |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2946 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2947 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2948 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2949 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2950 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2951 if (ngx_http_complex_value(r, &pcf[i].cookie.complex, &pattern) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2952 != NGX_OK) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2953 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2954 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2955 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2956 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2957 if (pattern.len == attr[0].key.len |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2958 && ngx_strncasecmp(attr[0].key.data, pattern.data, pattern.len) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2959 == 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2960 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2961 break; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2962 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2963 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2964 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2965 if (i == flags->nelts) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2966 return NGX_DECLINED; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2967 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2968 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2969 nelts = pcf[i].flags_values.nelts; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2970 flags_values = pcf[i].flags_values.elts; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2971 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2972 mask = ngx_http_proxy_cookie_flags_masks; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2973 f = 0; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2974 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2975 for (i = 0; i < nelts; i++) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2976 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2977 if (ngx_http_complex_value(r, &flags_values[i], &value) != NGX_OK) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2978 return NGX_ERROR; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2979 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2980 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2981 if (value.len == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2982 continue; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2983 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2984 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2985 for (m = 0; mask[m].name.len != 0; m++) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2986 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2987 if (mask[m].name.len != value.len |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2988 || ngx_strncasecmp(mask[m].name.data, value.data, value.len) |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2989 != 0) |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2990 { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2991 continue; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2992 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2993 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2994 f |= mask[m].mask; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2995 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2996 break; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2997 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2998 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2999 if (mask[m].name.len == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3000 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3001 "invalid proxy_cookie_flags flag \"%V\"", &value); |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3002 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3003 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3004 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3005 if (f == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3006 return NGX_DECLINED; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3007 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3008 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3009 return ngx_http_proxy_edit_cookie_flags(r, attrs, f); |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3010 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3011 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3012 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3013 static ngx_int_t |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3014 ngx_http_proxy_edit_cookie_flags(ngx_http_request_t *r, ngx_array_t *attrs, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3015 ngx_uint_t flags) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3016 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3017 ngx_str_t *key, *value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3018 ngx_uint_t i; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3019 ngx_keyval_t *attr; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3020 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3021 attr = attrs->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3022 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3023 for (i = 1; i < attrs->nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3024 key = &attr[i].key; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3025 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3026 if (key->len == 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3027 && ngx_strncasecmp(key->data, (u_char *) "secure", 6) == 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3028 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3029 if (flags & NGX_HTTP_PROXY_COOKIE_SECURE_ON) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3030 flags &= ~NGX_HTTP_PROXY_COOKIE_SECURE_ON; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3031 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3032 } else if (flags & NGX_HTTP_PROXY_COOKIE_SECURE_OFF) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3033 key->data = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3034 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3035 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3036 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3037 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3038 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3039 if (key->len == 8 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3040 && ngx_strncasecmp(key->data, (u_char *) "httponly", 8) == 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3041 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3042 if (flags & NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3043 flags &= ~NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3044 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3045 } else if (flags & NGX_HTTP_PROXY_COOKIE_HTTPONLY_OFF) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3046 key->data = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3047 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3048 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3049 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3050 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3051 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3052 if (key->len == 8 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3053 && ngx_strncasecmp(key->data, (u_char *) "samesite", 8) == 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3054 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3055 value = &attr[i].value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3056 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3057 if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3058 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3059 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3060 if (value->len != 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3061 || ngx_strncasecmp(value->data, (u_char *) "strict", 6) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3062 != 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3063 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3064 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3065 ngx_str_set(value, "Strict"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3066 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3067 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3068 } else if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3069 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3070 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3071 if (value->len != 3 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3072 || ngx_strncasecmp(value->data, (u_char *) "lax", 3) != 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3073 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3074 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3075 ngx_str_set(value, "Lax"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3076 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3077 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3078 } else if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3079 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3080 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3081 if (value->len != 4 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3082 || ngx_strncasecmp(value->data, (u_char *) "none", 4) != 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3083 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3084 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3085 ngx_str_set(value, "None"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3086 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3087 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3088 } else if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_OFF) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3089 key->data = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3090 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3091 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3092 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3093 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3094 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3095 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3096 if (flags & NGX_HTTP_PROXY_COOKIE_SECURE_ON) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3097 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3098 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3099 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3100 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3101 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3102 ngx_str_set(&attr->key, "Secure"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3103 ngx_str_null(&attr->value); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3104 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3105 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3106 if (flags & NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3107 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3108 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3109 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3110 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3111 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3112 ngx_str_set(&attr->key, "HttpOnly"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3113 ngx_str_null(&attr->value); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3114 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3115 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3116 if (flags & (NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3117 |NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3118 |NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE)) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3119 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3120 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3121 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3122 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3123 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3124 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3125 ngx_str_set(&attr->key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3126 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3127 if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3128 ngx_str_set(&attr->value, "Strict"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3129 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3130 } else if (flags & NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3131 ngx_str_set(&attr->value, "Lax"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3132 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3133 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3134 ngx_str_set(&attr->value, "None"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3135 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3136 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3137 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3138 return NGX_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3139 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3140 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3141 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3142 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3143 ngx_http_proxy_rewrite_complex_handler(ngx_http_request_t *r, ngx_str_t *value, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3144 size_t prefix, size_t len, ngx_http_proxy_rewrite_t *pr) |
509 | 3145 { |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3146 ngx_str_t pattern, replacement; |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3147 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3148 if (ngx_http_complex_value(r, &pr->pattern.complex, &pattern) != NGX_OK) { |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3149 return NGX_ERROR; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3150 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3151 |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3152 if (pattern.len > len |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3153 || ngx_rstrncmp(value->data + prefix, pattern.data, pattern.len) != 0) |
509 | 3154 { |
3155 return NGX_DECLINED; | |
3156 } | |
3157 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3158 if (ngx_http_complex_value(r, &pr->replacement, &replacement) != NGX_OK) { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3159 return NGX_ERROR; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3160 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3161 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3162 return ngx_http_proxy_rewrite(r, value, prefix, pattern.len, &replacement); |
509 | 3163 } |
3164 | |
3165 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3166 #if (NGX_PCRE) |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3167 |
509 | 3168 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3169 ngx_http_proxy_rewrite_regex_handler(ngx_http_request_t *r, ngx_str_t *value, |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3170 size_t prefix, size_t len, ngx_http_proxy_rewrite_t *pr) |
509 | 3171 { |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3172 ngx_str_t pattern, replacement; |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3173 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3174 pattern.len = len; |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3175 pattern.data = value->data + prefix; |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3176 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3177 if (ngx_http_regex_exec(r, pr->pattern.regex, &pattern) != NGX_OK) { |
509 | 3178 return NGX_DECLINED; |
3179 } | |
3180 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3181 if (ngx_http_complex_value(r, &pr->replacement, &replacement) != NGX_OK) { |
509 | 3182 return NGX_ERROR; |
3183 } | |
3184 | |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3185 return ngx_http_proxy_rewrite(r, value, prefix, len, &replacement); |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3186 } |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3187 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3188 #endif |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3189 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3190 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3191 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3192 ngx_http_proxy_rewrite_domain_handler(ngx_http_request_t *r, ngx_str_t *value, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3193 size_t prefix, size_t len, ngx_http_proxy_rewrite_t *pr) |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3194 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3195 u_char *p; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3196 ngx_str_t pattern, replacement; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3197 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3198 if (ngx_http_complex_value(r, &pr->pattern.complex, &pattern) != NGX_OK) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3199 return NGX_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3200 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3201 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3202 p = value->data + prefix; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3203 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3204 if (len && p[0] == '.') { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3205 p++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3206 prefix++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3207 len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3208 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3209 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3210 if (pattern.len != len || ngx_rstrncasecmp(pattern.data, p, len) != 0) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3211 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3212 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3213 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3214 if (ngx_http_complex_value(r, &pr->replacement, &replacement) != NGX_OK) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3215 return NGX_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3216 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3217 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3218 return ngx_http_proxy_rewrite(r, value, prefix, len, &replacement); |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3219 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3220 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3221 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3222 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3223 ngx_http_proxy_rewrite(ngx_http_request_t *r, ngx_str_t *value, size_t prefix, |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3224 size_t len, ngx_str_t *replacement) |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3225 { |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3226 u_char *p, *data; |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3227 size_t new_len; |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3228 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3229 if (len == value->len) { |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3230 *value = *replacement; |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3231 return NGX_OK; |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3232 } |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3233 |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3234 new_len = replacement->len + value->len - len; |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3235 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3236 if (replacement->len > len) { |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3237 |
5676
fbfdf8017748
Proxy: fixed possible uninitialized memory access.
Valentin Bartenev <vbart@nginx.com>
parents:
5661
diff
changeset
|
3238 data = ngx_pnalloc(r->pool, new_len + 1); |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3239 if (data == NULL) { |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3240 return NGX_ERROR; |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3241 } |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3242 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3243 p = ngx_copy(data, value->data, prefix); |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3244 p = ngx_copy(p, replacement->data, replacement->len); |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3245 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3246 ngx_memcpy(p, value->data + prefix + len, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3247 value->len - len - prefix + 1); |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3248 |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3249 value->data = data; |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3250 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3251 } else { |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3252 p = ngx_copy(value->data + prefix, replacement->data, replacement->len); |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3253 |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3254 ngx_memmove(p, value->data + prefix + len, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3255 value->len - len - prefix + 1); |
4398
3d51ba7f347b
Fixed: proxy_redirect with regex might broke Refresh header.
Valentin Bartenev <vbart@nginx.com>
parents:
4385
diff
changeset
|
3256 } |
3d51ba7f347b
Fixed: proxy_redirect with regex might broke Refresh header.
Valentin Bartenev <vbart@nginx.com>
parents:
4385
diff
changeset
|
3257 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3258 value->len = new_len; |
509 | 3259 |
3260 return NGX_OK; | |
3261 } | |
3262 | |
3263 | |
3264 static ngx_int_t | |
3265 ngx_http_proxy_add_variables(ngx_conf_t *cf) | |
3266 { | |
3267 ngx_http_variable_t *var, *v; | |
3268 | |
3269 for (v = ngx_http_proxy_vars; v->name.len; v++) { | |
3270 var = ngx_http_add_variable(cf, &v->name, v->flags); | |
3271 if (var == NULL) { | |
3272 return NGX_ERROR; | |
3273 } | |
3274 | |
637 | 3275 var->get_handler = v->get_handler; |
509 | 3276 var->data = v->data; |
3277 } | |
3278 | |
3279 return NGX_OK; | |
507 | 3280 } |
3281 | |
3282 | |
3283 static void * | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3284 ngx_http_proxy_create_main_conf(ngx_conf_t *cf) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3285 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3286 ngx_http_proxy_main_conf_t *conf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3287 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3288 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_main_conf_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3289 if (conf == NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3290 return NULL; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3291 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3292 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3293 #if (NGX_HTTP_CACHE) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3294 if (ngx_array_init(&conf->caches, cf->pool, 4, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3295 sizeof(ngx_http_file_cache_t *)) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3296 != NGX_OK) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3297 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3298 return NULL; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3299 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3300 #endif |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3301 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3302 return conf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3303 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3304 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3305 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3306 static void * |
507 | 3307 ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) |
3308 { | |
3309 ngx_http_proxy_loc_conf_t *conf; | |
3310 | |
3311 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t)); | |
3312 if (conf == NULL) { | |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2895
diff
changeset
|
3313 return NULL; |
507 | 3314 } |
3315 | |
3316 /* | |
3317 * set by ngx_pcalloc(): | |
3318 * | |
3319 * conf->upstream.bufs.num = 0; | |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3320 * conf->upstream.ignore_headers = 0; |
507 | 3321 * conf->upstream.next_upstream = 0; |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3322 * conf->upstream.cache_zone = NULL; |
2875
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3323 * conf->upstream.cache_use_stale = 0; |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3324 * conf->upstream.cache_methods = 0; |
507 | 3325 * conf->upstream.temp_path = NULL; |
649 | 3326 * conf->upstream.hide_headers_hash = { NULL, 0 }; |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3327 * conf->upstream.store_lengths = NULL; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3328 * conf->upstream.store_values = NULL; |
509 | 3329 * |
7238
06cf0c4b8618
Upstream: fixed comments after 13f8dec720b5.
Ruslan Ermilov <ru@nginx.com>
parents:
7220
diff
changeset
|
3330 * conf->location = NULL; |
06cf0c4b8618
Upstream: fixed comments after 13f8dec720b5.
Ruslan Ermilov <ru@nginx.com>
parents:
7220
diff
changeset
|
3331 * conf->url = { 0, NULL }; |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3332 * conf->headers.lengths = NULL; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3333 * conf->headers.values = NULL; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3334 * conf->headers.hash = { NULL, 0 }; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3335 * conf->headers_cache.lengths = NULL; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3336 * conf->headers_cache.values = NULL; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3337 * conf->headers_cache.hash = { NULL, 0 }; |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3338 * conf->body_lengths = NULL; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3339 * conf->body_values = NULL; |
577 | 3340 * conf->body_source = { 0, NULL }; |
3470
b982f2dee8cf
fix proxy_redirect name in error message
Igor Sysoev <igor@sysoev.ru>
parents:
3399
diff
changeset
|
3341 * conf->redirects = NULL; |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3342 * conf->ssl = 0; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3343 * conf->ssl_protocols = 0; |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3344 * conf->ssl_ciphers = { 0, NULL }; |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3345 * conf->ssl_trusted_certificate = { 0, NULL }; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3346 * conf->ssl_crl = { 0, NULL }; |
507 | 3347 */ |
577 | 3348 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3349 conf->upstream.store = NGX_CONF_UNSET; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3350 conf->upstream.store_access = NGX_CONF_UNSET_UINT; |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3351 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT; |
581 | 3352 conf->upstream.buffering = NGX_CONF_UNSET; |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3353 conf->upstream.request_buffering = NGX_CONF_UNSET; |
629 | 3354 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3355 conf->upstream.force_ranges = NGX_CONF_UNSET; |
581 | 3356 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3357 conf->upstream.local = NGX_CONF_UNSET_PTR; |
7371
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3358 conf->upstream.socket_keepalive = NGX_CONF_UNSET; |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3359 |
507 | 3360 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
3361 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; | |
3362 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3363 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC; |
507 | 3364 |
3365 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; | |
581 | 3366 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3367 conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; |
529 | 3368 |
3369 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; | |
577 | 3370 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; |
529 | 3371 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; |
509 | 3372 |
3373 conf->upstream.pass_request_headers = NGX_CONF_UNSET; | |
3374 conf->upstream.pass_request_body = NGX_CONF_UNSET; | |
561 | 3375 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3376 #if (NGX_HTTP_CACHE) |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3377 conf->upstream.cache = NGX_CONF_UNSET; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3378 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; |
6793
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3379 conf->upstream.cache_max_range_offset = NGX_CONF_UNSET; |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
3380 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3381 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3382 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3383 conf->upstream.cache_lock = NGX_CONF_UNSET; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3384 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC; |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3385 conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC; |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3386 conf->upstream.cache_revalidate = NGX_CONF_UNSET; |
6290
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3387 conf->upstream.cache_convert_head = NGX_CONF_UNSET; |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3388 conf->upstream.cache_background_update = NGX_CONF_UNSET; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3389 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3390 |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3391 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3392 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3393 |
657 | 3394 conf->upstream.intercept_errors = NGX_CONF_UNSET; |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3395 |
2184 | 3396 #if (NGX_HTTP_SSL) |
3397 conf->upstream.ssl_session_reuse = NGX_CONF_UNSET; | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3398 conf->upstream.ssl_name = NGX_CONF_UNSET_PTR; |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3399 conf->upstream.ssl_server_name = NGX_CONF_UNSET; |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3400 conf->upstream.ssl_verify = NGX_CONF_UNSET; |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3401 conf->upstream.ssl_certificate = NGX_CONF_UNSET_PTR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3402 conf->upstream.ssl_certificate_key = NGX_CONF_UNSET_PTR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3403 conf->upstream.ssl_passwords = NGX_CONF_UNSET_PTR; |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3404 conf->ssl_verify_depth = NGX_CONF_UNSET_UINT; |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3405 conf->ssl_conf_commands = NGX_CONF_UNSET_PTR; |
2184 | 3406 #endif |
507 | 3407 |
3408 /* "proxy_cyclic_temp_file" is disabled */ | |
3409 conf->upstream.cyclic_temp_file = 0; | |
3410 | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3411 conf->upstream.change_buffering = 1; |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3412 |
7728
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3413 conf->headers_source = NGX_CONF_UNSET_PTR; |
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3414 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3415 conf->method = NGX_CONF_UNSET_PTR; |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3416 |
509 | 3417 conf->redirect = NGX_CONF_UNSET; |
507 | 3418 |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3419 conf->cookie_domains = NGX_CONF_UNSET_PTR; |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
3420 conf->cookie_paths = NGX_CONF_UNSET_PTR; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3421 conf->cookie_flags = NGX_CONF_UNSET_PTR; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3422 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3423 conf->http_version = NGX_CONF_UNSET_UINT; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3424 |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3425 conf->headers_hash_max_size = NGX_CONF_UNSET_UINT; |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3426 conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT; |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3427 |
3976
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3862
diff
changeset
|
3428 ngx_str_set(&conf->upstream.module, "proxy"); |
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3862
diff
changeset
|
3429 |
507 | 3430 return conf; |
3431 } | |
3432 | |
3433 | |
3434 static char * | |
3435 ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
3436 { | |
3437 ngx_http_proxy_loc_conf_t *prev = parent; | |
3438 ngx_http_proxy_loc_conf_t *conf = child; | |
3439 | |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3440 u_char *p; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3441 size_t size; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3442 ngx_int_t rc; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3443 ngx_hash_init_t hash; |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
3444 ngx_http_core_loc_conf_t *clcf; |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3445 ngx_http_proxy_rewrite_t *pr; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3446 ngx_http_script_compile_t sc; |
509 | 3447 |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3448 #if (NGX_HTTP_CACHE) |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3449 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3450 if (conf->upstream.store > 0) { |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3451 conf->upstream.cache = 0; |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3452 } |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3453 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3454 if (conf->upstream.cache > 0) { |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3455 conf->upstream.store = 0; |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3456 } |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3457 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3458 #endif |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3459 |
5940
e3b3b89d74e8
Upstream: fixed inheritance of proxy_store and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5939
diff
changeset
|
3460 if (conf->upstream.store == NGX_CONF_UNSET) { |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3461 ngx_conf_merge_value(conf->upstream.store, |
2894 | 3462 prev->upstream.store, 0); |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3463 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
3464 conf->upstream.store_lengths = prev->upstream.store_lengths; |
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
3465 conf->upstream.store_values = prev->upstream.store_values; |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3466 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3467 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3468 ngx_conf_merge_uint_value(conf->upstream.store_access, |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3469 prev->upstream.store_access, 0600); |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
3470 |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3471 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3472 prev->upstream.next_upstream_tries, 0); |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3473 |
581 | 3474 ngx_conf_merge_value(conf->upstream.buffering, |
3475 prev->upstream.buffering, 1); | |
3476 | |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3477 ngx_conf_merge_value(conf->upstream.request_buffering, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3478 prev->upstream.request_buffering, 1); |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3479 |
629 | 3480 ngx_conf_merge_value(conf->upstream.ignore_client_abort, |
3481 prev->upstream.ignore_client_abort, 0); | |
3482 | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3483 ngx_conf_merge_value(conf->upstream.force_ranges, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3484 prev->upstream.force_ranges, 0); |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3485 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3486 ngx_conf_merge_ptr_value(conf->upstream.local, |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3487 prev->upstream.local, NULL); |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3488 |
7371
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3489 ngx_conf_merge_value(conf->upstream.socket_keepalive, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3490 prev->upstream.socket_keepalive, 0); |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3491 |
507 | 3492 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, |
3493 prev->upstream.connect_timeout, 60000); | |
3494 | |
3495 ngx_conf_merge_msec_value(conf->upstream.send_timeout, | |
3496 prev->upstream.send_timeout, 60000); | |
3497 | |
3498 ngx_conf_merge_msec_value(conf->upstream.read_timeout, | |
3499 prev->upstream.read_timeout, 60000); | |
3500 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3501 ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3502 prev->upstream.next_upstream_timeout, 0); |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3503 |
507 | 3504 ngx_conf_merge_size_value(conf->upstream.send_lowat, |
3505 prev->upstream.send_lowat, 0); | |
3506 | |
581 | 3507 ngx_conf_merge_size_value(conf->upstream.buffer_size, |
3508 prev->upstream.buffer_size, | |
507 | 3509 (size_t) ngx_pagesize); |
3510 | |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3511 ngx_conf_merge_size_value(conf->upstream.limit_rate, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3512 prev->upstream.limit_rate, 0); |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3513 |
507 | 3514 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, |
3515 8, ngx_pagesize); | |
3516 | |
3517 if (conf->upstream.bufs.num < 2) { | |
577 | 3518 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
507 | 3519 "there must be at least 2 \"proxy_buffers\""); |
3520 return NGX_CONF_ERROR; | |
3521 } | |
577 | 3522 |
507 | 3523 |
581 | 3524 size = conf->upstream.buffer_size; |
577 | 3525 if (size < conf->upstream.bufs.size) { |
507 | 3526 size = conf->upstream.bufs.size; |
3527 } | |
3528 | |
3529 | |
529 | 3530 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf, |
3531 prev->upstream.busy_buffers_size_conf, | |
507 | 3532 NGX_CONF_UNSET_SIZE); |
3533 | |
529 | 3534 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3535 conf->upstream.busy_buffers_size = 2 * size; |
529 | 3536 } else { |
3537 conf->upstream.busy_buffers_size = | |
3538 conf->upstream.busy_buffers_size_conf; | |
3539 } | |
577 | 3540 |
529 | 3541 if (conf->upstream.busy_buffers_size < size) { |
507 | 3542 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3543 "\"proxy_busy_buffers_size\" must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3544 "the maximum of the value of \"proxy_buffer_size\" and " |
507 | 3545 "one of the \"proxy_buffers\""); |
3546 | |
3547 return NGX_CONF_ERROR; | |
529 | 3548 } |
507 | 3549 |
529 | 3550 if (conf->upstream.busy_buffers_size |
3551 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) | |
507 | 3552 { |
3553 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3554 "\"proxy_busy_buffers_size\" must be less than " | |
3555 "the size of all \"proxy_buffers\" minus one buffer"); | |
3556 | |
3557 return NGX_CONF_ERROR; | |
3558 } | |
529 | 3559 |
507 | 3560 |
529 | 3561 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf, |
3562 prev->upstream.temp_file_write_size_conf, | |
507 | 3563 NGX_CONF_UNSET_SIZE); |
3564 | |
529 | 3565 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3566 conf->upstream.temp_file_write_size = 2 * size; |
529 | 3567 } else { |
3568 conf->upstream.temp_file_write_size = | |
3569 conf->upstream.temp_file_write_size_conf; | |
3570 } | |
577 | 3571 |
529 | 3572 if (conf->upstream.temp_file_write_size < size) { |
507 | 3573 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3574 "\"proxy_temp_file_write_size\" must be equal to or greater " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3575 "than the maximum of the value of \"proxy_buffer_size\" and " |
507 | 3576 "one of the \"proxy_buffers\""); |
3577 | |
3578 return NGX_CONF_ERROR; | |
3579 } | |
3580 | |
529 | 3581 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf, |
3582 prev->upstream.max_temp_file_size_conf, | |
507 | 3583 NGX_CONF_UNSET_SIZE); |
3584 | |
529 | 3585 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3586 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024; |
529 | 3587 } else { |
3588 conf->upstream.max_temp_file_size = | |
3589 conf->upstream.max_temp_file_size_conf; | |
3590 } | |
507 | 3591 |
529 | 3592 if (conf->upstream.max_temp_file_size != 0 |
3593 && conf->upstream.max_temp_file_size < size) | |
507 | 3594 { |
3595 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
561 | 3596 "\"proxy_max_temp_file_size\" must be equal to zero to disable " |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3597 "temporary files usage or must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
3598 "the maximum of the value of \"proxy_buffer_size\" and " |
561 | 3599 "one of the \"proxy_buffers\""); |
507 | 3600 |
3601 return NGX_CONF_ERROR; | |
3602 } | |
3603 | |
529 | 3604 |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3605 ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3606 prev->upstream.ignore_headers, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3607 NGX_CONF_BITMASK_SET); |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3608 |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3609 |
507 | 3610 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, |
3611 prev->upstream.next_upstream, | |
3612 (NGX_CONF_BITMASK_SET | |
3613 |NGX_HTTP_UPSTREAM_FT_ERROR | |
3614 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); | |
3615 | |
665 | 3616 if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) { |
3617 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET | |
3618 |NGX_HTTP_UPSTREAM_FT_OFF; | |
3619 } | |
3620 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3621 if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path, |
509 | 3622 prev->upstream.temp_path, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3623 &ngx_http_proxy_temp_path) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3624 != NGX_OK) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3625 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3626 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3627 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3628 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3629 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3630 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3631 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3632 if (conf->upstream.cache == NGX_CONF_UNSET) { |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3633 ngx_conf_merge_value(conf->upstream.cache, |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3634 prev->upstream.cache, 0); |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3635 |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3636 conf->upstream.cache_zone = prev->upstream.cache_zone; |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3637 conf->upstream.cache_value = prev->upstream.cache_value; |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3638 } |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3639 |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3640 if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3641 ngx_shm_zone_t *shm_zone; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3642 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3643 shm_zone = conf->upstream.cache_zone; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3644 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3645 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3646 "\"proxy_cache\" zone \"%V\" is unknown", |
2716
d5896f6608e8
move zone name from ngx_shm_zone_t to ngx_shm_t to use Win32 shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
2706
diff
changeset
|
3647 &shm_zone->shm.name); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3648 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3649 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3650 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3651 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3652 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3653 prev->upstream.cache_min_uses, 1); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3654 |
6793
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3655 ngx_conf_merge_off_value(conf->upstream.cache_max_range_offset, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3656 prev->upstream.cache_max_range_offset, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3657 NGX_MAX_OFF_T_VALUE); |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3658 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3659 ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3660 prev->upstream.cache_use_stale, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3661 (NGX_CONF_BITMASK_SET |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3662 |NGX_HTTP_UPSTREAM_FT_OFF)); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3663 |
4401
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3664 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3665 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3666 |NGX_HTTP_UPSTREAM_FT_OFF; |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3667 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3668 |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3669 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) { |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3670 conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE; |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3671 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3672 |
2875
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3673 if (conf->upstream.cache_methods == 0) { |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3674 conf->upstream.cache_methods = prev->upstream.cache_methods; |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3675 } |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3676 |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3677 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD; |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3678 |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
3679 ngx_conf_merge_ptr_value(conf->upstream.cache_bypass, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
3680 prev->upstream.cache_bypass, NULL); |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
3681 |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3682 ngx_conf_merge_ptr_value(conf->upstream.no_cache, |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3683 prev->upstream.no_cache, NULL); |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3684 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3685 ngx_conf_merge_ptr_value(conf->upstream.cache_valid, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3686 prev->upstream.cache_valid, NULL); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3687 |
2672 | 3688 if (conf->cache_key.value.data == NULL) { |
3689 conf->cache_key = prev->cache_key; | |
3690 } | |
3691 | |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3692 ngx_conf_merge_value(conf->upstream.cache_lock, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3693 prev->upstream.cache_lock, 0); |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3694 |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3695 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3696 prev->upstream.cache_lock_timeout, 5000); |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3697 |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3698 ngx_conf_merge_msec_value(conf->upstream.cache_lock_age, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3699 prev->upstream.cache_lock_age, 5000); |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3700 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3701 ngx_conf_merge_value(conf->upstream.cache_revalidate, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3702 prev->upstream.cache_revalidate, 0); |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3703 |
6290
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3704 ngx_conf_merge_value(conf->upstream.cache_convert_head, |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3705 prev->upstream.cache_convert_head, 1); |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3706 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3707 ngx_conf_merge_value(conf->upstream.cache_background_update, |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3708 prev->upstream.cache_background_update, 0); |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3709 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3710 #endif |
507 | 3711 |
509 | 3712 ngx_conf_merge_value(conf->upstream.pass_request_headers, |
3713 prev->upstream.pass_request_headers, 1); | |
3714 ngx_conf_merge_value(conf->upstream.pass_request_body, | |
3715 prev->upstream.pass_request_body, 1); | |
3716 | |
657 | 3717 ngx_conf_merge_value(conf->upstream.intercept_errors, |
3718 prev->upstream.intercept_errors, 0); | |
509 | 3719 |
2184 | 3720 #if (NGX_HTTP_SSL) |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3721 |
2184 | 3722 ngx_conf_merge_value(conf->upstream.ssl_session_reuse, |
3723 prev->upstream.ssl_session_reuse, 1); | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3724 |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3725 ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols, |
6157
b2899e7d0ef8
Disabled SSLv3 by default (ticket #653).
Maxim Dounin <mdounin@mdounin.ru>
parents:
6056
diff
changeset
|
3726 (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1 |
b2899e7d0ef8
Disabled SSLv3 by default (ticket #653).
Maxim Dounin <mdounin@mdounin.ru>
parents:
6056
diff
changeset
|
3727 |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2)); |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3728 |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3729 ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3730 "DEFAULT"); |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3731 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3732 ngx_conf_merge_ptr_value(conf->upstream.ssl_name, |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3733 prev->upstream.ssl_name, NULL); |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3734 ngx_conf_merge_value(conf->upstream.ssl_server_name, |
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3735 prev->upstream.ssl_server_name, 0); |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3736 ngx_conf_merge_value(conf->upstream.ssl_verify, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3737 prev->upstream.ssl_verify, 0); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3738 ngx_conf_merge_uint_value(conf->ssl_verify_depth, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3739 prev->ssl_verify_depth, 1); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3740 ngx_conf_merge_str_value(conf->ssl_trusted_certificate, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3741 prev->ssl_trusted_certificate, ""); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3742 ngx_conf_merge_str_value(conf->ssl_crl, prev->ssl_crl, ""); |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3743 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3744 ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3745 prev->upstream.ssl_certificate, NULL); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3746 ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate_key, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3747 prev->upstream.ssl_certificate_key, NULL); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3748 ngx_conf_merge_ptr_value(conf->upstream.ssl_passwords, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3749 prev->upstream.ssl_passwords, NULL); |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
3750 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3751 ngx_conf_merge_ptr_value(conf->ssl_conf_commands, |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3752 prev->ssl_conf_commands, NULL); |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3753 |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3754 if (conf->ssl && ngx_http_proxy_set_ssl(cf, conf) != NGX_OK) { |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3755 return NGX_CONF_ERROR; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3756 } |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3757 |
2184 | 3758 #endif |
3759 | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3760 ngx_conf_merge_ptr_value(conf->method, prev->method, NULL); |
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3761 |
509 | 3762 ngx_conf_merge_value(conf->redirect, prev->redirect, 1); |
3763 | |
3764 if (conf->redirect) { | |
507 | 3765 |
509 | 3766 if (conf->redirects == NULL) { |
3767 conf->redirects = prev->redirects; | |
3768 } | |
3769 | |
1658 | 3770 if (conf->redirects == NULL && conf->url.data) { |
509 | 3771 |
3772 conf->redirects = ngx_array_create(cf->pool, 1, | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3773 sizeof(ngx_http_proxy_rewrite_t)); |
509 | 3774 if (conf->redirects == NULL) { |
3775 return NGX_CONF_ERROR; | |
3776 } | |
3777 | |
3778 pr = ngx_array_push(conf->redirects); | |
3779 if (pr == NULL) { | |
3780 return NGX_CONF_ERROR; | |
3781 } | |
3782 | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3783 ngx_memzero(&pr->pattern.complex, |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3784 sizeof(ngx_http_complex_value_t)); |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3785 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3786 ngx_memzero(&pr->replacement, sizeof(ngx_http_complex_value_t)); |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3787 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3788 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
1658 | 3789 |
3790 if (conf->vars.uri.len) { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3791 pr->pattern.complex.value = conf->url; |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3792 pr->replacement.value = conf->location; |
653 | 3793 |
3794 } else { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3795 pr->pattern.complex.value.len = conf->url.len |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3796 + sizeof("/") - 1; |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3797 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3798 p = ngx_pnalloc(cf->pool, pr->pattern.complex.value.len); |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3799 if (p == NULL) { |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3800 return NGX_CONF_ERROR; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3801 } |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3802 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3803 pr->pattern.complex.value.data = p; |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3804 |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3805 p = ngx_cpymem(p, conf->url.data, conf->url.len); |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3806 *p = '/'; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3807 |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3808 ngx_str_set(&pr->replacement.value, "/"); |
653 | 3809 } |
509 | 3810 } |
3811 } | |
3812 | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3813 ngx_conf_merge_ptr_value(conf->cookie_domains, prev->cookie_domains, NULL); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3814 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
3815 ngx_conf_merge_ptr_value(conf->cookie_paths, prev->cookie_paths, NULL); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
3816 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3817 ngx_conf_merge_ptr_value(conf->cookie_flags, prev->cookie_flags, NULL); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3818 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3819 ngx_conf_merge_uint_value(conf->http_version, prev->http_version, |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3820 NGX_HTTP_VERSION_10); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3821 |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3822 ngx_conf_merge_uint_value(conf->headers_hash_max_size, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3823 prev->headers_hash_max_size, 512); |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3824 |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3825 ngx_conf_merge_uint_value(conf->headers_hash_bucket_size, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3826 prev->headers_hash_bucket_size, 64); |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3827 |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3828 conf->headers_hash_bucket_size = ngx_align(conf->headers_hash_bucket_size, |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3829 ngx_cacheline_size); |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3830 |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3831 hash.max_size = conf->headers_hash_max_size; |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3832 hash.bucket_size = conf->headers_hash_bucket_size; |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3833 hash.name = "proxy_headers_hash"; |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3834 |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3835 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, |
3670
2728c4e4a9ae
do not use a cache headers set to hide
Igor Sysoev <igor@sysoev.ru>
parents:
3667
diff
changeset
|
3836 &prev->upstream, ngx_http_proxy_hide_headers, &hash) |
649 | 3837 != NGX_OK) |
3838 { | |
3839 return NGX_CONF_ERROR; | |
3840 } | |
3841 | |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3842 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3843 |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3844 if (clcf->noname |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3845 && conf->upstream.upstream == NULL && conf->proxy_lengths == NULL) |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3846 { |
884 | 3847 conf->upstream.upstream = prev->upstream.upstream; |
5939
aeea0522332f
Proxy: fixed incorrect URI change due to if (ticket #86).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5938
diff
changeset
|
3848 conf->location = prev->location; |
1658 | 3849 conf->vars = prev->vars; |
5937
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3850 |
3734
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3851 conf->proxy_lengths = prev->proxy_lengths; |
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3852 conf->proxy_values = prev->proxy_values; |
5937
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3853 |
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3854 #if (NGX_HTTP_SSL) |
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3855 conf->upstream.ssl = prev->upstream.ssl; |
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3856 #endif |
3734
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3857 } |
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3858 |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3859 if (clcf->lmt_excpt && clcf->handler == NULL |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3860 && (conf->upstream.upstream || conf->proxy_lengths)) |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3861 { |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3862 clcf->handler = ngx_http_proxy_handler; |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
3863 } |
577 | 3864 |
3865 if (conf->body_source.data == NULL) { | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3866 conf->body_flushes = prev->body_flushes; |
577 | 3867 conf->body_source = prev->body_source; |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3868 conf->body_lengths = prev->body_lengths; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3869 conf->body_values = prev->body_values; |
577 | 3870 } |
3871 | |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3872 if (conf->body_source.data && conf->body_lengths == NULL) { |
577 | 3873 |
3874 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
3875 | |
3876 sc.cf = cf; | |
3877 sc.source = &conf->body_source; | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3878 sc.flushes = &conf->body_flushes; |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3879 sc.lengths = &conf->body_lengths; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3880 sc.values = &conf->body_values; |
577 | 3881 sc.complete_lengths = 1; |
3882 sc.complete_values = 1; | |
3883 | |
3884 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
3885 return NGX_CONF_ERROR; | |
3886 } | |
3887 } | |
3888 | |
7728
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3889 ngx_conf_merge_ptr_value(conf->headers_source, prev->headers_source, NULL); |
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3890 |
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3891 if (conf->headers_source == prev->headers_source) { |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3892 conf->headers = prev->headers; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3893 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3894 conf->headers_cache = prev->headers_cache; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3895 #endif |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3896 } |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3897 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3898 rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers, |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3899 ngx_http_proxy_headers); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3900 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3901 return NGX_CONF_ERROR; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3902 } |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3903 |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3904 #if (NGX_HTTP_CACHE) |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3905 |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3906 if (conf->upstream.cache) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3907 rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers_cache, |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3908 ngx_http_proxy_cache_headers); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3909 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3910 return NGX_CONF_ERROR; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3911 } |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3912 } |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3913 |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3914 #endif |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3915 |
6747
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3916 /* |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3917 * special handling to preserve conf->headers in the "http" section |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3918 * to inherit it to all servers |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3919 */ |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3920 |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3921 if (prev->headers.hash.buckets == NULL |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3922 && conf->headers_source == prev->headers_source) |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3923 { |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3924 prev->headers = conf->headers; |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3925 #if (NGX_HTTP_CACHE) |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3926 prev->headers_cache = conf->headers_cache; |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3927 #endif |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3928 } |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3929 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3930 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3931 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3932 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3933 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3934 static ngx_int_t |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3935 ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf, |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3936 ngx_http_proxy_headers_t *headers, ngx_keyval_t *default_headers) |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3937 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3938 u_char *p; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3939 size_t size; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3940 uintptr_t *code; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3941 ngx_uint_t i; |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3942 ngx_array_t headers_names, headers_merged; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3943 ngx_keyval_t *src, *s, *h; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3944 ngx_hash_key_t *hk; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3945 ngx_hash_init_t hash; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3946 ngx_http_script_compile_t sc; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3947 ngx_http_script_copy_code_t *copy; |
577 | 3948 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3949 if (headers->hash.buckets) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3950 return NGX_OK; |
509 | 3951 } |
3952 | |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
3953 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t)) |
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
3954 != NGX_OK) |
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
3955 { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3956 return NGX_ERROR; |
509 | 3957 } |
3958 | |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3959 if (ngx_array_init(&headers_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t)) |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3960 != NGX_OK) |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3961 { |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3962 return NGX_ERROR; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3963 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3964 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3965 headers->lengths = ngx_array_create(cf->pool, 64, 1); |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3966 if (headers->lengths == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3967 return NGX_ERROR; |
509 | 3968 } |
3969 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3970 headers->values = ngx_array_create(cf->pool, 512, 1); |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3971 if (headers->values == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3972 return NGX_ERROR; |
509 | 3973 } |
3974 | |
6746
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3975 if (conf->headers_source) { |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3976 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3977 src = conf->headers_source->elts; |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3978 for (i = 0; i < conf->headers_source->nelts; i++) { |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3979 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3980 s = ngx_array_push(&headers_merged); |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3981 if (s == NULL) { |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3982 return NGX_ERROR; |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3983 } |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3984 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3985 *s = src[i]; |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3986 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3987 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3988 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3989 h = default_headers; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3990 |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
3991 while (h->key.len) { |
509 | 3992 |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3993 src = headers_merged.elts; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3994 for (i = 0; i < headers_merged.nelts; i++) { |
509 | 3995 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { |
3996 goto next; | |
507 | 3997 } |
3998 } | |
3999 | |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4000 s = ngx_array_push(&headers_merged); |
509 | 4001 if (s == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4002 return NGX_ERROR; |
507 | 4003 } |
4004 | |
509 | 4005 *s = *h; |
507 | 4006 |
509 | 4007 next: |
507 | 4008 |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
4009 h++; |
509 | 4010 } |
507 | 4011 |
577 | 4012 |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4013 src = headers_merged.elts; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4014 for (i = 0; i < headers_merged.nelts; i++) { |
507 | 4015 |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
4016 hk = ngx_array_push(&headers_names); |
649 | 4017 if (hk == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4018 return NGX_ERROR; |
507 | 4019 } |
4020 | |
649 | 4021 hk->key = src[i].key; |
4022 hk->key_hash = ngx_hash_key_lc(src[i].key.data, src[i].key.len); | |
4023 hk->value = (void *) 1; | |
509 | 4024 |
519 | 4025 if (src[i].value.len == 0) { |
4026 continue; | |
4027 } | |
4028 | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4029 copy = ngx_array_push_n(headers->lengths, |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4030 sizeof(ngx_http_script_copy_code_t)); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4031 if (copy == NULL) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4032 return NGX_ERROR; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4033 } |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4034 |
7271
9e25a5380a21
Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents:
7238
diff
changeset
|
4035 copy->code = (ngx_http_script_code_pt) (void *) |
9e25a5380a21
Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents:
7238
diff
changeset
|
4036 ngx_http_script_copy_len_code; |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4037 copy->len = src[i].key.len; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4038 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4039 size = (sizeof(ngx_http_script_copy_code_t) |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4040 + src[i].key.len + sizeof(uintptr_t) - 1) |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4041 & ~(sizeof(uintptr_t) - 1); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4042 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4043 copy = ngx_array_push_n(headers->values, size); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4044 if (copy == NULL) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4045 return NGX_ERROR; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4046 } |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4047 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4048 copy->code = ngx_http_script_copy_code; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4049 copy->len = src[i].key.len; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4050 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4051 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4052 ngx_memcpy(p, src[i].key.data, src[i].key.len); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4053 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4054 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4055 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4056 sc.cf = cf; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4057 sc.source = &src[i].value; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4058 sc.flushes = &headers->flushes; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4059 sc.lengths = &headers->lengths; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4060 sc.values = &headers->values; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4061 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4062 if (ngx_http_script_compile(&sc) != NGX_OK) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4063 return NGX_ERROR; |
507 | 4064 } |
4065 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4066 code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t)); |
509 | 4067 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4068 return NGX_ERROR; |
507 | 4069 } |
4070 | |
509 | 4071 *code = (uintptr_t) NULL; |
4072 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4073 code = ngx_array_push_n(headers->values, sizeof(uintptr_t)); |
509 | 4074 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4075 return NGX_ERROR; |
509 | 4076 } |
4077 | |
4078 *code = (uintptr_t) NULL; | |
507 | 4079 } |
4080 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4081 code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t)); |
509 | 4082 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4083 return NGX_ERROR; |
507 | 4084 } |
4085 | |
509 | 4086 *code = (uintptr_t) NULL; |
507 | 4087 |
4088 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4089 hash.hash = &headers->hash; |
649 | 4090 hash.key = ngx_hash_key_lc; |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
4091 hash.max_size = conf->headers_hash_max_size; |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
4092 hash.bucket_size = conf->headers_hash_bucket_size; |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
4093 hash.name = "proxy_headers_hash"; |
649 | 4094 hash.pool = cf->pool; |
4095 hash.temp_pool = NULL; | |
4096 | |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
4097 return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts); |
507 | 4098 } |
4099 | |
4100 | |
4101 static char * | |
4102 ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4103 { | |
509 | 4104 ngx_http_proxy_loc_conf_t *plcf = conf; |
507 | 4105 |
1658 | 4106 size_t add; |
4107 u_short port; | |
4108 ngx_str_t *value, *url; | |
4109 ngx_url_t u; | |
4110 ngx_uint_t n; | |
4111 ngx_http_core_loc_conf_t *clcf; | |
4112 ngx_http_script_compile_t sc; | |
507 | 4113 |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4114 if (plcf->upstream.upstream || plcf->proxy_lengths) { |
555 | 4115 return "is duplicate"; |
4116 } | |
4117 | |
1658 | 4118 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
4119 | |
2989
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4120 clcf->handler = ngx_http_proxy_handler; |
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4121 |
7321
45e513c3540d
Fixed invalid access to location defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
7320
diff
changeset
|
4122 if (clcf->name.len && clcf->name.data[clcf->name.len - 1] == '/') { |
2989
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4123 clcf->auto_redirect = 1; |
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4124 } |
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4125 |
507 | 4126 value = cf->args->elts; |
4127 | |
4128 url = &value[1]; | |
4129 | |
1658 | 4130 n = ngx_http_script_variables_count(url); |
4131 | |
4132 if (n) { | |
4133 | |
4134 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
4135 | |
4136 sc.cf = cf; | |
4137 sc.source = url; | |
4138 sc.lengths = &plcf->proxy_lengths; | |
4139 sc.values = &plcf->proxy_values; | |
4140 sc.variables = n; | |
4141 sc.complete_lengths = 1; | |
4142 sc.complete_values = 1; | |
1679
ca317d9b5c09
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1671
diff
changeset
|
4143 |
1658 | 4144 if (ngx_http_script_compile(&sc) != NGX_OK) { |
4145 return NGX_CONF_ERROR; | |
4146 } | |
4147 | |
4148 #if (NGX_HTTP_SSL) | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4149 plcf->ssl = 1; |
1658 | 4150 #endif |
4151 | |
4152 return NGX_CONF_OK; | |
4153 } | |
4154 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
969
diff
changeset
|
4155 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { |
577 | 4156 add = 7; |
591 | 4157 port = 80; |
577 | 4158 |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
969
diff
changeset
|
4159 } else if (ngx_strncasecmp(url->data, (u_char *) "https://", 8) == 0) { |
577 | 4160 |
4161 #if (NGX_HTTP_SSL) | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4162 plcf->ssl = 1; |
577 | 4163 |
4164 add = 8; | |
591 | 4165 port = 443; |
577 | 4166 #else |
4167 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4168 "https protocol requires SSL support"); | |
4169 return NGX_CONF_ERROR; | |
4170 #endif | |
4171 | |
4172 } else { | |
507 | 4173 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix"); |
4174 return NGX_CONF_ERROR; | |
4175 } | |
4176 | |
651 | 4177 ngx_memzero(&u, sizeof(ngx_url_t)); |
4178 | |
4179 u.url.len = url->len - add; | |
4180 u.url.data = url->data + add; | |
906 | 4181 u.default_port = port; |
4182 u.uri_part = 1; | |
884 | 4183 u.no_resolve = 1; |
4184 | |
4185 plcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); | |
4186 if (plcf->upstream.upstream == NULL) { | |
507 | 4187 return NGX_CONF_ERROR; |
4188 } | |
4189 | |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4190 plcf->vars.schema.len = add; |
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4191 plcf->vars.schema.data = url->data; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4192 plcf->vars.key_start = plcf->vars.schema; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4193 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4194 ngx_http_proxy_set_vars(&u, &plcf->vars); |
507 | 4195 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4196 plcf->location = clcf->name; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4197 |
1353 | 4198 if (clcf->named |
507 | 4199 #if (NGX_PCRE) |
1353 | 4200 || clcf->regex |
4201 #endif | |
4202 || clcf->noname) | |
4203 { | |
1658 | 4204 if (plcf->vars.uri.len) { |
573 | 4205 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4206 "\"proxy_pass\" cannot have URI part in " |
843
ebab9490204c
allow proxy_pass inside limit_except
Igor Sysoev <igor@sysoev.ru>
parents:
812
diff
changeset
|
4207 "location given by regular expression, " |
1353 | 4208 "or inside named location, " |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4209 "or inside \"if\" statement, " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4210 "or inside \"limit_except\" block"); |
573 | 4211 return NGX_CONF_ERROR; |
4212 } | |
4213 | |
1658 | 4214 plcf->location.len = 0; |
555 | 4215 } |
4216 | |
1658 | 4217 plcf->url = *url; |
509 | 4218 |
507 | 4219 return NGX_CONF_OK; |
4220 } | |
4221 | |
4222 | |
4223 static char * | |
509 | 4224 ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
507 | 4225 { |
509 | 4226 ngx_http_proxy_loc_conf_t *plcf = conf; |
4227 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4228 u_char *p; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4229 ngx_str_t *value; |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4230 ngx_http_proxy_rewrite_t *pr; |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4231 ngx_http_compile_complex_value_t ccv; |
509 | 4232 |
4233 if (plcf->redirect == 0) { | |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4234 return "is duplicate"; |
509 | 4235 } |
4236 | |
4422
b1a9d725ab69
Fixed proxy_redirect off inheritance.
Valentin Bartenev <vbart@nginx.com>
parents:
4412
diff
changeset
|
4237 plcf->redirect = 1; |
b1a9d725ab69
Fixed proxy_redirect off inheritance.
Valentin Bartenev <vbart@nginx.com>
parents:
4412
diff
changeset
|
4238 |
509 | 4239 value = cf->args->elts; |
4240 | |
2784
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4241 if (cf->args->nelts == 2) { |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4242 if (ngx_strcmp(value[1].data, "off") == 0) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4243 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4244 if (plcf->redirects) { |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4245 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4246 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4247 |
2784
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4248 plcf->redirect = 0; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4249 return NGX_CONF_OK; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4250 } |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4251 |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4252 if (ngx_strcmp(value[1].data, "default") != 0) { |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4253 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4254 "invalid parameter \"%V\"", &value[1]); |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4255 return NGX_CONF_ERROR; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4256 } |
509 | 4257 } |
4258 | |
4259 if (plcf->redirects == NULL) { | |
4260 plcf->redirects = ngx_array_create(cf->pool, 1, | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4261 sizeof(ngx_http_proxy_rewrite_t)); |
509 | 4262 if (plcf->redirects == NULL) { |
4263 return NGX_CONF_ERROR; | |
4264 } | |
4265 } | |
4266 | |
4267 pr = ngx_array_push(plcf->redirects); | |
4268 if (pr == NULL) { | |
4269 return NGX_CONF_ERROR; | |
4270 } | |
4271 | |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4272 if (cf->args->nelts == 2 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4273 && ngx_strcmp(value[1].data, "default") == 0) |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4274 { |
3471
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4275 if (plcf->proxy_lengths) { |
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4276 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4277 "\"proxy_redirect default\" cannot be used " |
3471
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4278 "with \"proxy_pass\" directive with variables"); |
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4279 return NGX_CONF_ERROR; |
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4280 } |
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4281 |
1658 | 4282 if (plcf->url.data == NULL) { |
509 | 4283 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4284 "\"proxy_redirect default\" should be placed " |
509 | 4285 "after the \"proxy_pass\" directive"); |
4286 return NGX_CONF_ERROR; | |
4287 } | |
4288 | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4289 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4290 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4291 ngx_memzero(&pr->pattern.complex, sizeof(ngx_http_complex_value_t)); |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4292 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4293 ngx_memzero(&pr->replacement, sizeof(ngx_http_complex_value_t)); |
1658 | 4294 |
4295 if (plcf->vars.uri.len) { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4296 pr->pattern.complex.value = plcf->url; |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4297 pr->replacement.value = plcf->location; |
653 | 4298 |
4299 } else { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4300 pr->pattern.complex.value.len = plcf->url.len + sizeof("/") - 1; |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4301 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4302 p = ngx_pnalloc(cf->pool, pr->pattern.complex.value.len); |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4303 if (p == NULL) { |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4304 return NGX_CONF_ERROR; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4305 } |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4306 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4307 pr->pattern.complex.value.data = p; |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4308 |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4309 p = ngx_cpymem(p, plcf->url.data, plcf->url.len); |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4310 *p = '/'; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4311 |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4312 ngx_str_set(&pr->replacement.value, "/"); |
653 | 4313 } |
509 | 4314 |
4315 return NGX_CONF_OK; | |
4316 } | |
4317 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4318 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4319 if (value[1].data[0] == '~') { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4320 value[1].len--; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4321 value[1].data++; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4322 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4323 if (value[1].data[0] == '*') { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4324 value[1].len--; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4325 value[1].data++; |
4463
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4326 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4327 if (ngx_http_proxy_rewrite_regex(cf, pr, &value[1], 1) != NGX_OK) { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4328 return NGX_CONF_ERROR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4329 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4330 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4331 } else { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4332 if (ngx_http_proxy_rewrite_regex(cf, pr, &value[1], 0) != NGX_OK) { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4333 return NGX_CONF_ERROR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4334 } |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4335 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4336 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4337 } else { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4338 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4339 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4340 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4341 ccv.cf = cf; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4342 ccv.value = &value[1]; |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4343 ccv.complex_value = &pr->pattern.complex; |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4344 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4345 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4346 return NGX_CONF_ERROR; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4347 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4348 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4349 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
509 | 4350 } |
4351 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4352 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4353 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4354 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4355 ccv.cf = cf; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4356 ccv.value = &value[2]; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4357 ccv.complex_value = &pr->replacement; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4358 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4359 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
509 | 4360 return NGX_CONF_ERROR; |
4361 } | |
4362 | |
507 | 4363 return NGX_CONF_OK; |
4364 } | |
4365 | |
4366 | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4367 static char * |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4368 ngx_http_proxy_cookie_domain(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4369 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4370 ngx_http_proxy_loc_conf_t *plcf = conf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4371 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4372 ngx_str_t *value; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4373 ngx_http_proxy_rewrite_t *pr; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4374 ngx_http_compile_complex_value_t ccv; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4375 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4376 if (plcf->cookie_domains == NULL) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4377 return "is duplicate"; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4378 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4379 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4380 value = cf->args->elts; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4381 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4382 if (cf->args->nelts == 2) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4383 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4384 if (ngx_strcmp(value[1].data, "off") == 0) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4385 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4386 if (plcf->cookie_domains != NGX_CONF_UNSET_PTR) { |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4387 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4388 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4389 |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4390 plcf->cookie_domains = NULL; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4391 return NGX_CONF_OK; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4392 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4393 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4394 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4395 "invalid parameter \"%V\"", &value[1]); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4396 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4397 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4398 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4399 if (plcf->cookie_domains == NGX_CONF_UNSET_PTR) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4400 plcf->cookie_domains = ngx_array_create(cf->pool, 1, |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4401 sizeof(ngx_http_proxy_rewrite_t)); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4402 if (plcf->cookie_domains == NULL) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4403 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4404 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4405 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4406 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4407 pr = ngx_array_push(plcf->cookie_domains); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4408 if (pr == NULL) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4409 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4410 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4411 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4412 if (value[1].data[0] == '~') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4413 value[1].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4414 value[1].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4415 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4416 if (ngx_http_proxy_rewrite_regex(cf, pr, &value[1], 1) != NGX_OK) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4417 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4418 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4419 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4420 } else { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4421 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4422 if (value[1].data[0] == '.') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4423 value[1].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4424 value[1].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4425 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4426 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4427 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4428 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4429 ccv.cf = cf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4430 ccv.value = &value[1]; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4431 ccv.complex_value = &pr->pattern.complex; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4432 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4433 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4434 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4435 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4436 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4437 pr->handler = ngx_http_proxy_rewrite_domain_handler; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4438 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4439 if (value[2].data[0] == '.') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4440 value[2].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4441 value[2].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4442 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4443 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4444 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4445 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4446 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4447 ccv.cf = cf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4448 ccv.value = &value[2]; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4449 ccv.complex_value = &pr->replacement; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4450 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4451 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4452 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4453 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4454 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4455 return NGX_CONF_OK; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4456 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4457 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4458 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4459 static char * |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4460 ngx_http_proxy_cookie_path(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4461 { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4462 ngx_http_proxy_loc_conf_t *plcf = conf; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4463 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4464 ngx_str_t *value; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4465 ngx_http_proxy_rewrite_t *pr; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4466 ngx_http_compile_complex_value_t ccv; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4467 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4468 if (plcf->cookie_paths == NULL) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4469 return "is duplicate"; |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4470 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4471 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4472 value = cf->args->elts; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4473 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4474 if (cf->args->nelts == 2) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4475 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4476 if (ngx_strcmp(value[1].data, "off") == 0) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4477 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4478 if (plcf->cookie_paths != NGX_CONF_UNSET_PTR) { |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4479 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4480 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4481 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4482 plcf->cookie_paths = NULL; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4483 return NGX_CONF_OK; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4484 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4485 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4486 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4487 "invalid parameter \"%V\"", &value[1]); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4488 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4489 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4490 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4491 if (plcf->cookie_paths == NGX_CONF_UNSET_PTR) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4492 plcf->cookie_paths = ngx_array_create(cf->pool, 1, |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4493 sizeof(ngx_http_proxy_rewrite_t)); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4494 if (plcf->cookie_paths == NULL) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4495 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4496 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4497 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4498 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4499 pr = ngx_array_push(plcf->cookie_paths); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4500 if (pr == NULL) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4501 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4502 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4503 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4504 if (value[1].data[0] == '~') { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4505 value[1].len--; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4506 value[1].data++; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4507 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4508 if (value[1].data[0] == '*') { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4509 value[1].len--; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4510 value[1].data++; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4511 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4512 if (ngx_http_proxy_rewrite_regex(cf, pr, &value[1], 1) != NGX_OK) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4513 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4514 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4515 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4516 } else { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4517 if (ngx_http_proxy_rewrite_regex(cf, pr, &value[1], 0) != NGX_OK) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4518 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4519 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4520 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4521 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4522 } else { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4523 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4524 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4525 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4526 ccv.cf = cf; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4527 ccv.value = &value[1]; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4528 ccv.complex_value = &pr->pattern.complex; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4529 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4530 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4531 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4532 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4533 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4534 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4535 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4536 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4537 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4538 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4539 ccv.cf = cf; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4540 ccv.value = &value[2]; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4541 ccv.complex_value = &pr->replacement; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4542 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4543 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4544 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4545 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4546 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4547 return NGX_CONF_OK; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4548 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4549 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4550 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4551 static char * |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4552 ngx_http_proxy_cookie_flags(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4553 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4554 ngx_http_proxy_loc_conf_t *plcf = conf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4555 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4556 ngx_str_t *value; |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4557 ngx_uint_t i; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4558 ngx_http_complex_value_t *cv; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4559 ngx_http_proxy_cookie_flags_t *pcf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4560 ngx_http_compile_complex_value_t ccv; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4561 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4562 ngx_regex_compile_t rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4563 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4564 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4565 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4566 if (plcf->cookie_flags == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4567 return "is duplicate"; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4568 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4569 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4570 value = cf->args->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4571 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4572 if (cf->args->nelts == 2) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4573 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4574 if (ngx_strcmp(value[1].data, "off") == 0) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4575 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4576 if (plcf->cookie_flags != NGX_CONF_UNSET_PTR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4577 return "is duplicate"; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4578 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4579 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4580 plcf->cookie_flags = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4581 return NGX_CONF_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4582 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4583 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4584 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4585 "invalid parameter \"%V\"", &value[1]); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4586 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4587 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4588 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4589 if (plcf->cookie_flags == NGX_CONF_UNSET_PTR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4590 plcf->cookie_flags = ngx_array_create(cf->pool, 1, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4591 sizeof(ngx_http_proxy_cookie_flags_t)); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4592 if (plcf->cookie_flags == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4593 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4594 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4595 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4596 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4597 pcf = ngx_array_push(plcf->cookie_flags); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4598 if (pcf == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4599 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4600 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4601 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4602 pcf->regex = 0; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4603 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4604 if (value[1].data[0] == '~') { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4605 value[1].len--; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4606 value[1].data++; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4607 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4608 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4609 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4610 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4611 rc.pattern = value[1]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4612 rc.err.len = NGX_MAX_CONF_ERRSTR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4613 rc.err.data = errstr; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4614 rc.options = NGX_REGEX_CASELESS; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4615 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4616 pcf->cookie.regex = ngx_http_regex_compile(cf, &rc); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4617 if (pcf->cookie.regex == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4618 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4619 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4620 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4621 pcf->regex = 1; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4622 #else |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4623 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4624 "using regex \"%V\" requires PCRE library", |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4625 &value[1]); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4626 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4627 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4628 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4629 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4630 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4631 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4632 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4633 ccv.cf = cf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4634 ccv.value = &value[1]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4635 ccv.complex_value = &pcf->cookie.complex; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4636 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4637 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4638 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4639 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4640 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4641 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4642 if (ngx_array_init(&pcf->flags_values, cf->pool, cf->args->nelts - 2, |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4643 sizeof(ngx_http_complex_value_t)) |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4644 != NGX_OK) |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4645 { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4646 return NGX_CONF_ERROR; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4647 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4648 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4649 for (i = 2; i < cf->args->nelts; i++) { |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4650 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4651 cv = ngx_array_push(&pcf->flags_values); |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4652 if (cv == NULL) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4653 return NGX_CONF_ERROR; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4654 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4655 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4656 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4657 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4658 ccv.cf = cf; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4659 ccv.value = &value[i]; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4660 ccv.complex_value = cv; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4661 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4662 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4663 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4664 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4665 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4666 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4667 return NGX_CONF_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4668 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4669 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4670 |
4463
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4671 static ngx_int_t |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4672 ngx_http_proxy_rewrite_regex(ngx_conf_t *cf, ngx_http_proxy_rewrite_t *pr, |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4673 ngx_str_t *regex, ngx_uint_t caseless) |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4674 { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4675 #if (NGX_PCRE) |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4676 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4677 ngx_regex_compile_t rc; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4678 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4679 ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4680 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4681 rc.pattern = *regex; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4682 rc.err.len = NGX_MAX_CONF_ERRSTR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4683 rc.err.data = errstr; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4684 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4685 if (caseless) { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4686 rc.options = NGX_REGEX_CASELESS; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4687 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4688 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4689 pr->pattern.regex = ngx_http_regex_compile(cf, &rc); |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4690 if (pr->pattern.regex == NULL) { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4691 return NGX_ERROR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4692 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4693 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4694 pr->handler = ngx_http_proxy_rewrite_regex_handler; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4695 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4696 return NGX_OK; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4697 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4698 #else |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4699 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4700 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4701 "using regex \"%V\" requires PCRE library", regex); |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4702 return NGX_ERROR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4703 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4704 #endif |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4705 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4706 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4707 |
507 | 4708 static char * |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4709 ngx_http_proxy_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4710 { |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4711 ngx_http_proxy_loc_conf_t *plcf = conf; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4712 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4713 ngx_str_t *value; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4714 ngx_http_script_compile_t sc; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4715 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4716 if (plcf->upstream.store != NGX_CONF_UNSET) { |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4717 return "is duplicate"; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4718 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4719 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4720 value = cf->args->elts; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4721 |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4722 if (ngx_strcmp(value[1].data, "off") == 0) { |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4723 plcf->upstream.store = 0; |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4724 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4725 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4726 |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4727 #if (NGX_HTTP_CACHE) |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4728 if (plcf->upstream.cache > 0) { |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4729 return "is incompatible with \"proxy_cache\""; |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4730 } |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4731 #endif |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4732 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4733 plcf->upstream.store = 1; |
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4734 |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4735 if (ngx_strcmp(value[1].data, "on") == 0) { |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4736 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4737 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4738 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4739 /* include the terminating '\0' into script */ |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4740 value[1].len++; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4741 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4742 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4743 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4744 sc.cf = cf; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4745 sc.source = &value[1]; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4746 sc.lengths = &plcf->upstream.store_lengths; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4747 sc.values = &plcf->upstream.store_values; |
1563
022ec9420f80
style fix: remove double semicolons
Igor Sysoev <igor@sysoev.ru>
parents:
1488
diff
changeset
|
4748 sc.variables = ngx_http_script_variables_count(&value[1]); |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4749 sc.complete_lengths = 1; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4750 sc.complete_values = 1; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4751 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4752 if (ngx_http_script_compile(&sc) != NGX_OK) { |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4753 return NGX_CONF_ERROR; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4754 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4755 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4756 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4757 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4758 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4759 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4760 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4761 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4762 static char * |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4763 ngx_http_proxy_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4764 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4765 ngx_http_proxy_loc_conf_t *plcf = conf; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4766 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4767 ngx_str_t *value; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4768 ngx_http_complex_value_t cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4769 ngx_http_compile_complex_value_t ccv; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4770 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4771 value = cf->args->elts; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4772 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4773 if (plcf->upstream.cache != NGX_CONF_UNSET) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4774 return "is duplicate"; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4775 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4776 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4777 if (ngx_strcmp(value[1].data, "off") == 0) { |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4778 plcf->upstream.cache = 0; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4779 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4780 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4781 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4782 if (plcf->upstream.store > 0) { |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4783 return "is incompatible with \"proxy_store\""; |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4784 } |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4785 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4786 plcf->upstream.cache = 1; |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4787 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4788 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4789 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4790 ccv.cf = cf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4791 ccv.value = &value[1]; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4792 ccv.complex_value = &cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4793 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4794 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4795 return NGX_CONF_ERROR; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4796 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4797 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4798 if (cv.lengths != NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4799 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4800 plcf->upstream.cache_value = ngx_palloc(cf->pool, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4801 sizeof(ngx_http_complex_value_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4802 if (plcf->upstream.cache_value == NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4803 return NGX_CONF_ERROR; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4804 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4805 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4806 *plcf->upstream.cache_value = cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4807 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4808 return NGX_CONF_OK; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4809 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4810 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4811 plcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4812 &ngx_http_proxy_module); |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4813 if (plcf->upstream.cache_zone == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4814 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4815 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4816 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4817 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4818 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4819 |
2672 | 4820 |
4821 static char * | |
4822 ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4823 { | |
4824 ngx_http_proxy_loc_conf_t *plcf = conf; | |
4825 | |
4826 ngx_str_t *value; | |
4827 ngx_http_compile_complex_value_t ccv; | |
4828 | |
4829 value = cf->args->elts; | |
4830 | |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4927
diff
changeset
|
4831 if (plcf->cache_key.value.data) { |
2672 | 4832 return "is duplicate"; |
4833 } | |
4834 | |
4835 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
4836 | |
4837 ccv.cf = cf; | |
4838 ccv.value = &value[1]; | |
4839 ccv.complex_value = &plcf->cache_key; | |
4840 | |
4841 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
4842 return NGX_CONF_ERROR; | |
4843 } | |
4844 | |
4845 return NGX_CONF_OK; | |
4846 } | |
4847 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4848 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4849 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4850 |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4851 #if (NGX_HTTP_SSL) |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4852 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4853 static char * |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4854 ngx_http_proxy_ssl_password_file(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4855 { |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4856 ngx_http_proxy_loc_conf_t *plcf = conf; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4857 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4858 ngx_str_t *value; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4859 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4860 if (plcf->upstream.ssl_passwords != NGX_CONF_UNSET_PTR) { |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4861 return "is duplicate"; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4862 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4863 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4864 value = cf->args->elts; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4865 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4866 plcf->upstream.ssl_passwords = ngx_ssl_read_password_file(cf, &value[1]); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4867 |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4868 if (plcf->upstream.ssl_passwords == NULL) { |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4869 return NGX_CONF_ERROR; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4870 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4871 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4872 return NGX_CONF_OK; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4873 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4874 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4875 #endif |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4876 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4877 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4878 static char * |
507 | 4879 ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data) |
4880 { | |
4881 #if (NGX_FREEBSD) | |
4882 ssize_t *np = data; | |
4883 | |
673 | 4884 if ((u_long) *np >= ngx_freebsd_net_inet_tcp_sendspace) { |
507 | 4885 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4886 "\"proxy_send_lowat\" must be less than %d " | |
4887 "(sysctl net.inet.tcp.sendspace)", | |
4888 ngx_freebsd_net_inet_tcp_sendspace); | |
4889 | |
4890 return NGX_CONF_ERROR; | |
4891 } | |
4892 | |
4893 #elif !(NGX_HAVE_SO_SNDLOWAT) | |
4894 ssize_t *np = data; | |
4895 | |
4896 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4897 "\"proxy_send_lowat\" is not supported, ignored"); | |
4898 | |
4899 *np = 0; | |
4900 | |
4901 #endif | |
4902 | |
4903 return NGX_CONF_OK; | |
4904 } | |
884 | 4905 |
4906 | |
1658 | 4907 #if (NGX_HTTP_SSL) |
4908 | |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4909 static char * |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4910 ngx_http_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, void *data) |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4911 { |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4912 #ifndef SSL_CONF_FLAG_FILE |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4913 return "is not supported on this platform"; |
7787
7ce28b4cc57e
SSL: fixed build by Sun C with old OpenSSL versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7786
diff
changeset
|
4914 #else |
7ce28b4cc57e
SSL: fixed build by Sun C with old OpenSSL versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7786
diff
changeset
|
4915 return NGX_CONF_OK; |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4916 #endif |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4917 } |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4918 |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4919 |
1658 | 4920 static ngx_int_t |
4921 ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf) | |
4922 { | |
4923 ngx_pool_cleanup_t *cln; | |
4924 | |
4925 plcf->upstream.ssl = ngx_pcalloc(cf->pool, sizeof(ngx_ssl_t)); | |
4926 if (plcf->upstream.ssl == NULL) { | |
4927 return NGX_ERROR; | |
4928 } | |
4929 | |
4930 plcf->upstream.ssl->log = cf->log; | |
4931 | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4932 if (ngx_ssl_create(plcf->upstream.ssl, plcf->ssl_protocols, NULL) |
1658 | 4933 != NGX_OK) |
4934 { | |
4935 return NGX_ERROR; | |
4936 } | |
4937 | |
5659
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4938 cln = ngx_pool_cleanup_add(cf->pool, 0); |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4939 if (cln == NULL) { |
7473
8981dbb12254
SSL: fixed potential leak on memory allocation errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7371
diff
changeset
|
4940 ngx_ssl_cleanup_ctx(plcf->upstream.ssl); |
5659
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4941 return NGX_ERROR; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4942 } |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4943 |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4944 cln->handler = ngx_ssl_cleanup_ctx; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4945 cln->data = plcf->upstream.ssl; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4946 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4947 if (plcf->upstream.ssl_certificate) { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4948 |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4949 if (plcf->upstream.ssl_certificate_key == NULL) { |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4950 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4951 "no \"proxy_ssl_certificate_key\" is defined " |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4952 "for certificate \"%V\"", |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4953 &plcf->upstream.ssl_certificate->value); |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4954 return NGX_ERROR; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4955 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4956 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4957 if (plcf->upstream.ssl_certificate->lengths |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4958 || plcf->upstream.ssl_certificate_key->lengths) |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4959 { |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4960 plcf->upstream.ssl_passwords = |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4961 ngx_ssl_preserve_passwords(cf, plcf->upstream.ssl_passwords); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4962 if (plcf->upstream.ssl_passwords == NULL) { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4963 return NGX_ERROR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4964 } |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4965 |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4966 } else { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4967 if (ngx_ssl_certificate(cf, plcf->upstream.ssl, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4968 &plcf->upstream.ssl_certificate->value, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4969 &plcf->upstream.ssl_certificate_key->value, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4970 plcf->upstream.ssl_passwords) |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4971 != NGX_OK) |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4972 { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4973 return NGX_ERROR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4974 } |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4975 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4976 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4977 |
6591
04d8d1f85649
SSL: ngx_ssl_ciphers() to set list of ciphers.
Tim Taubert <tim@timtaubert.de>
parents:
6530
diff
changeset
|
4978 if (ngx_ssl_ciphers(cf, plcf->upstream.ssl, &plcf->ssl_ciphers, 0) |
04d8d1f85649
SSL: ngx_ssl_ciphers() to set list of ciphers.
Tim Taubert <tim@timtaubert.de>
parents:
6530
diff
changeset
|
4979 != NGX_OK) |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
4980 { |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
4981 return NGX_ERROR; |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
4982 } |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
4983 |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4984 if (plcf->upstream.ssl_verify) { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4985 if (plcf->ssl_trusted_certificate.len == 0) { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4986 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4987 "no proxy_ssl_trusted_certificate for proxy_ssl_verify"); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4988 return NGX_ERROR; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4989 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4990 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4991 if (ngx_ssl_trusted_certificate(cf, plcf->upstream.ssl, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4992 &plcf->ssl_trusted_certificate, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4993 plcf->ssl_verify_depth) |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4994 != NGX_OK) |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4995 { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4996 return NGX_ERROR; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4997 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4998 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4999 if (ngx_ssl_crl(cf, plcf->upstream.ssl, &plcf->ssl_crl) != NGX_OK) { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5000 return NGX_ERROR; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5001 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5002 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5003 |
7320
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5004 if (ngx_ssl_client_session_cache(cf, plcf->upstream.ssl, |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5005 plcf->upstream.ssl_session_reuse) |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5006 != NGX_OK) |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5007 { |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5008 return NGX_ERROR; |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5009 } |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5010 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5011 if (ngx_ssl_conf_commands(cf, plcf->upstream.ssl, plcf->ssl_conf_commands) |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5012 != NGX_OK) |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5013 { |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5014 return NGX_ERROR; |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5015 } |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5016 |
1658 | 5017 return NGX_OK; |
5018 } | |
5019 | |
5020 #endif | |
5021 | |
5022 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5023 static void |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5024 ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v) |
1658 | 5025 { |
2203
8e5bf1bc87e2
*) refactor ngx_parse_inet_url()
Igor Sysoev <igor@sysoev.ru>
parents:
2184
diff
changeset
|
5026 if (u->family != AF_UNIX) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5027 |
1658 | 5028 if (u->no_port || u->port == u->default_port) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5029 |
1658 | 5030 v->host_header = u->host; |
5031 | |
5032 if (u->default_port == 80) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5033 ngx_str_set(&v->port, "80"); |
1658 | 5034 |
5035 } else { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5036 ngx_str_set(&v->port, "443"); |
1658 | 5037 } |
5038 | |
5039 } else { | |
1671
8075179cae21
ngx_parse_url() saves port text, this allows to use it in proxy host header
Igor Sysoev <igor@sysoev.ru>
parents:
1667
diff
changeset
|
5040 v->host_header.len = u->host.len + 1 + u->port_text.len; |
8075179cae21
ngx_parse_url() saves port text, this allows to use it in proxy host header
Igor Sysoev <igor@sysoev.ru>
parents:
1667
diff
changeset
|
5041 v->host_header.data = u->host.data; |
8075179cae21
ngx_parse_url() saves port text, this allows to use it in proxy host header
Igor Sysoev <igor@sysoev.ru>
parents:
1667
diff
changeset
|
5042 v->port = u->port_text; |
1658 | 5043 } |
5044 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5045 v->key_start.len += v->host_header.len; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5046 |
1658 | 5047 } else { |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5048 ngx_str_set(&v->host_header, "localhost"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5049 ngx_str_null(&v->port); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5050 v->key_start.len += sizeof("unix:") - 1 + u->host.len + 1; |
1658 | 5051 } |
5052 | |
5053 v->uri = u->uri; | |
5054 } |