Mercurial > hg > nginx
annotate src/http/modules/ngx_http_proxy_module.c @ 8042:c7e25324be11
Upstream: handling of certificates specified as an empty string.
Now, if the directive is given an empty string, such configuration cancels
loading of certificates, in particular, if they would be otherwise inherited
from the previous level. This restores previous behaviour, before variables
support in certificates was introduced (3ab8e1e2f0f7).
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 07 Jun 2022 20:08:57 +0400 |
parents | 2bf7792c262e |
children | 9d98d524bd02 |
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 | |
8033
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1933 if (hh) { |
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1934 rc = hh->handler(r, h, hh->offset); |
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1935 |
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1936 if (rc != NGX_OK) { |
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1937 return rc; |
2bf7792c262e
Upstream: header handlers can now return parsing errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8032
diff
changeset
|
1938 } |
649 | 1939 } |
1940 | |
509 | 1941 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1942 "http proxy header: \"%V: %V\"", | |
1943 &h->key, &h->value); | |
1944 | |
1945 continue; | |
1946 } | |
1947 | |
1948 if (rc == NGX_HTTP_PARSE_HEADER_DONE) { | |
1949 | |
1950 /* a whole header has been parsed successfully */ | |
1951 | |
1952 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1953 "http proxy header done"); | |
1954 | |
649 | 1955 /* |
1956 * if no "Server" and "Date" in header line, | |
1957 * then add the special empty headers | |
1958 */ | |
1959 | |
1960 if (r->upstream->headers_in.server == NULL) { | |
1961 h = ngx_list_push(&r->upstream->headers_in.headers); | |
1962 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
|
1963 return NGX_ERROR; |
649 | 1964 } |
1965 | |
1966 h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash( | |
1967 ngx_hash('s', 'e'), 'r'), 'v'), 'e'), 'r'); | |
1968 | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1969 ngx_str_set(&h->key, "Server"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1970 ngx_str_null(&h->value); |
649 | 1971 h->lowcase_key = (u_char *) "server"; |
8032
2025aae94739
Upstream: all known headers in u->headers_in are linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1972 h->next = NULL; |
649 | 1973 } |
1974 | |
1975 if (r->upstream->headers_in.date == NULL) { | |
1976 h = ngx_list_push(&r->upstream->headers_in.headers); | |
1977 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
|
1978 return NGX_ERROR; |
649 | 1979 } |
1980 | |
1981 h->hash = ngx_hash(ngx_hash(ngx_hash('d', 'a'), 't'), 'e'); | |
1982 | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1983 ngx_str_set(&h->key, "Date"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
1984 ngx_str_null(&h->value); |
649 | 1985 h->lowcase_key = (u_char *) "date"; |
8032
2025aae94739
Upstream: all known headers in u->headers_in are linked lists now.
Maxim Dounin <mdounin@mdounin.ru>
parents:
8024
diff
changeset
|
1986 h->next = NULL; |
649 | 1987 } |
1988 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1989 /* 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
|
1990 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1991 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1992 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1993 if (u->headers_in.chunked) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1994 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
|
1995 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
1996 |
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 * 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
|
1999 * 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
|
2000 */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2001 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2002 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
|
2003 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2004 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
|
2005 || 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
|
2006 || ctx->head |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2007 || (!u->headers_in.chunked |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2008 && 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
|
2009 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2010 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
|
2011 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2012 |
5072
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2013 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
|
2014 u->keepalive = 0; |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2015 |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2016 if (r->headers_in.upgrade) { |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2017 u->upgrade = 1; |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2018 } |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2019 } |
7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5012
diff
changeset
|
2020 |
509 | 2021 return NGX_OK; |
2022 } | |
2023 | |
521 | 2024 if (rc == NGX_AGAIN) { |
2025 return NGX_AGAIN; | |
2026 } | |
2027 | |
7884
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2028 /* rc == NGX_HTTP_PARSE_INVALID_HEADER */ |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2029 |
7933
2f443cac3f1e
Upstream: fixed logging level of upstream invalid header errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7931
diff
changeset
|
2030 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
7884
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2031 "upstream sent invalid header: \"%*s\\x%02xd...\"", |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2032 r->header_end - r->header_name_start, |
b87b7092cedb
Improved logging of invalid headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7881
diff
changeset
|
2033 r->header_name_start, *r->header_end); |
509 | 2034 |
2035 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
2036 } | |
507 | 2037 } |
2038 | |
2039 | |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2040 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2041 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
|
2042 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2043 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2044 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2045 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2046 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2047 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2048 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
|
2049 |
4602
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2050 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2051 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2052 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2053 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2054 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
6480 | 2055 "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
|
2056 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
|
2057 u->headers_in.content_length_n); |
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 /* 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
|
2060 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2061 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
|
2062 || 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
|
2063 || ctx->head) |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2064 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2065 /* 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
|
2066 /* 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
|
2067 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2068 u->pipe->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2069 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2070 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
|
2071 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2072 } else if (u->headers_in.chunked) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2073 /* chunked */ |
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 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
|
2076 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
|
2077 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2078 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
|
2079 u->length = 1; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2080 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2081 } 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
|
2082 /* 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
|
2083 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2084 u->pipe->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2085 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2086 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
|
2087 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2088 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2089 /* content length or connection close */ |
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 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
|
2092 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
|
2093 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2094 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2095 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2096 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2097 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2098 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2099 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2100 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
|
2101 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2102 ngx_buf_t *b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2103 ngx_chain_t *cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2104 ngx_http_request_t *r; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2105 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2106 if (buf->pos == buf->last) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2107 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2108 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2109 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2110 if (p->upstream_done) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2111 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
|
2112 "http proxy data after close"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2113 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2114 } |
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 if (p->length == 0) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2117 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2118 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
|
2119 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2120 "\"Content-Length\" header"); |
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 r = p->input_ctx; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2123 r->upstream->keepalive = 0; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2124 p->upstream_done = 1; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2125 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2126 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2127 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2128 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2129 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
|
2130 if (cl == NULL) { |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2131 return NGX_ERROR; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2132 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2133 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2134 b = cl->buf; |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2135 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2136 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
|
2137 b->shadow = buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2138 b->tag = p->tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2139 b->last_shadow = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2140 b->recycled = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2141 buf->shadow = b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2142 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2143 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
|
2144 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2145 if (p->in) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2146 *p->last_in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2147 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2148 p->in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2149 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2150 p->last_in = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2151 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2152 if (p->length == -1) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2153 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2154 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2155 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2156 if (b->last - b->pos > p->length) { |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2157 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2158 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
|
2159 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2160 "\"Content-Length\" header"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2161 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2162 b->last = b->pos + p->length; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2163 p->upstream_done = 1; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2164 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2165 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2166 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2167 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2168 p->length -= b->last - b->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2169 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2170 if (p->length == 0) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2171 r = p->input_ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2172 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
|
2173 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2174 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2175 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2176 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2177 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2178 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2179 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2180 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
|
2181 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2182 ngx_int_t rc; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2183 ngx_buf_t *b, **prev; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2184 ngx_chain_t *cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2185 ngx_http_request_t *r; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2186 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2187 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2188 if (buf->pos == buf->last) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2189 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2190 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2191 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2192 r = p->input_ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2193 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
|
2194 |
4602
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2195 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2196 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2197 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2198 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2199 if (p->upstream_done) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2200 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
|
2201 "http proxy data after close"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2202 return NGX_OK; |
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 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2205 if (p->length == 0) { |
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 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
|
2208 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2209 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2210 r->upstream->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2211 p->upstream_done = 1; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2212 |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2213 return NGX_OK; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2214 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2215 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2216 b = NULL; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2217 prev = &buf->shadow; |
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 for ( ;; ) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2220 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2221 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
|
2222 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2223 if (rc == NGX_OK) { |
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 /* a chunk has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2226 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2227 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
|
2228 if (cl == NULL) { |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2229 return NGX_ERROR; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2230 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2231 |
5466
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2232 b = cl->buf; |
e7b3b9855be8
Use ngx_chain_get_free_buf() in pipe input filters.
Valentin Bartenev <vbart@nginx.com>
parents:
5441
diff
changeset
|
2233 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2234 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
|
2235 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2236 b->pos = buf->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2237 b->start = buf->start; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2238 b->end = buf->end; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2239 b->tag = p->tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2240 b->temporary = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2241 b->recycled = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2242 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2243 *prev = b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2244 prev = &b->shadow; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2245 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2246 if (p->in) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2247 *p->last_in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2248 } else { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2249 p->in = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2250 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2251 p->last_in = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2252 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2253 /* STUB */ b->num = buf->num; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2254 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2255 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
|
2256 "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
|
2257 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2258 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
|
2259 |
5359
2fda9065d0f4
Win32: Borland C compatibility fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5301
diff
changeset
|
2260 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
|
2261 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
|
2262 ctx->chunked.size = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2263 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2264 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2265 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2266 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2267 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
|
2268 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2269 b->last = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2270 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2271 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2272 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2273 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2274 if (rc == NGX_DONE) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2275 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2276 /* 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
|
2277 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2278 p->length = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2279 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
|
2280 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2281 if (buf->pos != buf->last) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2282 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
|
2283 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2284 r->upstream->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2285 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2286 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2287 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2288 } |
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 if (rc == NGX_AGAIN) { |
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 /* 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
|
2293 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2294 p->length = ctx->chunked.length; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2295 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2296 break; |
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 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2299 /* invalid response */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2300 |
7677 | 2301 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
|
2302 "upstream sent invalid chunked response"); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2303 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2304 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2305 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2306 |
7677 | 2307 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, p->log, 0, |
6480 | 2308 "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
|
2309 ctx->chunked.state, p->length); |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2310 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2311 if (b) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2312 b->shadow = buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2313 b->last_shadow = 1; |
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 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
|
2316 "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
|
2317 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2318 return NGX_OK; |
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 /* 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
|
2322 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2323 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
|
2324 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2325 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2326 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2327 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2328 } |
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 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2331 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2332 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
|
2333 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2334 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2335 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2336 ngx_buf_t *b; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2337 ngx_chain_t *cl, **ll; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2338 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2339 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2340 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2341 |
7760
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2342 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
|
2343 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
|
2344 "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
|
2345 "\"Content-Length\" header"); |
7931
055b2a847117
Proxy: disabled keepalive on extra data in non-buffered mode.
Awdhesh Mathpal <mathpal@amazon.com>
parents:
7904
diff
changeset
|
2346 u->keepalive = 0; |
7760
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2347 return NGX_OK; |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2348 } |
83c4622053b0
Upstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7730
diff
changeset
|
2349 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2350 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
|
2351 ll = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2352 } |
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 = 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
|
2355 if (cl == NULL) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2356 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2357 } |
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 *ll = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2360 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2361 cl->buf->flush = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2362 cl->buf->memory = 1; |
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 b = &u->buffer; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2365 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2366 cl->buf->pos = b->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2367 b->last += bytes; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2368 cl->buf->last = b->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2369 cl->buf->tag = u->output.tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2370 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2371 if (u->length == -1) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2372 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2373 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2374 |
7675
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2375 if (bytes > u->length) { |
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 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
|
2378 "upstream sent more data than specified in " |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2379 "\"Content-Length\" header"); |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2380 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2381 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
|
2382 u->length = 0; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2383 |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2384 return NGX_OK; |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2385 } |
9afa45068b8f
Proxy: drop extra data sent by upstream.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7473
diff
changeset
|
2386 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2387 u->length -= bytes; |
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 if (u->length == 0) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2390 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
|
2391 } |
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 return NGX_OK; |
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 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2396 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2397 static ngx_int_t |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2398 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
|
2399 { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2400 ngx_http_request_t *r = data; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2401 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2402 ngx_int_t rc; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2403 ngx_buf_t *b, *buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2404 ngx_chain_t *cl, **ll; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2405 ngx_http_upstream_t *u; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2406 ngx_http_proxy_ctx_t *ctx; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2407 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2408 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
|
2409 |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2410 if (ctx == NULL) { |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2411 return NGX_ERROR; |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2412 } |
8036fc6af2df
Proxy: added ctx checking to input filters.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
2413 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2414 u = r->upstream; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2415 buf = &u->buffer; |
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 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2418 buf->last += bytes; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2419 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2420 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
|
2421 ll = &cl->next; |
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 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2424 for ( ;; ) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2425 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2426 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
|
2427 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2428 if (rc == NGX_OK) { |
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 /* a chunk has been parsed successfully */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2431 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2432 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
|
2433 if (cl == NULL) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2434 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2435 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2436 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2437 *ll = cl; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2438 ll = &cl->next; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2439 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2440 b = cl->buf; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2441 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2442 b->flush = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2443 b->memory = 1; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2444 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2445 b->pos = buf->pos; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2446 b->tag = u->output.tag; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2447 |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2448 if (buf->last - buf->pos >= ctx->chunked.size) { |
5359
2fda9065d0f4
Win32: Borland C compatibility fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5301
diff
changeset
|
2449 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
|
2450 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
|
2451 ctx->chunked.size = 0; |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2452 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2453 } else { |
4925
32030fa8cb14
Request body: chunked parsing moved to ngx_http_parse.c from proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4602
diff
changeset
|
2454 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
|
2455 buf->pos = buf->last; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2456 b->last = buf->last; |
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 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
|
2460 "http proxy out buf %p %z", |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2461 b->pos, b->last - b->pos); |
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 continue; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2464 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2465 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2466 if (rc == NGX_DONE) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2467 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2468 /* 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
|
2469 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2470 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
|
2471 u->length = 0; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2472 |
7676
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2473 if (buf->pos != buf->last) { |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2474 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
|
2475 "upstream sent data after final chunk"); |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2476 u->keepalive = 0; |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2477 } |
d225b70d38b6
Proxy: detection of data after final chunk.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7675
diff
changeset
|
2478 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2479 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2480 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2481 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2482 if (rc == NGX_AGAIN) { |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2483 break; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2484 } |
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 /* invalid response */ |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2487 |
4145
f321e9750c8c
Proxy: logging levels tuned, double logging fixed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4144
diff
changeset
|
2488 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
|
2489 "upstream sent invalid chunked response"); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2490 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2491 return NGX_ERROR; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2492 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2493 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2494 return NGX_OK; |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2495 } |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2496 |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
2497 |
507 | 2498 static void |
2499 ngx_http_proxy_abort_request(ngx_http_request_t *r) | |
2500 { | |
2501 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2502 "abort http proxy request"); | |
577 | 2503 |
507 | 2504 return; |
2505 } | |
2506 | |
2507 | |
2508 static void | |
2509 ngx_http_proxy_finalize_request(ngx_http_request_t *r, ngx_int_t rc) | |
577 | 2510 { |
507 | 2511 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2512 "finalize http proxy request"); | |
2513 | |
2514 return; | |
2515 } | |
2516 | |
2517 | |
573 | 2518 static ngx_int_t |
2519 ngx_http_proxy_host_variable(ngx_http_request_t *r, | |
2520 ngx_http_variable_value_t *v, uintptr_t data) | |
507 | 2521 { |
1658 | 2522 ngx_http_proxy_ctx_t *ctx; |
2523 | |
2524 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2525 | |
2526 if (ctx == NULL) { | |
2527 v->not_found = 1; | |
2528 return NGX_OK; | |
2529 } | |
2530 | |
2531 v->len = ctx->vars.host_header.len; | |
577 | 2532 v->valid = 1; |
1565 | 2533 v->no_cacheable = 0; |
573 | 2534 v->not_found = 0; |
1658 | 2535 v->data = ctx->vars.host_header.data; |
507 | 2536 |
573 | 2537 return NGX_OK; |
507 | 2538 } |
2539 | |
2540 | |
573 | 2541 static ngx_int_t |
2542 ngx_http_proxy_port_variable(ngx_http_request_t *r, | |
2543 ngx_http_variable_value_t *v, uintptr_t data) | |
507 | 2544 { |
1658 | 2545 ngx_http_proxy_ctx_t *ctx; |
2546 | |
2547 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2548 | |
2549 if (ctx == NULL) { | |
2550 v->not_found = 1; | |
2551 return NGX_OK; | |
2552 } | |
2553 | |
2554 v->len = ctx->vars.port.len; | |
577 | 2555 v->valid = 1; |
1565 | 2556 v->no_cacheable = 0; |
573 | 2557 v->not_found = 0; |
1658 | 2558 v->data = ctx->vars.port.data; |
509 | 2559 |
573 | 2560 return NGX_OK; |
509 | 2561 } |
2562 | |
2563 | |
573 | 2564 static ngx_int_t |
509 | 2565 ngx_http_proxy_add_x_forwarded_for_variable(ngx_http_request_t *r, |
573 | 2566 ngx_http_variable_value_t *v, uintptr_t data) |
509 | 2567 { |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2568 size_t len; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2569 u_char *p; |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2570 ngx_table_elt_t *h, *xfwd; |
509 | 2571 |
577 | 2572 v->valid = 1; |
1565 | 2573 v->no_cacheable = 0; |
573 | 2574 v->not_found = 0; |
509 | 2575 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2576 xfwd = r->headers_in.x_forwarded_for; |
5084
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 len = 0; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2579 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2580 for (h = xfwd; h; h = h->next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2581 len += h->value.len + sizeof(", ") - 1; |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2582 } |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2583 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2584 if (len == 0) { |
573 | 2585 v->len = r->connection->addr_text.len; |
2586 v->data = r->connection->addr_text.data; | |
2587 return NGX_OK; | |
509 | 2588 } |
2589 | |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2590 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
|
2591 |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2592 p = ngx_pnalloc(r->pool, len); |
509 | 2593 if (p == NULL) { |
573 | 2594 return NGX_ERROR; |
509 | 2595 } |
2596 | |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2597 v->len = len; |
573 | 2598 v->data = p; |
509 | 2599 |
8024
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2600 for (h = xfwd; h; h = h->next) { |
ef6a3a99a81a
Reworked multi headers to use linked lists.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7933
diff
changeset
|
2601 p = ngx_copy(p, h->value.data, h->value.len); |
5084
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2602 *p++ = ','; *p++ = ' '; |
f7fe817c92a2
Correctly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov <ru@nginx.com>
parents:
5072
diff
changeset
|
2603 } |
509 | 2604 |
2605 ngx_memcpy(p, r->connection->addr_text.data, r->connection->addr_text.len); | |
2606 | |
573 | 2607 return NGX_OK; |
509 | 2608 } |
2609 | |
2610 | |
2611 static ngx_int_t | |
577 | 2612 ngx_http_proxy_internal_body_length_variable(ngx_http_request_t *r, |
2613 ngx_http_variable_value_t *v, uintptr_t data) | |
2614 { | |
1658 | 2615 ngx_http_proxy_ctx_t *ctx; |
2616 | |
2617 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | |
2618 | |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
2619 if (ctx == NULL || ctx->internal_body_length < 0) { |
577 | 2620 v->not_found = 1; |
2621 return NGX_OK; | |
2622 } | |
2623 | |
2624 v->valid = 1; | |
1565 | 2625 v->no_cacheable = 0; |
577 | 2626 v->not_found = 0; |
2627 | |
5188
886800caf360
Proxy: allocate $proxy_internal_body_length from request pool.
Ruslan Ermilov <ru@nginx.com>
parents:
5084
diff
changeset
|
2628 v->data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); |
577 | 2629 |
2630 if (v->data == NULL) { | |
2631 return NGX_ERROR; | |
2632 } | |
2633 | |
4927
93294110728f
Request body: always use calculated size of a request body in proxy.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4925
diff
changeset
|
2634 v->len = ngx_sprintf(v->data, "%O", ctx->internal_body_length) - v->data; |
577 | 2635 |
2636 return NGX_OK; | |
2637 } | |
2638 | |
2639 | |
2640 static ngx_int_t | |
6051
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2641 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
|
2642 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
|
2643 { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2644 ngx_http_proxy_ctx_t *ctx; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2645 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2646 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
|
2647 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2648 if (ctx == NULL || !ctx->internal_chunked) { |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2649 v->not_found = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2650 return NGX_OK; |
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 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2653 v->valid = 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2654 v->no_cacheable = 0; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2655 v->not_found = 0; |
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 v->data = (u_char *) "chunked"; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2658 v->len = sizeof("chunked") - 1; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2659 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2660 return NGX_OK; |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2661 } |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2662 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2663 |
d97e6be2d292
Proxy: proxy_request_buffering chunked support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6050
diff
changeset
|
2664 static ngx_int_t |
509 | 2665 ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r, ngx_table_elt_t *h, |
2666 size_t prefix) | |
2667 { | |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
2668 size_t len; |
509 | 2669 ngx_int_t rc; |
2670 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
|
2671 ngx_http_proxy_rewrite_t *pr; |
509 | 2672 ngx_http_proxy_loc_conf_t *plcf; |
2673 | |
2674 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); | |
2675 | |
2676 pr = plcf->redirects->elts; | |
2677 | |
2678 if (pr == NULL) { | |
2679 return NGX_DECLINED; | |
2680 } | |
2681 | |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
2682 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
|
2683 |
509 | 2684 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
|
2685 rc = pr[i].handler(r, &h->value, prefix, len, &pr[i]); |
509 | 2686 |
2687 if (rc != NGX_DECLINED) { | |
2688 return rc; | |
2689 } | |
2690 } | |
2691 | |
2692 return NGX_DECLINED; | |
2693 } | |
2694 | |
2695 | |
2696 static ngx_int_t | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2697 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
|
2698 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2699 u_char *p; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2700 size_t len; |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2701 ngx_int_t rc, rv; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2702 ngx_str_t *key, *value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2703 ngx_uint_t i; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2704 ngx_array_t attrs; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2705 ngx_keyval_t *attr; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2706 ngx_http_proxy_loc_conf_t *plcf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2707 |
7720
a88384c69d1e
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7716
diff
changeset
|
2708 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
|
2709 return NGX_ERROR; |
a88384c69d1e
Proxy: error checking for array init, missed in 7716:d6a5e14aa3e4.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7716
diff
changeset
|
2710 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2711 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2712 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
|
2713 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2714 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2715 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2716 attr = attrs.elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2717 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2718 if (attr[0].value.data == NULL) { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2719 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2720 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2721 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2722 rv = NGX_DECLINED; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2723 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2724 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
|
2725 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2726 for (i = 1; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2727 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2728 key = &attr[i].key; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2729 value = &attr[i].value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2730 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2731 if (plcf->cookie_domains && key->len == 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2732 && 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
|
2733 && value->data) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2734 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2735 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
|
2736 plcf->cookie_domains); |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2737 if (rc == NGX_ERROR) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2738 return NGX_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2739 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2740 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2741 if (rc != NGX_DECLINED) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2742 rv = rc; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2743 } |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2744 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2745 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2746 if (plcf->cookie_paths && key->len == 4 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2747 && 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
|
2748 && value->data) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2749 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2750 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
|
2751 plcf->cookie_paths); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2752 if (rc == NGX_ERROR) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2753 return NGX_ERROR; |
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 if (rc != NGX_DECLINED) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2757 rv = rc; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2758 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2759 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2760 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
2761 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2762 if (plcf->cookie_flags) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2763 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
|
2764 plcf->cookie_flags); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2765 if (rc == NGX_ERROR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2766 return NGX_ERROR; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2769 if (rc != NGX_DECLINED) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2770 rv = rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2771 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2772 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2773 attr = attrs.elts; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2776 if (rv != NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2777 return rv; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2780 len = 0; |
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 for (i = 0; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2783 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2784 if (attr[i].key.data == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2785 continue; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2788 if (i > 0) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2789 len += 2; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2790 } |
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 len += attr[i].key.len; |
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 if (attr[i].value.data) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2795 len += 1 + attr[i].value.len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2796 } |
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 p = ngx_pnalloc(r->pool, len + 1); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2800 if (p == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2801 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2802 } |
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 h->value.data = p; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2805 h->value.len = len; |
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 for (i = 0; i < attrs.nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2808 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2809 if (attr[i].key.data == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2810 continue; |
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 if (i > 0) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2814 *p++ = ';'; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2815 *p++ = ' '; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2816 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2817 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2818 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
|
2819 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2820 if (attr[i].value.data) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2821 *p++ = '='; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2822 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
|
2823 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2824 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2825 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2826 *p = '\0'; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2827 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2828 return NGX_OK; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2829 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2830 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2831 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2832 static ngx_int_t |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2833 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
|
2834 { |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2835 u_char *start, *end, *p, *last; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2836 ngx_str_t name, val; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2837 ngx_keyval_t *attr; |
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 start = value->data; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2840 end = value->data + value->len; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2841 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2842 for ( ;; ) { |
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 last = (u_char *) ngx_strchr(start, ';'); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2845 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2846 if (last == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2847 last = end; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2850 while (start < last && *start == ' ') { 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 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
|
2853 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2854 name.data = start; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2855 name.len = p - start; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2856 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2857 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
|
2858 name.len--; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2861 if (p < last) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2862 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2863 p++; |
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 (p < last && *p == ' ') { p++; } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2866 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2867 val.data = p; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2868 val.len = last - val.data; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2869 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2870 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
|
2871 val.len--; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2874 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2875 ngx_str_null(&val); |
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 = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2879 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2880 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2881 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2882 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2883 attr->key = name; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2884 attr->value = val; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2885 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2886 if (last == end) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2887 break; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2888 } |
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 start = last + 1; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2893 return NGX_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2894 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2895 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2896 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2897 static ngx_int_t |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2898 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
|
2899 ngx_array_t *rewrites) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2900 { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2901 ngx_int_t rc; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2902 ngx_uint_t i; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2903 ngx_http_proxy_rewrite_t *pr; |
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 pr = rewrites->elts; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2906 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2907 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
|
2908 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
|
2909 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2910 if (rc != NGX_DECLINED) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2911 return rc; |
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 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2915 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2916 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2917 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2918 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
2919 static ngx_int_t |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2920 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
|
2921 ngx_array_t *flags) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2922 { |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2923 ngx_str_t pattern, value; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2924 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2925 ngx_int_t rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2926 #endif |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2927 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
|
2928 ngx_keyval_t *attr; |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2929 ngx_conf_bitmask_t *mask; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2930 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
|
2931 ngx_http_proxy_cookie_flags_t *pcf; |
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 attr = attrs->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2934 pcf = flags->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2935 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2936 for (i = 0; i < flags->nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2937 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2938 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2939 if (pcf[i].regex) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2940 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
|
2941 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2942 if (rc == NGX_ERROR) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2943 return NGX_ERROR; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2946 if (rc == NGX_OK) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2947 break; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2950 /* NGX_DECLINED */ |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2951 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2952 continue; |
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 #endif |
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 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
|
2957 != NGX_OK) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2958 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2959 return NGX_ERROR; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2962 if (pattern.len == attr[0].key.len |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2963 && 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
|
2964 == 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2965 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2966 break; |
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 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2969 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2970 if (i == flags->nelts) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2971 return NGX_DECLINED; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2972 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
2973 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2974 nelts = pcf[i].flags_values.nelts; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2975 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
|
2976 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2977 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
|
2978 f = 0; |
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 for (i = 0; i < nelts; i++) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2981 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2982 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
|
2983 return NGX_ERROR; |
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 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2986 if (value.len == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2987 continue; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2988 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2989 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2990 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
|
2991 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
2992 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
|
2993 || 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
|
2994 != 0) |
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 continue; |
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 f |= mask[m].mask; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3000 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3001 break; |
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 if (mask[m].name.len == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3005 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
|
3006 "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
|
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 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3010 if (f == 0) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3011 return NGX_DECLINED; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3012 } |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3013 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
3014 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
|
3015 } |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3018 static ngx_int_t |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3019 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
|
3020 ngx_uint_t flags) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3021 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3022 ngx_str_t *key, *value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3023 ngx_uint_t i; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3024 ngx_keyval_t *attr; |
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 attr = attrs->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3027 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3028 for (i = 1; i < attrs->nelts; i++) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3029 key = &attr[i].key; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3030 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3031 if (key->len == 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3032 && 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
|
3033 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3034 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
|
3035 flags &= ~NGX_HTTP_PROXY_COOKIE_SECURE_ON; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3036 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3037 } 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
|
3038 key->data = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3039 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3040 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3041 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3042 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3043 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3044 if (key->len == 8 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3045 && 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
|
3046 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3047 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
|
3048 flags &= ~NGX_HTTP_PROXY_COOKIE_HTTPONLY_ON; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3049 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3050 } 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
|
3051 key->data = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3052 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3053 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3054 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3055 } |
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 (key->len == 8 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3058 && 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
|
3059 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3060 value = &attr[i].value; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3061 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3062 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
|
3063 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_STRICT; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3064 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3065 if (value->len != 6 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3066 || 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
|
3067 != 0) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3068 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3069 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3070 ngx_str_set(value, "Strict"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3071 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3072 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3073 } 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
|
3074 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3075 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3076 if (value->len != 3 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3077 || 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
|
3078 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3079 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3080 ngx_str_set(value, "Lax"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3081 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3082 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3083 } 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
|
3084 flags &= ~NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3085 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3086 if (value->len != 4 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3087 || 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
|
3088 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3089 ngx_str_set(key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3090 ngx_str_set(value, "None"); |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3093 } 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
|
3094 key->data = NULL; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3097 continue; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3098 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3099 } |
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 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
|
3102 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3103 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3104 return NGX_ERROR; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3107 ngx_str_set(&attr->key, "Secure"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3108 ngx_str_null(&attr->value); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3109 } |
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 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
|
3112 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3113 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3114 return NGX_ERROR; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3117 ngx_str_set(&attr->key, "HttpOnly"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3118 ngx_str_null(&attr->value); |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3121 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
|
3122 |NGX_HTTP_PROXY_COOKIE_SAMESITE_LAX |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3123 |NGX_HTTP_PROXY_COOKIE_SAMESITE_NONE)) |
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 attr = ngx_array_push(attrs); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3126 if (attr == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3127 return NGX_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3128 } |
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 ngx_str_set(&attr->key, "SameSite"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3131 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3132 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
|
3133 ngx_str_set(&attr->value, "Strict"); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3134 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3135 } 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
|
3136 ngx_str_set(&attr->value, "Lax"); |
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 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3139 ngx_str_set(&attr->value, "None"); |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3143 return NGX_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3144 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3145 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3146 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3147 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3148 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
|
3149 size_t prefix, size_t len, ngx_http_proxy_rewrite_t *pr) |
509 | 3150 { |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3151 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
|
3152 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3153 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
|
3154 return NGX_ERROR; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3155 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3156 |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3157 if (pattern.len > len |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3158 || ngx_rstrncmp(value->data + prefix, pattern.data, pattern.len) != 0) |
509 | 3159 { |
3160 return NGX_DECLINED; | |
3161 } | |
3162 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3163 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
|
3164 return NGX_ERROR; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3165 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3166 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3167 return ngx_http_proxy_rewrite(r, value, prefix, pattern.len, &replacement); |
509 | 3168 } |
3169 | |
3170 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3171 #if (NGX_PCRE) |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3172 |
509 | 3173 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3174 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
|
3175 size_t prefix, size_t len, ngx_http_proxy_rewrite_t *pr) |
509 | 3176 { |
4462
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3177 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
|
3178 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3179 pattern.len = len; |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3180 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
|
3181 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3182 if (ngx_http_regex_exec(r, pr->pattern.regex, &pattern) != NGX_OK) { |
509 | 3183 return NGX_DECLINED; |
3184 } | |
3185 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3186 if (ngx_http_complex_value(r, &pr->replacement, &replacement) != NGX_OK) { |
509 | 3187 return NGX_ERROR; |
3188 } | |
3189 | |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3190 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
|
3191 } |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3192 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3193 #endif |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3194 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3195 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3196 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3197 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
|
3198 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
|
3199 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3200 u_char *p; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3201 ngx_str_t pattern, replacement; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3202 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3203 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
|
3204 return NGX_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3205 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3206 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3207 p = value->data + prefix; |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3208 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3209 if (len && p[0] == '.') { |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3210 p++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3211 prefix++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3212 len--; |
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 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3215 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
|
3216 return NGX_DECLINED; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3217 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3218 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3219 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
|
3220 return NGX_ERROR; |
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 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3223 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
|
3224 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3225 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3226 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3227 static ngx_int_t |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3228 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
|
3229 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
|
3230 { |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3231 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
|
3232 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
|
3233 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3234 if (len == value->len) { |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3235 *value = *replacement; |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3236 return NGX_OK; |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3237 } |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3238 |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3239 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
|
3240 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3241 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
|
3242 |
5676
fbfdf8017748
Proxy: fixed possible uninitialized memory access.
Valentin Bartenev <vbart@nginx.com>
parents:
5661
diff
changeset
|
3243 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
|
3244 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
|
3245 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
|
3246 } |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3247 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3248 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
|
3249 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
|
3250 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3251 ngx_memcpy(p, value->data + prefix + len, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3252 value->len - len - prefix + 1); |
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 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
|
3255 |
a73c63bdce32
Proxy: generic rewrite code from the "proxy_redirect" handlers moved to a
Valentin Bartenev <vbart@nginx.com>
parents:
4461
diff
changeset
|
3256 } else { |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3257 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
|
3258 |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3259 ngx_memmove(p, value->data + prefix + len, |
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3260 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
|
3261 } |
3d51ba7f347b
Fixed: proxy_redirect with regex might broke Refresh header.
Valentin Bartenev <vbart@nginx.com>
parents:
4385
diff
changeset
|
3262 |
7715
5c7917292b29
Proxy: changed interface of some internal functions.
Ruslan Ermilov <ru@nginx.com>
parents:
7714
diff
changeset
|
3263 value->len = new_len; |
509 | 3264 |
3265 return NGX_OK; | |
3266 } | |
3267 | |
3268 | |
3269 static ngx_int_t | |
3270 ngx_http_proxy_add_variables(ngx_conf_t *cf) | |
3271 { | |
3272 ngx_http_variable_t *var, *v; | |
3273 | |
3274 for (v = ngx_http_proxy_vars; v->name.len; v++) { | |
3275 var = ngx_http_add_variable(cf, &v->name, v->flags); | |
3276 if (var == NULL) { | |
3277 return NGX_ERROR; | |
3278 } | |
3279 | |
637 | 3280 var->get_handler = v->get_handler; |
509 | 3281 var->data = v->data; |
3282 } | |
3283 | |
3284 return NGX_OK; | |
507 | 3285 } |
3286 | |
3287 | |
3288 static void * | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3289 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
|
3290 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3291 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
|
3292 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3293 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
|
3294 if (conf == NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3295 return NULL; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3296 } |
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 #if (NGX_HTTP_CACHE) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3299 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
|
3300 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
|
3301 != NGX_OK) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3302 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3303 return NULL; |
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 #endif |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3306 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3307 return conf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3308 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3309 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3310 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
3311 static void * |
507 | 3312 ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) |
3313 { | |
3314 ngx_http_proxy_loc_conf_t *conf; | |
3315 | |
3316 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t)); | |
3317 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
|
3318 return NULL; |
507 | 3319 } |
3320 | |
3321 /* | |
3322 * set by ngx_pcalloc(): | |
3323 * | |
3324 * conf->upstream.bufs.num = 0; | |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3325 * conf->upstream.ignore_headers = 0; |
507 | 3326 * conf->upstream.next_upstream = 0; |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3327 * conf->upstream.cache_zone = NULL; |
2875
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3328 * conf->upstream.cache_use_stale = 0; |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3329 * conf->upstream.cache_methods = 0; |
507 | 3330 * conf->upstream.temp_path = NULL; |
649 | 3331 * 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
|
3332 * conf->upstream.store_lengths = NULL; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3333 * conf->upstream.store_values = NULL; |
509 | 3334 * |
7238
06cf0c4b8618
Upstream: fixed comments after 13f8dec720b5.
Ruslan Ermilov <ru@nginx.com>
parents:
7220
diff
changeset
|
3335 * conf->location = NULL; |
06cf0c4b8618
Upstream: fixed comments after 13f8dec720b5.
Ruslan Ermilov <ru@nginx.com>
parents:
7220
diff
changeset
|
3336 * conf->url = { 0, NULL }; |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3337 * conf->headers.lengths = NULL; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3338 * conf->headers.values = NULL; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3339 * 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
|
3340 * conf->headers_cache.lengths = NULL; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3341 * conf->headers_cache.values = NULL; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3342 * 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
|
3343 * conf->body_lengths = NULL; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3344 * conf->body_values = NULL; |
577 | 3345 * conf->body_source = { 0, NULL }; |
3470
b982f2dee8cf
fix proxy_redirect name in error message
Igor Sysoev <igor@sysoev.ru>
parents:
3399
diff
changeset
|
3346 * conf->redirects = NULL; |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3347 * conf->ssl = 0; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3348 * conf->ssl_protocols = 0; |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3349 * conf->ssl_ciphers = { 0, NULL }; |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3350 * conf->ssl_trusted_certificate = { 0, NULL }; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3351 * conf->ssl_crl = { 0, NULL }; |
507 | 3352 */ |
577 | 3353 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3354 conf->upstream.store = NGX_CONF_UNSET; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3355 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
|
3356 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT; |
581 | 3357 conf->upstream.buffering = NGX_CONF_UNSET; |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3358 conf->upstream.request_buffering = NGX_CONF_UNSET; |
629 | 3359 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
|
3360 conf->upstream.force_ranges = NGX_CONF_UNSET; |
581 | 3361 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3362 conf->upstream.local = NGX_CONF_UNSET_PTR; |
7371
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3363 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
|
3364 |
507 | 3365 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
3366 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; | |
3367 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
|
3368 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC; |
507 | 3369 |
3370 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; | |
581 | 3371 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
|
3372 conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; |
529 | 3373 |
3374 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; | |
577 | 3375 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; |
529 | 3376 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; |
509 | 3377 |
3378 conf->upstream.pass_request_headers = NGX_CONF_UNSET; | |
3379 conf->upstream.pass_request_body = NGX_CONF_UNSET; | |
561 | 3380 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3381 #if (NGX_HTTP_CACHE) |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3382 conf->upstream.cache = NGX_CONF_UNSET; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3383 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
|
3384 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
|
3385 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
|
3386 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3387 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3388 conf->upstream.cache_lock = NGX_CONF_UNSET; |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3389 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
|
3390 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
|
3391 conf->upstream.cache_revalidate = NGX_CONF_UNSET; |
6290
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3392 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
|
3393 conf->upstream.cache_background_update = NGX_CONF_UNSET; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3394 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3395 |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3396 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
|
3397 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
|
3398 |
657 | 3399 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
|
3400 |
2184 | 3401 #if (NGX_HTTP_SSL) |
3402 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
|
3403 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
|
3404 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
|
3405 conf->upstream.ssl_verify = NGX_CONF_UNSET; |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3406 conf->upstream.ssl_certificate = NGX_CONF_UNSET_PTR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3407 conf->upstream.ssl_certificate_key = NGX_CONF_UNSET_PTR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3408 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
|
3409 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
|
3410 conf->ssl_conf_commands = NGX_CONF_UNSET_PTR; |
2184 | 3411 #endif |
507 | 3412 |
3413 /* "proxy_cyclic_temp_file" is disabled */ | |
3414 conf->upstream.cyclic_temp_file = 0; | |
3415 | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3416 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
|
3417 |
7728
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3418 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
|
3419 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3420 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
|
3421 |
509 | 3422 conf->redirect = NGX_CONF_UNSET; |
507 | 3423 |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3424 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
|
3425 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
|
3426 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
|
3427 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3428 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
|
3429 |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3430 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
|
3431 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
|
3432 |
3976
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3862
diff
changeset
|
3433 ngx_str_set(&conf->upstream.module, "proxy"); |
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3862
diff
changeset
|
3434 |
507 | 3435 return conf; |
3436 } | |
3437 | |
3438 | |
3439 static char * | |
3440 ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
3441 { | |
3442 ngx_http_proxy_loc_conf_t *prev = parent; | |
3443 ngx_http_proxy_loc_conf_t *conf = child; | |
3444 | |
3862
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3445 u_char *p; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3446 size_t size; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3447 ngx_int_t rc; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3448 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
|
3449 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
|
3450 ngx_http_proxy_rewrite_t *pr; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3451 ngx_http_script_compile_t sc; |
509 | 3452 |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3453 #if (NGX_HTTP_CACHE) |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3454 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3455 if (conf->upstream.store > 0) { |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3456 conf->upstream.cache = 0; |
5948
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 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3459 if (conf->upstream.cache > 0) { |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3460 conf->upstream.store = 0; |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3461 } |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3462 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3463 #endif |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
3464 |
5940
e3b3b89d74e8
Upstream: fixed inheritance of proxy_store and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5939
diff
changeset
|
3465 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
|
3466 ngx_conf_merge_value(conf->upstream.store, |
2894 | 3467 prev->upstream.store, 0); |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3468 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
3469 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
|
3470 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
|
3471 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3472 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
3473 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
|
3474 prev->upstream.store_access, 0600); |
1291
13a4ce6e7f1e
proxy_store and fastcgi_store
Igor Sysoev <igor@sysoev.ru>
parents:
1244
diff
changeset
|
3475 |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3476 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
|
3477 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
|
3478 |
581 | 3479 ngx_conf_merge_value(conf->upstream.buffering, |
3480 prev->upstream.buffering, 1); | |
3481 | |
6050
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3482 ngx_conf_merge_value(conf->upstream.request_buffering, |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3483 prev->upstream.request_buffering, 1); |
a08fad30aeac
Request body: unbuffered reading.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6043
diff
changeset
|
3484 |
629 | 3485 ngx_conf_merge_value(conf->upstream.ignore_client_abort, |
3486 prev->upstream.ignore_client_abort, 0); | |
3487 | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3488 ngx_conf_merge_value(conf->upstream.force_ranges, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3489 prev->upstream.force_ranges, 0); |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
3490 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3491 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
|
3492 prev->upstream.local, NULL); |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4962
diff
changeset
|
3493 |
7371
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3494 ngx_conf_merge_value(conf->upstream.socket_keepalive, |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3495 prev->upstream.socket_keepalive, 0); |
8b68d50090e4
Upstream: proxy_socket_keepalive and friends.
Vladimir Homutov <vl@nginx.com>
parents:
7321
diff
changeset
|
3496 |
507 | 3497 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, |
3498 prev->upstream.connect_timeout, 60000); | |
3499 | |
3500 ngx_conf_merge_msec_value(conf->upstream.send_timeout, | |
3501 prev->upstream.send_timeout, 60000); | |
3502 | |
3503 ngx_conf_merge_msec_value(conf->upstream.read_timeout, | |
3504 prev->upstream.read_timeout, 60000); | |
3505 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5738
diff
changeset
|
3506 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
|
3507 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
|
3508 |
507 | 3509 ngx_conf_merge_size_value(conf->upstream.send_lowat, |
3510 prev->upstream.send_lowat, 0); | |
3511 | |
581 | 3512 ngx_conf_merge_size_value(conf->upstream.buffer_size, |
3513 prev->upstream.buffer_size, | |
507 | 3514 (size_t) ngx_pagesize); |
3515 | |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3516 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
|
3517 prev->upstream.limit_rate, 0); |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
3518 |
507 | 3519 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, |
3520 8, ngx_pagesize); | |
3521 | |
3522 if (conf->upstream.bufs.num < 2) { | |
577 | 3523 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
507 | 3524 "there must be at least 2 \"proxy_buffers\""); |
3525 return NGX_CONF_ERROR; | |
3526 } | |
577 | 3527 |
507 | 3528 |
581 | 3529 size = conf->upstream.buffer_size; |
577 | 3530 if (size < conf->upstream.bufs.size) { |
507 | 3531 size = conf->upstream.bufs.size; |
3532 } | |
3533 | |
3534 | |
529 | 3535 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf, |
3536 prev->upstream.busy_buffers_size_conf, | |
507 | 3537 NGX_CONF_UNSET_SIZE); |
3538 | |
529 | 3539 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3540 conf->upstream.busy_buffers_size = 2 * size; |
529 | 3541 } else { |
3542 conf->upstream.busy_buffers_size = | |
3543 conf->upstream.busy_buffers_size_conf; | |
3544 } | |
577 | 3545 |
529 | 3546 if (conf->upstream.busy_buffers_size < size) { |
507 | 3547 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
|
3548 "\"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
|
3549 "the maximum of the value of \"proxy_buffer_size\" and " |
507 | 3550 "one of the \"proxy_buffers\""); |
3551 | |
3552 return NGX_CONF_ERROR; | |
529 | 3553 } |
507 | 3554 |
529 | 3555 if (conf->upstream.busy_buffers_size |
3556 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) | |
507 | 3557 { |
3558 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3559 "\"proxy_busy_buffers_size\" must be less than " | |
3560 "the size of all \"proxy_buffers\" minus one buffer"); | |
3561 | |
3562 return NGX_CONF_ERROR; | |
3563 } | |
529 | 3564 |
507 | 3565 |
529 | 3566 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf, |
3567 prev->upstream.temp_file_write_size_conf, | |
507 | 3568 NGX_CONF_UNSET_SIZE); |
3569 | |
529 | 3570 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3571 conf->upstream.temp_file_write_size = 2 * size; |
529 | 3572 } else { |
3573 conf->upstream.temp_file_write_size = | |
3574 conf->upstream.temp_file_write_size_conf; | |
3575 } | |
577 | 3576 |
529 | 3577 if (conf->upstream.temp_file_write_size < size) { |
507 | 3578 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
|
3579 "\"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
|
3580 "than the maximum of the value of \"proxy_buffer_size\" and " |
507 | 3581 "one of the \"proxy_buffers\""); |
3582 | |
3583 return NGX_CONF_ERROR; | |
3584 } | |
3585 | |
529 | 3586 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf, |
3587 prev->upstream.max_temp_file_size_conf, | |
507 | 3588 NGX_CONF_UNSET_SIZE); |
3589 | |
529 | 3590 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) { |
507 | 3591 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024; |
529 | 3592 } else { |
3593 conf->upstream.max_temp_file_size = | |
3594 conf->upstream.max_temp_file_size_conf; | |
3595 } | |
507 | 3596 |
529 | 3597 if (conf->upstream.max_temp_file_size != 0 |
3598 && conf->upstream.max_temp_file_size < size) | |
507 | 3599 { |
3600 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
561 | 3601 "\"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
|
3602 "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
|
3603 "the maximum of the value of \"proxy_buffer_size\" and " |
561 | 3604 "one of the \"proxy_buffers\""); |
507 | 3605 |
3606 return NGX_CONF_ERROR; | |
3607 } | |
3608 | |
529 | 3609 |
2786
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3610 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
|
3611 prev->upstream.ignore_headers, |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3612 NGX_CONF_BITMASK_SET); |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3613 |
4e002555652d
proxy_ignore_headers and fastcgi_ignore_headers
Igor Sysoev <igor@sysoev.ru>
parents:
2784
diff
changeset
|
3614 |
507 | 3615 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, |
3616 prev->upstream.next_upstream, | |
3617 (NGX_CONF_BITMASK_SET | |
3618 |NGX_HTTP_UPSTREAM_FT_ERROR | |
3619 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); | |
3620 | |
665 | 3621 if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) { |
3622 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET | |
3623 |NGX_HTTP_UPSTREAM_FT_OFF; | |
3624 } | |
3625 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3626 if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path, |
509 | 3627 prev->upstream.temp_path, |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3628 &ngx_http_proxy_temp_path) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3629 != NGX_OK) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3630 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3631 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3632 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3633 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3634 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3635 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3636 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3637 if (conf->upstream.cache == NGX_CONF_UNSET) { |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3638 ngx_conf_merge_value(conf->upstream.cache, |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3639 prev->upstream.cache, 0); |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3640 |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3641 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
|
3642 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
|
3643 } |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3644 |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3645 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
|
3646 ngx_shm_zone_t *shm_zone; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3647 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
3648 shm_zone = conf->upstream.cache_zone; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3649 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3650 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3651 "\"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
|
3652 &shm_zone->shm.name); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3653 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3654 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3655 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3656 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3657 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
|
3658 prev->upstream.cache_min_uses, 1); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3659 |
6793
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3660 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
|
3661 prev->upstream.cache_max_range_offset, |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3662 NGX_MAX_OFF_T_VALUE); |
0fba3ed4e7eb
Cache: proxy_cache_max_range_offset and friends.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6785
diff
changeset
|
3663 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3664 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
|
3665 prev->upstream.cache_use_stale, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3666 (NGX_CONF_BITMASK_SET |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3667 |NGX_HTTP_UPSTREAM_FT_OFF)); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3668 |
4401
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_OFF) { |
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_CONF_BITMASK_SET |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3671 |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
|
3672 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3673 |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3674 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
|
3675 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
|
3676 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4400
diff
changeset
|
3677 |
2875
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3678 if (conf->upstream.cache_methods == 0) { |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3679 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
|
3680 } |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3681 |
6e1941b321b7
proxy_cache_methods and fastcgi_cache_methods
Igor Sysoev <igor@sysoev.ru>
parents:
2786
diff
changeset
|
3682 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
|
3683 |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
3684 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
|
3685 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
|
3686 |
3526
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3687 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
|
3688 prev->upstream.no_cache, NULL); |
62a4fd1e6e2c
proxy_no_cache and fastcgi_no_cache
Igor Sysoev <igor@sysoev.ru>
parents:
3523
diff
changeset
|
3689 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3690 ngx_conf_merge_ptr_value(conf->upstream.cache_valid, |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3691 prev->upstream.cache_valid, NULL); |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3692 |
2672 | 3693 if (conf->cache_key.value.data == NULL) { |
3694 conf->cache_key = prev->cache_key; | |
3695 } | |
3696 | |
4385
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3697 ngx_conf_merge_value(conf->upstream.cache_lock, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3698 prev->upstream.cache_lock, 0); |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3699 |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3700 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3701 prev->upstream.cache_lock_timeout, 5000); |
70ba81827472
Cache locks initial implementation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4377
diff
changeset
|
3702 |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3703 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
|
3704 prev->upstream.cache_lock_age, 5000); |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5900
diff
changeset
|
3705 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3706 ngx_conf_merge_value(conf->upstream.cache_revalidate, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3707 prev->upstream.cache_revalidate, 0); |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5391
diff
changeset
|
3708 |
6290
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3709 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
|
3710 prev->upstream.cache_convert_head, 1); |
4d5ac1a31d44
Upstream: proxy_cache_convert_head directive.
Roman Arutyunyan <arut@nginx.com>
parents:
6157
diff
changeset
|
3711 |
6906
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3712 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
|
3713 prev->upstream.cache_background_update, 0); |
1aeaae6e9446
Upstream: proxy_cache_background_update and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
6793
diff
changeset
|
3714 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3715 #endif |
507 | 3716 |
509 | 3717 ngx_conf_merge_value(conf->upstream.pass_request_headers, |
3718 prev->upstream.pass_request_headers, 1); | |
3719 ngx_conf_merge_value(conf->upstream.pass_request_body, | |
3720 prev->upstream.pass_request_body, 1); | |
3721 | |
657 | 3722 ngx_conf_merge_value(conf->upstream.intercept_errors, |
3723 prev->upstream.intercept_errors, 0); | |
509 | 3724 |
2184 | 3725 #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
|
3726 |
2184 | 3727 ngx_conf_merge_value(conf->upstream.ssl_session_reuse, |
3728 prev->upstream.ssl_session_reuse, 1); | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3729 |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3730 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
|
3731 (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1 |
b2899e7d0ef8
Disabled SSLv3 by default (ticket #653).
Maxim Dounin <mdounin@mdounin.ru>
parents:
6056
diff
changeset
|
3732 |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
|
3733 |
5390
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3734 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
|
3735 "DEFAULT"); |
919d230ecdbe
Proxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora <piotr@cloudflare.com>
parents:
5385
diff
changeset
|
3736 |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3737 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
|
3738 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
|
3739 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
|
3740 prev->upstream.ssl_server_name, 0); |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3741 ngx_conf_merge_value(conf->upstream.ssl_verify, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3742 prev->upstream.ssl_verify, 0); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3743 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
|
3744 prev->ssl_verify_depth, 1); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3745 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
|
3746 prev->ssl_trusted_certificate, ""); |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
3747 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
|
3748 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3749 ngx_conf_merge_ptr_value(conf->upstream.ssl_certificate, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3750 prev->upstream.ssl_certificate, NULL); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3751 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
|
3752 prev->upstream.ssl_certificate_key, NULL); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3753 ngx_conf_merge_ptr_value(conf->upstream.ssl_passwords, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
3754 prev->upstream.ssl_passwords, NULL); |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
3755 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3756 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
|
3757 prev->ssl_conf_commands, NULL); |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
3758 |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3759 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
|
3760 return NGX_CONF_ERROR; |
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
3761 } |
5660
7022564a9e0e
Upstream: proxy_ssl_name and proxy_ssl_server_name directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5659
diff
changeset
|
3762 |
2184 | 3763 #endif |
3764 | |
7831
bdd4d89370a7
Changed complex value slots to use NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7787
diff
changeset
|
3765 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
|
3766 |
509 | 3767 ngx_conf_merge_value(conf->redirect, prev->redirect, 1); |
3768 | |
3769 if (conf->redirect) { | |
507 | 3770 |
509 | 3771 if (conf->redirects == NULL) { |
3772 conf->redirects = prev->redirects; | |
3773 } | |
3774 | |
1658 | 3775 if (conf->redirects == NULL && conf->url.data) { |
509 | 3776 |
3777 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
|
3778 sizeof(ngx_http_proxy_rewrite_t)); |
509 | 3779 if (conf->redirects == NULL) { |
3780 return NGX_CONF_ERROR; | |
3781 } | |
3782 | |
3783 pr = ngx_array_push(conf->redirects); | |
3784 if (pr == NULL) { | |
3785 return NGX_CONF_ERROR; | |
3786 } | |
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 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
|
3789 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
|
3790 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3791 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
|
3792 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3793 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
1658 | 3794 |
3795 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
|
3796 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
|
3797 pr->replacement.value = conf->location; |
653 | 3798 |
3799 } else { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3800 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
|
3801 + sizeof("/") - 1; |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3802 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3803 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
|
3804 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
|
3805 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
|
3806 } |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3807 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
3808 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
|
3809 |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3810 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
|
3811 *p = '/'; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
3812 |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
3813 ngx_str_set(&pr->replacement.value, "/"); |
653 | 3814 } |
509 | 3815 } |
3816 } | |
3817 | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
3818 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
|
3819 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
3820 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
|
3821 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
3822 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
|
3823 |
4126
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3824 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
|
3825 NGX_HTTP_VERSION_10); |
bba9a5ccc6cd
Proxy: basic HTTP/1.1 support (including keepalive).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4125
diff
changeset
|
3826 |
1180
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3827 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
|
3828 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
|
3829 |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3830 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
|
3831 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
|
3832 |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3833 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
|
3834 ngx_cacheline_size); |
1666b7b0bafc
proxy_headers_hash_max_size and proxy_headers_hash_bucket_size
Igor Sysoev <igor@sysoev.ru>
parents:
1125
diff
changeset
|
3835 |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3836 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
|
3837 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
|
3838 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
|
3839 |
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1699
diff
changeset
|
3840 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
|
3841 &prev->upstream, ngx_http_proxy_hide_headers, &hash) |
649 | 3842 != NGX_OK) |
3843 { | |
3844 return NGX_CONF_ERROR; | |
3845 } | |
3846 | |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3847 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
|
3848 |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3849 if (clcf->noname |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3850 && 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
|
3851 { |
884 | 3852 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
|
3853 conf->location = prev->location; |
1658 | 3854 conf->vars = prev->vars; |
5937
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3855 |
3734
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3856 conf->proxy_lengths = prev->proxy_lengths; |
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3857 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
|
3858 |
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3859 #if (NGX_HTTP_SSL) |
5b9f711dc819
Upstream: inheritance of proxy_pass and friends (ticket #645).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5936
diff
changeset
|
3860 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
|
3861 #endif |
3734
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3862 } |
e3a6785b5be4
*) make code consistent to fastcgi, etc
Igor Sysoev <igor@sysoev.ru>
parents:
3733
diff
changeset
|
3863 |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3864 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
|
3865 && (conf->upstream.upstream || conf->proxy_lengths)) |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3866 { |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
3867 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
|
3868 } |
577 | 3869 |
3870 if (conf->body_source.data == NULL) { | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3871 conf->body_flushes = prev->body_flushes; |
577 | 3872 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
|
3873 conf->body_lengths = prev->body_lengths; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3874 conf->body_values = prev->body_values; |
577 | 3875 } |
3876 | |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3877 if (conf->body_source.data && conf->body_lengths == NULL) { |
577 | 3878 |
3879 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
3880 | |
3881 sc.cf = cf; | |
3882 sc.source = &conf->body_source; | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3883 sc.flushes = &conf->body_flushes; |
5910
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3884 sc.lengths = &conf->body_lengths; |
29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
Roman Arutyunyan <arut@nginx.com>
parents:
5909
diff
changeset
|
3885 sc.values = &conf->body_values; |
577 | 3886 sc.complete_lengths = 1; |
3887 sc.complete_values = 1; | |
3888 | |
3889 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
3890 return NGX_CONF_ERROR; | |
3891 } | |
3892 } | |
3893 | |
7728
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3894 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
|
3895 |
485dba3e2a01
Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7720
diff
changeset
|
3896 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
|
3897 conf->headers = prev->headers; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3898 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3899 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
|
3900 #endif |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3901 } |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3902 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3903 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
|
3904 ngx_http_proxy_headers); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3905 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3906 return NGX_CONF_ERROR; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3907 } |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3908 |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3909 #if (NGX_HTTP_CACHE) |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3910 |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3911 if (conf->upstream.cache) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3912 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
|
3913 ngx_http_proxy_cache_headers); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3914 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3915 return NGX_CONF_ERROR; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3916 } |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3917 } |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3918 |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3919 #endif |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5905
diff
changeset
|
3920 |
6747
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3921 /* |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3922 * 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
|
3923 * 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
|
3924 */ |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3925 |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3926 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
|
3927 && 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
|
3928 { |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3929 prev->headers = conf->headers; |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3930 #if (NGX_HTTP_CACHE) |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3931 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
|
3932 #endif |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3933 } |
20eb4587225b
Upstream: handling of proxy_set_header at http level.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6746
diff
changeset
|
3934 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3935 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3936 } |
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 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3939 static ngx_int_t |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3940 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
|
3941 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
|
3942 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3943 u_char *p; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3944 size_t size; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3945 uintptr_t *code; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3946 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
|
3947 ngx_array_t headers_names, headers_merged; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3948 ngx_keyval_t *src, *s, *h; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3949 ngx_hash_key_t *hk; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3950 ngx_hash_init_t hash; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3951 ngx_http_script_compile_t sc; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3952 ngx_http_script_copy_code_t *copy; |
577 | 3953 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3954 if (headers->hash.buckets) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3955 return NGX_OK; |
509 | 3956 } |
3957 | |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
3958 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
|
3959 != NGX_OK) |
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
3960 { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3961 return NGX_ERROR; |
509 | 3962 } |
3963 | |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3964 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
|
3965 != NGX_OK) |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3966 { |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3967 return NGX_ERROR; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3968 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3969 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3970 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
|
3971 if (headers->lengths == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3972 return NGX_ERROR; |
509 | 3973 } |
3974 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
3975 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
|
3976 if (headers->values == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
3977 return NGX_ERROR; |
509 | 3978 } |
3979 | |
6746
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3980 if (conf->headers_source) { |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3981 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3982 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
|
3983 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
|
3984 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3985 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
|
3986 if (s == NULL) { |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3987 return NGX_ERROR; |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3988 } |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3989 |
63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6591
diff
changeset
|
3990 *s = src[i]; |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3991 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3992 } |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3993 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3994 h = default_headers; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
3995 |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
3996 while (h->key.len) { |
509 | 3997 |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3998 src = headers_merged.elts; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
3999 for (i = 0; i < headers_merged.nelts; i++) { |
509 | 4000 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { |
4001 goto next; | |
507 | 4002 } |
4003 } | |
4004 | |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4005 s = ngx_array_push(&headers_merged); |
509 | 4006 if (s == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4007 return NGX_ERROR; |
507 | 4008 } |
4009 | |
509 | 4010 *s = *h; |
507 | 4011 |
509 | 4012 next: |
507 | 4013 |
2705
d040c3786239
do not pass if-... headers for cacheable responses
Igor Sysoev <igor@sysoev.ru>
parents:
2672
diff
changeset
|
4014 h++; |
509 | 4015 } |
507 | 4016 |
577 | 4017 |
4274
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4018 src = headers_merged.elts; |
595560d9dcbf
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4205
diff
changeset
|
4019 for (i = 0; i < headers_merged.nelts; i++) { |
507 | 4020 |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
4021 hk = ngx_array_push(&headers_names); |
649 | 4022 if (hk == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4023 return NGX_ERROR; |
507 | 4024 } |
4025 | |
649 | 4026 hk->key = src[i].key; |
4027 hk->key_hash = ngx_hash_key_lc(src[i].key.data, src[i].key.len); | |
4028 hk->value = (void *) 1; | |
509 | 4029 |
519 | 4030 if (src[i].value.len == 0) { |
4031 continue; | |
4032 } | |
4033 | |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4034 copy = ngx_array_push_n(headers->lengths, |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4035 sizeof(ngx_http_script_copy_code_t)); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4036 if (copy == NULL) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4037 return NGX_ERROR; |
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 |
7271
9e25a5380a21
Silenced -Wcast-function-type warnings (closes #1546).
Sergey Kandaurov <pluknet@nginx.com>
parents:
7238
diff
changeset
|
4040 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
|
4041 ngx_http_script_copy_len_code; |
7047
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4042 copy->len = src[i].key.len; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4043 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4044 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
|
4045 + 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
|
4046 & ~(sizeof(uintptr_t) - 1); |
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 = ngx_array_push_n(headers->values, size); |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4049 if (copy == NULL) { |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4050 return NGX_ERROR; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4051 } |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4052 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4053 copy->code = ngx_http_script_copy_code; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4054 copy->len = src[i].key.len; |
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 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
|
4057 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
|
4058 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4059 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
|
4060 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4061 sc.cf = cf; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4062 sc.source = &src[i].value; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4063 sc.flushes = &headers->flushes; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4064 sc.lengths = &headers->lengths; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4065 sc.values = &headers->values; |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4066 |
3fef8c5caa75
Proxy: split configured header names and values.
Piotr Sikora <piotrsikora@google.com>
parents:
7001
diff
changeset
|
4067 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
|
4068 return NGX_ERROR; |
507 | 4069 } |
4070 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4071 code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t)); |
509 | 4072 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4073 return NGX_ERROR; |
507 | 4074 } |
4075 | |
509 | 4076 *code = (uintptr_t) NULL; |
4077 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4078 code = ngx_array_push_n(headers->values, sizeof(uintptr_t)); |
509 | 4079 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4080 return NGX_ERROR; |
509 | 4081 } |
4082 | |
4083 *code = (uintptr_t) NULL; | |
507 | 4084 } |
4085 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4086 code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t)); |
509 | 4087 if (code == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4088 return NGX_ERROR; |
507 | 4089 } |
4090 | |
509 | 4091 *code = (uintptr_t) NULL; |
507 | 4092 |
4093 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
4094 hash.hash = &headers->hash; |
649 | 4095 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
|
4096 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
|
4097 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
|
4098 hash.name = "proxy_headers_hash"; |
649 | 4099 hash.pool = cf->pool; |
4100 hash.temp_pool = NULL; | |
4101 | |
3561
20708cffd6dc
use local headers_names array instead of stored in configuration
Igor Sysoev <igor@sysoev.ru>
parents:
3526
diff
changeset
|
4102 return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts); |
507 | 4103 } |
4104 | |
4105 | |
4106 static char * | |
4107 ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4108 { | |
509 | 4109 ngx_http_proxy_loc_conf_t *plcf = conf; |
507 | 4110 |
1658 | 4111 size_t add; |
4112 u_short port; | |
4113 ngx_str_t *value, *url; | |
4114 ngx_url_t u; | |
4115 ngx_uint_t n; | |
4116 ngx_http_core_loc_conf_t *clcf; | |
4117 ngx_http_script_compile_t sc; | |
507 | 4118 |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4119 if (plcf->upstream.upstream || plcf->proxy_lengths) { |
555 | 4120 return "is duplicate"; |
4121 } | |
4122 | |
1658 | 4123 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
4124 | |
2989
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4125 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
|
4126 |
7321
45e513c3540d
Fixed invalid access to location defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
7320
diff
changeset
|
4127 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
|
4128 clcf->auto_redirect = 1; |
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4129 } |
dff9764eaca2
do auto redirect for proxy_pass/fastcgi_pass with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2949
diff
changeset
|
4130 |
507 | 4131 value = cf->args->elts; |
4132 | |
4133 url = &value[1]; | |
4134 | |
1658 | 4135 n = ngx_http_script_variables_count(url); |
4136 | |
4137 if (n) { | |
4138 | |
4139 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
4140 | |
4141 sc.cf = cf; | |
4142 sc.source = url; | |
4143 sc.lengths = &plcf->proxy_lengths; | |
4144 sc.values = &plcf->proxy_values; | |
4145 sc.variables = n; | |
4146 sc.complete_lengths = 1; | |
4147 sc.complete_values = 1; | |
1679
ca317d9b5c09
style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents:
1671
diff
changeset
|
4148 |
1658 | 4149 if (ngx_http_script_compile(&sc) != NGX_OK) { |
4150 return NGX_CONF_ERROR; | |
4151 } | |
4152 | |
4153 #if (NGX_HTTP_SSL) | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4154 plcf->ssl = 1; |
1658 | 4155 #endif |
4156 | |
4157 return NGX_CONF_OK; | |
4158 } | |
4159 | |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
969
diff
changeset
|
4160 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { |
577 | 4161 add = 7; |
591 | 4162 port = 80; |
577 | 4163 |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
969
diff
changeset
|
4164 } else if (ngx_strncasecmp(url->data, (u_char *) "https://", 8) == 0) { |
577 | 4165 |
4166 #if (NGX_HTTP_SSL) | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4167 plcf->ssl = 1; |
577 | 4168 |
4169 add = 8; | |
591 | 4170 port = 443; |
577 | 4171 #else |
4172 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4173 "https protocol requires SSL support"); | |
4174 return NGX_CONF_ERROR; | |
4175 #endif | |
4176 | |
4177 } else { | |
507 | 4178 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix"); |
4179 return NGX_CONF_ERROR; | |
4180 } | |
4181 | |
651 | 4182 ngx_memzero(&u, sizeof(ngx_url_t)); |
4183 | |
4184 u.url.len = url->len - add; | |
4185 u.url.data = url->data + add; | |
906 | 4186 u.default_port = port; |
4187 u.uri_part = 1; | |
884 | 4188 u.no_resolve = 1; |
4189 | |
4190 plcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); | |
4191 if (plcf->upstream.upstream == NULL) { | |
507 | 4192 return NGX_CONF_ERROR; |
4193 } | |
4194 | |
2391
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4195 plcf->vars.schema.len = add; |
d88e757cc7d8
delete surplus upstream.schema field
Igor Sysoev <igor@sysoev.ru>
parents:
2285
diff
changeset
|
4196 plcf->vars.schema.data = url->data; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4197 plcf->vars.key_start = plcf->vars.schema; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4198 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4199 ngx_http_proxy_set_vars(&u, &plcf->vars); |
507 | 4200 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4201 plcf->location = clcf->name; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4202 |
1353 | 4203 if (clcf->named |
507 | 4204 #if (NGX_PCRE) |
1353 | 4205 || clcf->regex |
4206 #endif | |
4207 || clcf->noname) | |
4208 { | |
1658 | 4209 if (plcf->vars.uri.len) { |
573 | 4210 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
|
4211 "\"proxy_pass\" cannot have URI part in " |
843
ebab9490204c
allow proxy_pass inside limit_except
Igor Sysoev <igor@sysoev.ru>
parents:
812
diff
changeset
|
4212 "location given by regular expression, " |
1353 | 4213 "or inside named location, " |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4214 "or inside \"if\" statement, " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
4215 "or inside \"limit_except\" block"); |
573 | 4216 return NGX_CONF_ERROR; |
4217 } | |
4218 | |
1658 | 4219 plcf->location.len = 0; |
555 | 4220 } |
4221 | |
1658 | 4222 plcf->url = *url; |
509 | 4223 |
507 | 4224 return NGX_CONF_OK; |
4225 } | |
4226 | |
4227 | |
4228 static char * | |
509 | 4229 ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
507 | 4230 { |
509 | 4231 ngx_http_proxy_loc_conf_t *plcf = conf; |
4232 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4233 u_char *p; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4234 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
|
4235 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
|
4236 ngx_http_compile_complex_value_t ccv; |
509 | 4237 |
4238 if (plcf->redirect == 0) { | |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4239 return "is duplicate"; |
509 | 4240 } |
4241 | |
4422
b1a9d725ab69
Fixed proxy_redirect off inheritance.
Valentin Bartenev <vbart@nginx.com>
parents:
4412
diff
changeset
|
4242 plcf->redirect = 1; |
b1a9d725ab69
Fixed proxy_redirect off inheritance.
Valentin Bartenev <vbart@nginx.com>
parents:
4412
diff
changeset
|
4243 |
509 | 4244 value = cf->args->elts; |
4245 | |
2784
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4246 if (cf->args->nelts == 2) { |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4247 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
|
4248 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4249 if (plcf->redirects) { |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4250 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4251 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4252 |
2784
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4253 plcf->redirect = 0; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4254 return NGX_CONF_OK; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4255 } |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4256 |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4257 if (ngx_strcmp(value[1].data, "default") != 0) { |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4258 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
|
4259 "invalid parameter \"%V\"", &value[1]); |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4260 return NGX_CONF_ERROR; |
c2230102df6f
*) check a proxy_redirect single parameter
Igor Sysoev <igor@sysoev.ru>
parents:
2753
diff
changeset
|
4261 } |
509 | 4262 } |
4263 | |
4264 if (plcf->redirects == NULL) { | |
4265 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
|
4266 sizeof(ngx_http_proxy_rewrite_t)); |
509 | 4267 if (plcf->redirects == NULL) { |
4268 return NGX_CONF_ERROR; | |
4269 } | |
4270 } | |
4271 | |
4272 pr = ngx_array_push(plcf->redirects); | |
4273 if (pr == NULL) { | |
4274 return NGX_CONF_ERROR; | |
4275 } | |
4276 | |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4277 if (cf->args->nelts == 2 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4278 && ngx_strcmp(value[1].data, "default") == 0) |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4279 { |
3471
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4280 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
|
4281 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
|
4282 "\"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
|
4283 "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
|
4284 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
|
4285 } |
d8c56e7851b8
"proxy_redirect default" may not be used if a proxy_pass uses variables
Igor Sysoev <igor@sysoev.ru>
parents:
3470
diff
changeset
|
4286 |
1658 | 4287 if (plcf->url.data == NULL) { |
509 | 4288 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
|
4289 "\"proxy_redirect default\" should be placed " |
509 | 4290 "after the \"proxy_pass\" directive"); |
4291 return NGX_CONF_ERROR; | |
4292 } | |
4293 | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4294 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
|
4295 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4296 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
|
4297 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4298 ngx_memzero(&pr->replacement, sizeof(ngx_http_complex_value_t)); |
1658 | 4299 |
4300 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
|
4301 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
|
4302 pr->replacement.value = plcf->location; |
653 | 4303 |
4304 } else { | |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4305 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
|
4306 |
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4307 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
|
4308 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
|
4309 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
|
4310 } |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4311 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4312 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
|
4313 |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4314 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
|
4315 *p = '/'; |
f4c49c9e4bb5
always test proxy_redirect with slash, this fixes a case when nginx uses
Igor Sysoev <igor@sysoev.ru>
parents:
3734
diff
changeset
|
4316 |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4317 ngx_str_set(&pr->replacement.value, "/"); |
653 | 4318 } |
509 | 4319 |
4320 return NGX_CONF_OK; | |
4321 } | |
4322 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4323 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4324 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
|
4325 value[1].len--; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4326 value[1].data++; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4327 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4328 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
|
4329 value[1].len--; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4330 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
|
4331 |
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], 1) != 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 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4335 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4336 } else { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4337 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
|
4338 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
|
4339 } |
4336
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 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4342 } else { |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4343 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4344 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
|
4345 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4346 ccv.cf = cf; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4347 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
|
4348 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
|
4349 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4350 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
|
4351 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
|
4352 } |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4353 |
4461
103587c7ae5f
Proxy: renamed some "proxy_redirect" related declarations to a more general and
Valentin Bartenev <vbart@nginx.com>
parents:
4422
diff
changeset
|
4354 pr->handler = ngx_http_proxy_rewrite_complex_handler; |
509 | 4355 } |
4356 | |
4336
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4357 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4358 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
|
4359 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4360 ccv.cf = cf; |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4361 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
|
4362 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
|
4363 |
99437094e86f
Proxy: added variables and regexp support to the first parameter of
Valentin Bartenev <vbart@nginx.com>
parents:
4276
diff
changeset
|
4364 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
509 | 4365 return NGX_CONF_ERROR; |
4366 } | |
4367 | |
507 | 4368 return NGX_CONF_OK; |
4369 } | |
4370 | |
4371 | |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4372 static char * |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4373 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
|
4374 { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4375 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
|
4376 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4377 ngx_str_t *value; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4378 ngx_http_proxy_rewrite_t *pr; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4379 ngx_http_compile_complex_value_t ccv; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4380 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4381 if (plcf->cookie_domains == NULL) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4382 return "is duplicate"; |
4465
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 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4385 value = cf->args->elts; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4386 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4387 if (cf->args->nelts == 2) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4388 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4389 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
|
4390 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4391 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
|
4392 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4393 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4394 |
4465
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4395 plcf->cookie_domains = NULL; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4396 return NGX_CONF_OK; |
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 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
|
4400 "invalid parameter \"%V\"", &value[1]); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4401 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4402 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4403 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4404 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
|
4405 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
|
4406 sizeof(ngx_http_proxy_rewrite_t)); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4407 if (plcf->cookie_domains == NULL) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4408 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4409 } |
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 pr = ngx_array_push(plcf->cookie_domains); |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4413 if (pr == NULL) { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4414 return NGX_CONF_ERROR; |
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 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4417 if (value[1].data[0] == '~') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4418 value[1].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4419 value[1].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4420 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4421 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
|
4422 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4423 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4424 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4425 } else { |
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 if (value[1].data[0] == '.') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4428 value[1].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4429 value[1].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4430 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4431 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4432 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
|
4433 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4434 ccv.cf = cf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4435 ccv.value = &value[1]; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4436 ccv.complex_value = &pr->pattern.complex; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4437 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4438 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
|
4439 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4440 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4441 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4442 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
|
4443 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4444 if (value[2].data[0] == '.') { |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4445 value[2].len--; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4446 value[2].data++; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4447 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4448 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4449 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4450 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
|
4451 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4452 ccv.cf = cf; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4453 ccv.value = &value[2]; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4454 ccv.complex_value = &pr->replacement; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4455 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4456 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
|
4457 return NGX_CONF_ERROR; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4458 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4459 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4460 return NGX_CONF_OK; |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4461 } |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4462 |
8293fc2d802b
Proxy: added the "proxy_cookie_domain" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4463
diff
changeset
|
4463 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4464 static char * |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4465 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
|
4466 { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4467 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
|
4468 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4469 ngx_str_t *value; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4470 ngx_http_proxy_rewrite_t *pr; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4471 ngx_http_compile_complex_value_t ccv; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4472 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4473 if (plcf->cookie_paths == NULL) { |
7714
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4474 return "is duplicate"; |
4466
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 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4477 value = cf->args->elts; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4478 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4479 if (cf->args->nelts == 2) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4480 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4481 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
|
4482 |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4483 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
|
4484 return "is duplicate"; |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4485 } |
8dbc9ee97998
Proxy: strengthen syntax checking for some directives.
Ruslan Ermilov <ru@nginx.com>
parents:
7677
diff
changeset
|
4486 |
4466
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4487 plcf->cookie_paths = NULL; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4488 return NGX_CONF_OK; |
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 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
|
4492 "invalid parameter \"%V\"", &value[1]); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4493 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4494 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4495 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4496 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
|
4497 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
|
4498 sizeof(ngx_http_proxy_rewrite_t)); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4499 if (plcf->cookie_paths == NULL) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4500 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4501 } |
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 pr = ngx_array_push(plcf->cookie_paths); |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4505 if (pr == NULL) { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4506 return NGX_CONF_ERROR; |
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 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4509 if (value[1].data[0] == '~') { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4510 value[1].len--; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4511 value[1].data++; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4512 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4513 if (value[1].data[0] == '*') { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4514 value[1].len--; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4515 value[1].data++; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4516 |
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], 1) != 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 } else { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4522 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
|
4523 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4524 } |
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 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4527 } else { |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4528 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4529 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
|
4530 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4531 ccv.cf = cf; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4532 ccv.value = &value[1]; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4533 ccv.complex_value = &pr->pattern.complex; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4534 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4535 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
|
4536 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4537 } |
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 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
|
4540 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4541 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4542 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
|
4543 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4544 ccv.cf = cf; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4545 ccv.value = &value[2]; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4546 ccv.complex_value = &pr->replacement; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4547 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4548 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
|
4549 return NGX_CONF_ERROR; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4550 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4551 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4552 return NGX_CONF_OK; |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4553 } |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4554 |
b404f34b5cb8
Proxy: added the "proxy_cookie_path" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4465
diff
changeset
|
4555 |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4556 static char * |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4557 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
|
4558 { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4559 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
|
4560 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4561 ngx_str_t *value; |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4562 ngx_uint_t i; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4563 ngx_http_complex_value_t *cv; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4564 ngx_http_proxy_cookie_flags_t *pcf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4565 ngx_http_compile_complex_value_t ccv; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4566 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4567 ngx_regex_compile_t rc; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4568 u_char errstr[NGX_MAX_CONF_ERRSTR]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4569 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4570 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4571 if (plcf->cookie_flags == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4572 return "is duplicate"; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4575 value = cf->args->elts; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4576 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4577 if (cf->args->nelts == 2) { |
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 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
|
4580 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4581 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
|
4582 return "is duplicate"; |
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 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4585 plcf->cookie_flags = NULL; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4586 return NGX_CONF_OK; |
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 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
|
4590 "invalid parameter \"%V\"", &value[1]); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4591 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4592 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4593 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4594 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
|
4595 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
|
4596 sizeof(ngx_http_proxy_cookie_flags_t)); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4597 if (plcf->cookie_flags == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4598 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4599 } |
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 = ngx_array_push(plcf->cookie_flags); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4603 if (pcf == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4604 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4605 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4606 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4607 pcf->regex = 0; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4608 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4609 if (value[1].data[0] == '~') { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4610 value[1].len--; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4611 value[1].data++; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4612 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4613 #if (NGX_PCRE) |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4614 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
|
4615 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4616 rc.pattern = value[1]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4617 rc.err.len = NGX_MAX_CONF_ERRSTR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4618 rc.err.data = errstr; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4619 rc.options = NGX_REGEX_CASELESS; |
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->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
|
4622 if (pcf->cookie.regex == NULL) { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4623 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4624 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4625 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4626 pcf->regex = 1; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4627 #else |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4628 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
|
4629 "using regex \"%V\" requires PCRE library", |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4630 &value[1]); |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4631 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4632 #endif |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4633 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4634 } else { |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4635 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4636 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
|
4637 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4638 ccv.cf = cf; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4639 ccv.value = &value[1]; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4640 ccv.complex_value = &pcf->cookie.complex; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4641 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4642 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
|
4643 return NGX_CONF_ERROR; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4644 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4645 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4646 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4647 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
|
4648 sizeof(ngx_http_complex_value_t)) |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4649 != NGX_OK) |
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 return NGX_CONF_ERROR; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4652 } |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4653 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4654 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
|
4655 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4656 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
|
4657 if (cv == NULL) { |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4658 return NGX_CONF_ERROR; |
7716
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4659 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4660 |
7786
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4661 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
|
4662 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4663 ccv.cf = cf; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4664 ccv.value = &value[i]; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4665 ccv.complex_value = cv; |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4666 |
529b73f75d19
Proxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov <ru@nginx.com>
parents:
7760
diff
changeset
|
4667 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
|
4668 return NGX_CONF_ERROR; |
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 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4671 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4672 return NGX_CONF_OK; |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4673 } |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4674 |
d6a5e14aa3e4
Proxy: added the "proxy_cookie_flags" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7715
diff
changeset
|
4675 |
4463
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4676 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
|
4677 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
|
4678 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
|
4679 { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4680 #if (NGX_PCRE) |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4681 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
|
4682 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
|
4683 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4684 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
|
4685 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4686 rc.pattern = *regex; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4687 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
|
4688 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
|
4689 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4690 if (caseless) { |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4691 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
|
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->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
|
4695 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
|
4696 return NGX_ERROR; |
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 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4699 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
|
4700 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4701 return NGX_OK; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4702 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4703 #else |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4704 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4705 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
|
4706 "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
|
4707 return NGX_ERROR; |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4708 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4709 #endif |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4710 } |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4711 |
a068ec122f17
Proxy: generic regex related code from the "proxy_redirect" directive moved
Valentin Bartenev <vbart@nginx.com>
parents:
4462
diff
changeset
|
4712 |
507 | 4713 static char * |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4714 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
|
4715 { |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4716 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
|
4717 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4718 ngx_str_t *value; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4719 ngx_http_script_compile_t sc; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4720 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4721 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
|
4722 return "is duplicate"; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4723 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4724 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4725 value = cf->args->elts; |
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_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
|
4728 plcf->upstream.store = 0; |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4729 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4730 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4731 |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4732 #if (NGX_HTTP_CACHE) |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4733 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
|
4734 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
|
4735 } |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4736 #endif |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4737 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4738 plcf->upstream.store = 1; |
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4739 |
2895
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4740 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
|
4741 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4742 } |
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 /* include the terminating '\0' into script */ |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4745 value[1].len++; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4746 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4747 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
|
4748 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4749 sc.cf = cf; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4750 sc.source = &value[1]; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4751 sc.lengths = &plcf->upstream.store_lengths; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4752 sc.values = &plcf->upstream.store_values; |
1563
022ec9420f80
style fix: remove double semicolons
Igor Sysoev <igor@sysoev.ru>
parents:
1488
diff
changeset
|
4753 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
|
4754 sc.complete_lengths = 1; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4755 sc.complete_values = 1; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4756 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4757 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
|
4758 return NGX_CONF_ERROR; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4759 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4760 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4761 return NGX_CONF_OK; |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4762 } |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4763 |
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4764 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4765 #if (NGX_HTTP_CACHE) |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4766 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4767 static char * |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4768 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
|
4769 { |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4770 ngx_http_proxy_loc_conf_t *plcf = conf; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4771 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4772 ngx_str_t *value; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4773 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
|
4774 ngx_http_compile_complex_value_t ccv; |
2592
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 value = cf->args->elts; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4777 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4778 if (plcf->upstream.cache != NGX_CONF_UNSET) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4779 return "is duplicate"; |
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 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4782 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
|
4783 plcf->upstream.cache = 0; |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4784 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4785 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4786 |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
4787 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
|
4788 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
|
4789 } |
d65e58a8d3a4
report about proxy/fastcgi_store and proxy/fastcgi_cache incompatibility
Igor Sysoev <igor@sysoev.ru>
parents:
2894
diff
changeset
|
4790 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4791 plcf->upstream.cache = 1; |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4792 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4793 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
|
4794 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4795 ccv.cf = cf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4796 ccv.value = &value[1]; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4797 ccv.complex_value = &cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4798 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4799 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
|
4800 return NGX_CONF_ERROR; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4801 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4802 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4803 if (cv.lengths != NULL) { |
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 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
|
4806 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
|
4807 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
|
4808 return NGX_CONF_ERROR; |
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 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4811 *plcf->upstream.cache_value = cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4812 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4813 return NGX_CONF_OK; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4814 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
4815 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4816 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
|
4817 &ngx_http_proxy_module); |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
4818 if (plcf->upstream.cache_zone == NULL) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4819 return NGX_CONF_ERROR; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4820 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4821 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4822 return NGX_CONF_OK; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4823 } |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4824 |
2672 | 4825 |
4826 static char * | |
4827 ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4828 { | |
4829 ngx_http_proxy_loc_conf_t *plcf = conf; | |
4830 | |
4831 ngx_str_t *value; | |
4832 ngx_http_compile_complex_value_t ccv; | |
4833 | |
4834 value = cf->args->elts; | |
4835 | |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4927
diff
changeset
|
4836 if (plcf->cache_key.value.data) { |
2672 | 4837 return "is duplicate"; |
4838 } | |
4839 | |
4840 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
4841 | |
4842 ccv.cf = cf; | |
4843 ccv.value = &value[1]; | |
4844 ccv.complex_value = &plcf->cache_key; | |
4845 | |
4846 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
4847 return NGX_CONF_ERROR; | |
4848 } | |
4849 | |
4850 return NGX_CONF_OK; | |
4851 } | |
4852 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4853 #endif |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4854 |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
4855 |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4856 #if (NGX_HTTP_SSL) |
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 static char * |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4859 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
|
4860 { |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4861 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
|
4862 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4863 ngx_str_t *value; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4864 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4865 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
|
4866 return "is duplicate"; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4867 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4868 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4869 value = cf->args->elts; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4870 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4871 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
|
4872 |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4873 if (plcf->upstream.ssl_passwords == NULL) { |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4874 return NGX_CONF_ERROR; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4875 } |
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 return NGX_CONF_OK; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4878 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4879 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4880 #endif |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4881 |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4882 |
1295
5383f5232364
proxy_store and fastcgi_store were changed,
Igor Sysoev <igor@sysoev.ru>
parents:
1291
diff
changeset
|
4883 static char * |
507 | 4884 ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data) |
4885 { | |
4886 #if (NGX_FREEBSD) | |
4887 ssize_t *np = data; | |
4888 | |
673 | 4889 if ((u_long) *np >= ngx_freebsd_net_inet_tcp_sendspace) { |
507 | 4890 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4891 "\"proxy_send_lowat\" must be less than %d " | |
4892 "(sysctl net.inet.tcp.sendspace)", | |
4893 ngx_freebsd_net_inet_tcp_sendspace); | |
4894 | |
4895 return NGX_CONF_ERROR; | |
4896 } | |
4897 | |
4898 #elif !(NGX_HAVE_SO_SNDLOWAT) | |
4899 ssize_t *np = data; | |
4900 | |
4901 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4902 "\"proxy_send_lowat\" is not supported, ignored"); | |
4903 | |
4904 *np = 0; | |
4905 | |
4906 #endif | |
4907 | |
4908 return NGX_CONF_OK; | |
4909 } | |
884 | 4910 |
4911 | |
1658 | 4912 #if (NGX_HTTP_SSL) |
4913 | |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4914 static char * |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4915 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
|
4916 { |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4917 #ifndef SSL_CONF_FLAG_FILE |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4918 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
|
4919 #else |
7ce28b4cc57e
SSL: fixed build by Sun C with old OpenSSL versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7786
diff
changeset
|
4920 return NGX_CONF_OK; |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4921 #endif |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4922 } |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4923 |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
4924 |
1658 | 4925 static ngx_int_t |
4926 ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf) | |
4927 { | |
4928 ngx_pool_cleanup_t *cln; | |
4929 | |
4930 plcf->upstream.ssl = ngx_pcalloc(cf->pool, sizeof(ngx_ssl_t)); | |
4931 if (plcf->upstream.ssl == NULL) { | |
4932 return NGX_ERROR; | |
4933 } | |
4934 | |
4935 plcf->upstream.ssl->log = cf->log; | |
4936 | |
5385
7c1f4977d8a0
Proxy: added the "proxy_ssl_protocols" directive.
Andrei Belov <defan@nginx.com>
parents:
5359
diff
changeset
|
4937 if (ngx_ssl_create(plcf->upstream.ssl, plcf->ssl_protocols, NULL) |
1658 | 4938 != NGX_OK) |
4939 { | |
4940 return NGX_ERROR; | |
4941 } | |
4942 | |
5659
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4943 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
|
4944 if (cln == NULL) { |
7473
8981dbb12254
SSL: fixed potential leak on memory allocation errors.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7371
diff
changeset
|
4945 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
|
4946 return NGX_ERROR; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4947 } |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4948 |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4949 cln->handler = ngx_ssl_cleanup_ctx; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4950 cln->data = plcf->upstream.ssl; |
3fb6615bb87f
Upstream: plugged potential memory leak on reload.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
4951 |
7904
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4952 if (ngx_ssl_ciphers(cf, plcf->upstream.ssl, &plcf->ssl_ciphers, 0) |
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4953 != NGX_OK) |
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4954 { |
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4955 return NGX_ERROR; |
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4956 } |
419c066cb710
SSL: ciphers now set before loading certificates (ticket #2035).
Maxim Dounin <mdounin@mdounin.ru>
parents:
7884
diff
changeset
|
4957 |
8042
c7e25324be11
Upstream: handling of certificates specified as an empty string.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8033
diff
changeset
|
4958 if (plcf->upstream.ssl_certificate |
c7e25324be11
Upstream: handling of certificates specified as an empty string.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8033
diff
changeset
|
4959 && plcf->upstream.ssl_certificate->value.len) |
c7e25324be11
Upstream: handling of certificates specified as an empty string.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8033
diff
changeset
|
4960 { |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4961 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
|
4962 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
|
4963 "no \"proxy_ssl_certificate_key\" is defined " |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4964 "for certificate \"%V\"", |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4965 &plcf->upstream.ssl_certificate->value); |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4966 return NGX_ERROR; |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4967 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4968 |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4969 if (plcf->upstream.ssl_certificate->lengths |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4970 || plcf->upstream.ssl_certificate_key->lengths) |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4971 { |
7833
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4972 plcf->upstream.ssl_passwords = |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4973 ngx_ssl_preserve_passwords(cf, plcf->upstream.ssl_passwords); |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4974 if (plcf->upstream.ssl_passwords == NULL) { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4975 return NGX_ERROR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4976 } |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4977 |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4978 } else { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4979 if (ngx_ssl_certificate(cf, plcf->upstream.ssl, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4980 &plcf->upstream.ssl_certificate->value, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4981 &plcf->upstream.ssl_certificate_key->value, |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4982 plcf->upstream.ssl_passwords) |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4983 != NGX_OK) |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4984 { |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4985 return NGX_ERROR; |
3ab8e1e2f0f7
Upstream: variables support in certificates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7831
diff
changeset
|
4986 } |
5900
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4987 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4988 } |
20d966ad5e89
Upstream: add "proxy_ssl_certificate" and friends.
Piotr Sikora <piotr@cloudflare.com>
parents:
5883
diff
changeset
|
4989 |
5661
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4990 if (plcf->upstream.ssl_verify) { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4991 if (plcf->ssl_trusted_certificate.len == 0) { |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4992 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
|
4993 "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
|
4994 return NGX_ERROR; |
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 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4997 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
|
4998 &plcf->ssl_trusted_certificate, |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
4999 plcf->ssl_verify_depth) |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5000 != NGX_OK) |
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 return NGX_ERROR; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5003 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5004 |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5005 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
|
5006 return NGX_ERROR; |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5007 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5008 } |
060c2e692b96
Upstream: proxy_ssl_verify and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5660
diff
changeset
|
5009 |
7320
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5010 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
|
5011 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
|
5012 != NGX_OK) |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5013 { |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5014 return NGX_ERROR; |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5015 } |
696df3ac27ac
SSL: save sessions for upstream peers using a callback function.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7271
diff
changeset
|
5016 |
7730
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5017 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
|
5018 != NGX_OK) |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5019 { |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5020 return NGX_ERROR; |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5021 } |
1a719ee45526
Upstream: proxy_ssl_conf_command and friends.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7728
diff
changeset
|
5022 |
1658 | 5023 return NGX_OK; |
5024 } | |
5025 | |
5026 #endif | |
5027 | |
5028 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5029 static void |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5030 ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v) |
1658 | 5031 { |
2203
8e5bf1bc87e2
*) refactor ngx_parse_inet_url()
Igor Sysoev <igor@sysoev.ru>
parents:
2184
diff
changeset
|
5032 if (u->family != AF_UNIX) { |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5033 |
1658 | 5034 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
|
5035 |
1658 | 5036 v->host_header = u->host; |
5037 | |
5038 if (u->default_port == 80) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5039 ngx_str_set(&v->port, "80"); |
1658 | 5040 |
5041 } else { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5042 ngx_str_set(&v->port, "443"); |
1658 | 5043 } |
5044 | |
5045 } 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
|
5046 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
|
5047 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
|
5048 v->port = u->port_text; |
1658 | 5049 } |
5050 | |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5051 v->key_start.len += v->host_header.len; |
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5052 |
1658 | 5053 } else { |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5054 ngx_str_set(&v->host_header, "localhost"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3477
diff
changeset
|
5055 ngx_str_null(&v->port); |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2430
diff
changeset
|
5056 v->key_start.len += sizeof("unix:") - 1 + u->host.len + 1; |
1658 | 5057 } |
5058 | |
5059 v->uri = u->uri; | |
5060 } |