nginxtra 1.6.3.9 → 1.8.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +358 -14
- data/vendor/nginx/CHANGES.ru +372 -18
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/clang +5 -0
- data/vendor/nginx/auto/cc/gcc +5 -0
- data/vendor/nginx/auto/lib/google-perftools/conf +1 -1
- data/vendor/nginx/auto/lib/openssl/make +0 -5
- data/vendor/nginx/auto/lib/perl/conf +9 -1
- data/vendor/nginx/auto/make +1 -1
- data/vendor/nginx/auto/modules +11 -0
- data/vendor/nginx/auto/options +10 -2
- data/vendor/nginx/auto/os/darwin +0 -1
- data/vendor/nginx/auto/os/freebsd +6 -23
- data/vendor/nginx/auto/sources +16 -14
- data/vendor/nginx/auto/summary +3 -24
- data/vendor/nginx/auto/threads +20 -0
- data/vendor/nginx/auto/types/sizeof +2 -12
- data/vendor/nginx/auto/unix +50 -6
- data/vendor/nginx/configure +5 -0
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +183 -50
- data/vendor/nginx/src/core/nginx.c +21 -9
- data/vendor/nginx/src/core/nginx.h +8 -2
- data/vendor/nginx/src/core/ngx_buf.c +88 -0
- data/vendor/nginx/src/core/ngx_buf.h +15 -1
- data/vendor/nginx/src/core/ngx_conf_file.c +4 -1
- data/vendor/nginx/src/core/ngx_connection.c +25 -66
- data/vendor/nginx/src/core/ngx_connection.h +1 -3
- data/vendor/nginx/src/core/ngx_core.h +11 -3
- data/vendor/nginx/src/core/ngx_crypt.c +1 -1
- data/vendor/nginx/src/core/ngx_cycle.c +7 -1
- data/vendor/nginx/src/core/ngx_cycle.h +6 -2
- data/vendor/nginx/src/core/ngx_file.c +13 -5
- data/vendor/nginx/src/core/ngx_file.h +6 -0
- data/vendor/nginx/src/core/ngx_log.c +215 -21
- data/vendor/nginx/src/core/ngx_log.h +9 -1
- data/vendor/nginx/src/core/ngx_output_chain.c +104 -15
- data/vendor/nginx/src/core/ngx_palloc.c +3 -7
- data/vendor/nginx/src/core/ngx_rbtree.c +2 -4
- data/vendor/nginx/src/core/ngx_rbtree.h +2 -4
- data/vendor/nginx/src/core/ngx_regex.c +14 -6
- data/vendor/nginx/src/core/ngx_resolver.c +16 -23
- data/vendor/nginx/src/core/ngx_resolver.h +8 -7
- data/vendor/nginx/src/core/ngx_shmtx.c +1 -1
- data/vendor/nginx/src/core/ngx_slab.c +89 -2
- data/vendor/nginx/src/core/ngx_slab.h +3 -0
- data/vendor/nginx/src/core/ngx_string.c +58 -2
- data/vendor/nginx/src/core/ngx_string.h +1 -0
- data/vendor/nginx/src/core/ngx_syslog.c +374 -0
- data/vendor/nginx/src/core/ngx_syslog.h +30 -0
- data/vendor/nginx/src/core/ngx_thread_pool.c +630 -0
- data/vendor/nginx/src/core/ngx_thread_pool.h +36 -0
- data/vendor/nginx/src/core/ngx_times.c +19 -2
- data/vendor/nginx/src/core/ngx_times.h +1 -0
- data/vendor/nginx/src/event/modules/ngx_aio_module.c +1 -1
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +9 -24
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +152 -28
- data/vendor/nginx/src/event/modules/ngx_eventport_module.c +43 -25
- data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +86 -156
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +21 -37
- data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +15 -27
- data/vendor/nginx/src/event/modules/ngx_select_module.c +10 -12
- data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +7 -9
- data/vendor/nginx/src/event/ngx_event.c +5 -33
- data/vendor/nginx/src/event/ngx_event.h +15 -50
- data/vendor/nginx/src/event/ngx_event_accept.c +11 -10
- data/vendor/nginx/src/event/ngx_event_connect.c +0 -11
- data/vendor/nginx/src/event/ngx_event_connect.h +1 -4
- data/vendor/nginx/src/event/ngx_event_openssl.c +622 -38
- data/vendor/nginx/src/event/ngx_event_openssl.h +20 -2
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +5 -1
- data/vendor/nginx/src/event/ngx_event_pipe.c +45 -19
- data/vendor/nginx/src/event/ngx_event_pipe.h +3 -0
- data/vendor/nginx/src/event/ngx_event_posted.c +7 -145
- data/vendor/nginx/src/event/ngx_event_posted.h +12 -39
- data/vendor/nginx/src/event/ngx_event_timer.c +50 -70
- data/vendor/nginx/src/event/ngx_event_timer.h +2 -14
- data/vendor/nginx/src/http/modules/ngx_http_addition_filter_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +416 -71
- data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +19 -15
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +16 -4
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +601 -134
- data/vendor/nginx/src/http/modules/ngx_http_geo_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_geoip_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +0 -2
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +197 -91
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -0
- data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +65 -162
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +53 -67
- data/vendor/nginx/src/http/modules/ngx_http_log_module.c +128 -23
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +25 -6
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +39 -13
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +697 -141
- data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +5 -1
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +282 -125
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +4 -1
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +44 -1
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +2 -0
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +10 -8
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +18 -3
- data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +641 -0
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +3 -21
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +0 -5
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +449 -125
- data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +4 -2
- data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -1
- data/vendor/nginx/src/http/ngx_http.c +10 -5
- data/vendor/nginx/src/http/ngx_http.h +4 -4
- data/vendor/nginx/src/http/ngx_http_cache.h +26 -1
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +109 -68
- data/vendor/nginx/src/http/ngx_http_core_module.c +191 -46
- data/vendor/nginx/src/http/ngx_http_core_module.h +16 -4
- data/vendor/nginx/src/http/ngx_http_file_cache.c +584 -67
- data/vendor/nginx/src/http/ngx_http_parse.c +55 -4
- data/vendor/nginx/src/http/ngx_http_request.c +14 -6
- data/vendor/nginx/src/http/ngx_http_request.h +12 -4
- data/vendor/nginx/src/http/ngx_http_request_body.c +114 -28
- data/vendor/nginx/src/http/ngx_http_spdy.c +383 -229
- data/vendor/nginx/src/http/ngx_http_spdy.h +8 -5
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +12 -4
- data/vendor/nginx/src/http/ngx_http_special_response.c +2 -2
- data/vendor/nginx/src/http/ngx_http_upstream.c +808 -132
- data/vendor/nginx/src/http/ngx_http_upstream.h +33 -3
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +72 -65
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +1 -2
- data/vendor/nginx/src/http/ngx_http_variables.c +47 -3
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +15 -6
- data/vendor/nginx/src/mail/ngx_mail.c +2 -3
- data/vendor/nginx/src/mail/ngx_mail.h +2 -0
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +140 -11
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +3 -3
- data/vendor/nginx/src/mail/ngx_mail_handler.c +79 -2
- data/vendor/nginx/src/mail/ngx_mail_imap_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_pop3_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_smtp_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +125 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +8 -0
- data/vendor/nginx/src/misc/ngx_cpp_test_module.cpp +1 -1
- data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_channel.c +0 -7
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +0 -3
- data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +44 -208
- data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +25 -17
- data/vendor/nginx/src/os/unix/ngx_files.c +109 -0
- data/vendor/nginx/src/os/unix/ngx_files.h +6 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +0 -6
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +78 -206
- data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +25 -14
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +4 -1
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +235 -194
- data/vendor/nginx/src/os/unix/ngx_os.h +25 -3
- data/vendor/nginx/src/os/unix/ngx_posix_init.c +4 -2
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +13 -195
- data/vendor/nginx/src/os/unix/ngx_process_cycle.h +0 -1
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +27 -108
- data/vendor/nginx/src/os/unix/ngx_setproctitle.h +2 -2
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +12 -67
- data/vendor/nginx/src/os/unix/ngx_thread.h +26 -83
- data/vendor/nginx/src/os/unix/ngx_thread_cond.c +87 -0
- data/vendor/nginx/src/os/unix/ngx_thread_id.c +70 -0
- data/vendor/nginx/src/os/unix/ngx_thread_mutex.c +174 -0
- data/vendor/nginx/src/os/unix/ngx_user.c +2 -20
- data/vendor/nginx/src/os/unix/ngx_writev_chain.c +129 -98
- metadata +16 -17
- data/vendor/nginx/auto/lib/zlib/patch.zlib.h +0 -10
- data/vendor/nginx/src/event/ngx_event_busy_lock.c +0 -286
- data/vendor/nginx/src/event/ngx_event_busy_lock.h +0 -65
- data/vendor/nginx/src/event/ngx_event_mutex.c +0 -70
- data/vendor/nginx/src/http/ngx_http_busy_lock.c +0 -307
- data/vendor/nginx/src/http/ngx_http_busy_lock.h +0 -54
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +0 -756
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +0 -122
- data/vendor/nginx/src/os/unix/ngx_pthread_thread.c +0 -278
- data/vendor/nginx/src/os/unix/rfork_thread.S +0 -73
@@ -10,6 +10,11 @@
|
|
10
10
|
#include <ngx_http.h>
|
11
11
|
|
12
12
|
|
13
|
+
typedef struct {
|
14
|
+
ngx_array_t caches; /* ngx_http_file_cache_t * */
|
15
|
+
} ngx_http_proxy_main_conf_t;
|
16
|
+
|
17
|
+
|
13
18
|
typedef struct ngx_http_proxy_rewrite_s ngx_http_proxy_rewrite_t;
|
14
19
|
|
15
20
|
typedef ngx_int_t (*ngx_http_proxy_rewrite_pt)(ngx_http_request_t *r,
|
@@ -39,16 +44,26 @@ typedef struct {
|
|
39
44
|
} ngx_http_proxy_vars_t;
|
40
45
|
|
41
46
|
|
47
|
+
typedef struct {
|
48
|
+
ngx_array_t *flushes;
|
49
|
+
ngx_array_t *lengths;
|
50
|
+
ngx_array_t *values;
|
51
|
+
ngx_hash_t hash;
|
52
|
+
} ngx_http_proxy_headers_t;
|
53
|
+
|
54
|
+
|
42
55
|
typedef struct {
|
43
56
|
ngx_http_upstream_conf_t upstream;
|
44
57
|
|
45
|
-
ngx_array_t *
|
46
|
-
ngx_array_t *
|
47
|
-
ngx_array_t *
|
48
|
-
|
49
|
-
ngx_array_t *headers_set;
|
50
|
-
ngx_hash_t headers_set_hash;
|
58
|
+
ngx_array_t *body_flushes;
|
59
|
+
ngx_array_t *body_lengths;
|
60
|
+
ngx_array_t *body_values;
|
61
|
+
ngx_str_t body_source;
|
51
62
|
|
63
|
+
ngx_http_proxy_headers_t headers;
|
64
|
+
#if (NGX_HTTP_CACHE)
|
65
|
+
ngx_http_proxy_headers_t headers_cache;
|
66
|
+
#endif
|
52
67
|
ngx_array_t *headers_source;
|
53
68
|
|
54
69
|
ngx_array_t *proxy_lengths;
|
@@ -58,8 +73,6 @@ typedef struct {
|
|
58
73
|
ngx_array_t *cookie_domains;
|
59
74
|
ngx_array_t *cookie_paths;
|
60
75
|
|
61
|
-
ngx_str_t body_source;
|
62
|
-
|
63
76
|
ngx_str_t method;
|
64
77
|
ngx_str_t location;
|
65
78
|
ngx_str_t url;
|
@@ -81,6 +94,12 @@ typedef struct {
|
|
81
94
|
ngx_uint_t ssl;
|
82
95
|
ngx_uint_t ssl_protocols;
|
83
96
|
ngx_str_t ssl_ciphers;
|
97
|
+
ngx_uint_t ssl_verify_depth;
|
98
|
+
ngx_str_t ssl_trusted_certificate;
|
99
|
+
ngx_str_t ssl_crl;
|
100
|
+
ngx_str_t ssl_certificate;
|
101
|
+
ngx_str_t ssl_certificate_key;
|
102
|
+
ngx_array_t *ssl_passwords;
|
84
103
|
#endif
|
85
104
|
} ngx_http_proxy_loc_conf_t;
|
86
105
|
|
@@ -91,7 +110,12 @@ typedef struct {
|
|
91
110
|
ngx_http_proxy_vars_t vars;
|
92
111
|
off_t internal_body_length;
|
93
112
|
|
94
|
-
|
113
|
+
ngx_chain_t *free;
|
114
|
+
ngx_chain_t *busy;
|
115
|
+
|
116
|
+
unsigned head:1;
|
117
|
+
unsigned internal_chunked:1;
|
118
|
+
unsigned header_sent:1;
|
95
119
|
} ngx_http_proxy_ctx_t;
|
96
120
|
|
97
121
|
|
@@ -102,6 +126,7 @@ static ngx_int_t ngx_http_proxy_create_key(ngx_http_request_t *r);
|
|
102
126
|
#endif
|
103
127
|
static ngx_int_t ngx_http_proxy_create_request(ngx_http_request_t *r);
|
104
128
|
static ngx_int_t ngx_http_proxy_reinit_request(ngx_http_request_t *r);
|
129
|
+
static ngx_int_t ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in);
|
105
130
|
static ngx_int_t ngx_http_proxy_process_status_line(ngx_http_request_t *r);
|
106
131
|
static ngx_int_t ngx_http_proxy_process_header(ngx_http_request_t *r);
|
107
132
|
static ngx_int_t ngx_http_proxy_input_filter_init(void *data);
|
@@ -127,6 +152,8 @@ static ngx_int_t
|
|
127
152
|
static ngx_int_t
|
128
153
|
ngx_http_proxy_internal_body_length_variable(ngx_http_request_t *r,
|
129
154
|
ngx_http_variable_value_t *v, uintptr_t data);
|
155
|
+
static ngx_int_t ngx_http_proxy_internal_chunked_variable(ngx_http_request_t *r,
|
156
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
130
157
|
static ngx_int_t ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r,
|
131
158
|
ngx_table_elt_t *h, size_t prefix);
|
132
159
|
static ngx_int_t ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r,
|
@@ -137,11 +164,13 @@ static ngx_int_t ngx_http_proxy_rewrite(ngx_http_request_t *r,
|
|
137
164
|
ngx_table_elt_t *h, size_t prefix, size_t len, ngx_str_t *replacement);
|
138
165
|
|
139
166
|
static ngx_int_t ngx_http_proxy_add_variables(ngx_conf_t *cf);
|
167
|
+
static void *ngx_http_proxy_create_main_conf(ngx_conf_t *cf);
|
140
168
|
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
|
141
169
|
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
|
142
170
|
void *parent, void *child);
|
143
|
-
static ngx_int_t
|
144
|
-
ngx_http_proxy_loc_conf_t *conf,
|
171
|
+
static ngx_int_t ngx_http_proxy_init_headers(ngx_conf_t *cf,
|
172
|
+
ngx_http_proxy_loc_conf_t *conf, ngx_http_proxy_headers_t *headers,
|
173
|
+
ngx_keyval_t *default_headers);
|
145
174
|
|
146
175
|
static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd,
|
147
176
|
void *conf);
|
@@ -159,6 +188,10 @@ static char *ngx_http_proxy_cache(ngx_conf_t *cf, ngx_command_t *cmd,
|
|
159
188
|
static char *ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
|
160
189
|
void *conf);
|
161
190
|
#endif
|
191
|
+
#if (NGX_HTTP_SSL)
|
192
|
+
static char *ngx_http_proxy_ssl_password_file(ngx_conf_t *cf,
|
193
|
+
ngx_command_t *cmd, void *conf);
|
194
|
+
#endif
|
162
195
|
|
163
196
|
static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data);
|
164
197
|
|
@@ -267,6 +300,13 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
267
300
|
offsetof(ngx_http_proxy_loc_conf_t, upstream.buffering),
|
268
301
|
NULL },
|
269
302
|
|
303
|
+
{ ngx_string("proxy_request_buffering"),
|
304
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
305
|
+
ngx_conf_set_flag_slot,
|
306
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
307
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.request_buffering),
|
308
|
+
NULL },
|
309
|
+
|
270
310
|
{ ngx_string("proxy_ignore_client_abort"),
|
271
311
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
272
312
|
ngx_conf_set_flag_slot,
|
@@ -386,6 +426,20 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
386
426
|
offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size_conf),
|
387
427
|
NULL },
|
388
428
|
|
429
|
+
{ ngx_string("proxy_force_ranges"),
|
430
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
431
|
+
ngx_conf_set_flag_slot,
|
432
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
433
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.force_ranges),
|
434
|
+
NULL },
|
435
|
+
|
436
|
+
{ ngx_string("proxy_limit_rate"),
|
437
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
438
|
+
ngx_conf_set_size_slot,
|
439
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
440
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.limit_rate),
|
441
|
+
NULL },
|
442
|
+
|
389
443
|
#if (NGX_HTTP_CACHE)
|
390
444
|
|
391
445
|
{ ngx_string("proxy_cache"),
|
@@ -405,8 +459,8 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
405
459
|
{ ngx_string("proxy_cache_path"),
|
406
460
|
NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
|
407
461
|
ngx_http_file_cache_set_slot,
|
408
|
-
|
409
|
-
|
462
|
+
NGX_HTTP_MAIN_CONF_OFFSET,
|
463
|
+
offsetof(ngx_http_proxy_main_conf_t, caches),
|
410
464
|
&ngx_http_proxy_module },
|
411
465
|
|
412
466
|
{ ngx_string("proxy_cache_bypass"),
|
@@ -465,6 +519,13 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
465
519
|
offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_timeout),
|
466
520
|
NULL },
|
467
521
|
|
522
|
+
{ ngx_string("proxy_cache_lock_age"),
|
523
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
524
|
+
ngx_conf_set_msec_slot,
|
525
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
526
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_age),
|
527
|
+
NULL },
|
528
|
+
|
468
529
|
{ ngx_string("proxy_cache_revalidate"),
|
469
530
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
470
531
|
ngx_conf_set_flag_slot,
|
@@ -502,6 +563,20 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
502
563
|
offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream),
|
503
564
|
&ngx_http_proxy_next_upstream_masks },
|
504
565
|
|
566
|
+
{ ngx_string("proxy_next_upstream_tries"),
|
567
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
568
|
+
ngx_conf_set_num_slot,
|
569
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
570
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_tries),
|
571
|
+
NULL },
|
572
|
+
|
573
|
+
{ ngx_string("proxy_next_upstream_timeout"),
|
574
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
575
|
+
ngx_conf_set_msec_slot,
|
576
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
577
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream_timeout),
|
578
|
+
NULL },
|
579
|
+
|
505
580
|
{ ngx_string("proxy_pass_header"),
|
506
581
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
507
582
|
ngx_conf_set_str_array_slot,
|
@@ -553,6 +628,69 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
|
553
628
|
offsetof(ngx_http_proxy_loc_conf_t, ssl_ciphers),
|
554
629
|
NULL },
|
555
630
|
|
631
|
+
{ ngx_string("proxy_ssl_name"),
|
632
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
633
|
+
ngx_http_set_complex_value_slot,
|
634
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
635
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_name),
|
636
|
+
NULL },
|
637
|
+
|
638
|
+
{ ngx_string("proxy_ssl_server_name"),
|
639
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
640
|
+
ngx_conf_set_flag_slot,
|
641
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
642
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_server_name),
|
643
|
+
NULL },
|
644
|
+
|
645
|
+
{ ngx_string("proxy_ssl_verify"),
|
646
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
647
|
+
ngx_conf_set_flag_slot,
|
648
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
649
|
+
offsetof(ngx_http_proxy_loc_conf_t, upstream.ssl_verify),
|
650
|
+
NULL },
|
651
|
+
|
652
|
+
{ ngx_string("proxy_ssl_verify_depth"),
|
653
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
654
|
+
ngx_conf_set_num_slot,
|
655
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
656
|
+
offsetof(ngx_http_proxy_loc_conf_t, ssl_verify_depth),
|
657
|
+
NULL },
|
658
|
+
|
659
|
+
{ ngx_string("proxy_ssl_trusted_certificate"),
|
660
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
661
|
+
ngx_conf_set_str_slot,
|
662
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
663
|
+
offsetof(ngx_http_proxy_loc_conf_t, ssl_trusted_certificate),
|
664
|
+
NULL },
|
665
|
+
|
666
|
+
{ ngx_string("proxy_ssl_crl"),
|
667
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
668
|
+
ngx_conf_set_str_slot,
|
669
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
670
|
+
offsetof(ngx_http_proxy_loc_conf_t, ssl_crl),
|
671
|
+
NULL },
|
672
|
+
|
673
|
+
{ ngx_string("proxy_ssl_certificate"),
|
674
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
675
|
+
ngx_conf_set_str_slot,
|
676
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
677
|
+
offsetof(ngx_http_proxy_loc_conf_t, ssl_certificate),
|
678
|
+
NULL },
|
679
|
+
|
680
|
+
{ ngx_string("proxy_ssl_certificate_key"),
|
681
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
682
|
+
ngx_conf_set_str_slot,
|
683
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
684
|
+
offsetof(ngx_http_proxy_loc_conf_t, ssl_certificate_key),
|
685
|
+
NULL },
|
686
|
+
|
687
|
+
{ ngx_string("proxy_ssl_password_file"),
|
688
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
689
|
+
ngx_http_proxy_ssl_password_file,
|
690
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
691
|
+
0,
|
692
|
+
NULL },
|
693
|
+
|
556
694
|
#endif
|
557
695
|
|
558
696
|
ngx_null_command
|
@@ -563,7 +701,7 @@ static ngx_http_module_t ngx_http_proxy_module_ctx = {
|
|
563
701
|
ngx_http_proxy_add_variables, /* preconfiguration */
|
564
702
|
NULL, /* postconfiguration */
|
565
703
|
|
566
|
-
|
704
|
+
ngx_http_proxy_create_main_conf, /* create main configuration */
|
567
705
|
NULL, /* init main configuration */
|
568
706
|
|
569
707
|
NULL, /* create server configuration */
|
@@ -598,7 +736,8 @@ static ngx_keyval_t ngx_http_proxy_headers[] = {
|
|
598
736
|
{ ngx_string("Host"), ngx_string("$proxy_host") },
|
599
737
|
{ ngx_string("Connection"), ngx_string("close") },
|
600
738
|
{ ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") },
|
601
|
-
{ ngx_string("Transfer-Encoding"), ngx_string("") },
|
739
|
+
{ ngx_string("Transfer-Encoding"), ngx_string("$proxy_internal_chunked") },
|
740
|
+
{ ngx_string("TE"), ngx_string("") },
|
602
741
|
{ ngx_string("Keep-Alive"), ngx_string("") },
|
603
742
|
{ ngx_string("Expect"), ngx_string("") },
|
604
743
|
{ ngx_string("Upgrade"), ngx_string("") },
|
@@ -625,14 +764,15 @@ static ngx_keyval_t ngx_http_proxy_cache_headers[] = {
|
|
625
764
|
{ ngx_string("Host"), ngx_string("$proxy_host") },
|
626
765
|
{ ngx_string("Connection"), ngx_string("close") },
|
627
766
|
{ ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") },
|
628
|
-
{ ngx_string("Transfer-Encoding"), ngx_string("") },
|
767
|
+
{ ngx_string("Transfer-Encoding"), ngx_string("$proxy_internal_chunked") },
|
768
|
+
{ ngx_string("TE"), ngx_string("") },
|
629
769
|
{ ngx_string("Keep-Alive"), ngx_string("") },
|
630
770
|
{ ngx_string("Expect"), ngx_string("") },
|
631
771
|
{ ngx_string("Upgrade"), ngx_string("") },
|
632
772
|
{ ngx_string("If-Modified-Since"),
|
633
773
|
ngx_string("$upstream_cache_last_modified") },
|
634
774
|
{ ngx_string("If-Unmodified-Since"), ngx_string("") },
|
635
|
-
{ ngx_string("If-None-Match"), ngx_string("") },
|
775
|
+
{ ngx_string("If-None-Match"), ngx_string("$upstream_cache_etag") },
|
636
776
|
{ ngx_string("If-Match"), ngx_string("") },
|
637
777
|
{ ngx_string("Range"), ngx_string("") },
|
638
778
|
{ ngx_string("If-Range"), ngx_string("") },
|
@@ -661,6 +801,10 @@ static ngx_http_variable_t ngx_http_proxy_vars[] = {
|
|
661
801
|
ngx_http_proxy_internal_body_length_variable, 0,
|
662
802
|
NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 },
|
663
803
|
|
804
|
+
{ ngx_string("proxy_internal_chunked"), NULL,
|
805
|
+
ngx_http_proxy_internal_chunked_variable, 0,
|
806
|
+
NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 },
|
807
|
+
|
664
808
|
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
|
665
809
|
};
|
666
810
|
|
@@ -673,10 +817,13 @@ static ngx_path_init_t ngx_http_proxy_temp_path = {
|
|
673
817
|
static ngx_int_t
|
674
818
|
ngx_http_proxy_handler(ngx_http_request_t *r)
|
675
819
|
{
|
676
|
-
ngx_int_t
|
677
|
-
ngx_http_upstream_t
|
678
|
-
ngx_http_proxy_ctx_t
|
679
|
-
ngx_http_proxy_loc_conf_t
|
820
|
+
ngx_int_t rc;
|
821
|
+
ngx_http_upstream_t *u;
|
822
|
+
ngx_http_proxy_ctx_t *ctx;
|
823
|
+
ngx_http_proxy_loc_conf_t *plcf;
|
824
|
+
#if (NGX_HTTP_CACHE)
|
825
|
+
ngx_http_proxy_main_conf_t *pmcf;
|
826
|
+
#endif
|
680
827
|
|
681
828
|
if (ngx_http_upstream_create(r) != NGX_OK) {
|
682
829
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
@@ -684,7 +831,7 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
|
|
684
831
|
|
685
832
|
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t));
|
686
833
|
if (ctx == NULL) {
|
687
|
-
return
|
834
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
688
835
|
}
|
689
836
|
|
690
837
|
ngx_http_set_ctx(r, ctx, ngx_http_proxy_module);
|
@@ -711,8 +858,12 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
|
|
711
858
|
u->conf = &plcf->upstream;
|
712
859
|
|
713
860
|
#if (NGX_HTTP_CACHE)
|
861
|
+
pmcf = ngx_http_get_module_main_conf(r, ngx_http_proxy_module);
|
862
|
+
|
863
|
+
u->caches = &pmcf->caches;
|
714
864
|
u->create_key = ngx_http_proxy_create_key;
|
715
865
|
#endif
|
866
|
+
|
716
867
|
u->create_request = ngx_http_proxy_create_request;
|
717
868
|
u->reinit_request = ngx_http_proxy_reinit_request;
|
718
869
|
u->process_header = ngx_http_proxy_process_status_line;
|
@@ -744,6 +895,14 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
|
|
744
895
|
|
745
896
|
u->accel = 1;
|
746
897
|
|
898
|
+
if (!plcf->upstream.request_buffering
|
899
|
+
&& plcf->body_values == NULL && plcf->upstream.pass_request_body
|
900
|
+
&& (!r->headers_in.chunked
|
901
|
+
|| plcf->http_version == NGX_HTTP_VERSION_11))
|
902
|
+
{
|
903
|
+
r->request_body_no_buffering = 1;
|
904
|
+
}
|
905
|
+
|
747
906
|
rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
|
748
907
|
|
749
908
|
if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
|
@@ -972,6 +1131,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
972
1131
|
ngx_http_upstream_t *u;
|
973
1132
|
ngx_http_proxy_ctx_t *ctx;
|
974
1133
|
ngx_http_script_code_pt code;
|
1134
|
+
ngx_http_proxy_headers_t *headers;
|
975
1135
|
ngx_http_script_engine_t e, le;
|
976
1136
|
ngx_http_proxy_loc_conf_t *plcf;
|
977
1137
|
ngx_http_script_len_code_pt lcode;
|
@@ -980,6 +1140,12 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
980
1140
|
|
981
1141
|
plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
|
982
1142
|
|
1143
|
+
#if (NGX_HTTP_CACHE)
|
1144
|
+
headers = u->cacheable ? &plcf->headers_cache : &plcf->headers;
|
1145
|
+
#else
|
1146
|
+
headers = &plcf->headers;
|
1147
|
+
#endif
|
1148
|
+
|
983
1149
|
if (u->method.len) {
|
984
1150
|
/* HEAD was changed to GET to cache response */
|
985
1151
|
method = u->method;
|
@@ -1038,10 +1204,11 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1038
1204
|
|
1039
1205
|
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
|
1040
1206
|
|
1041
|
-
ngx_http_script_flush_no_cacheable_variables(r, plcf->
|
1207
|
+
ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes);
|
1208
|
+
ngx_http_script_flush_no_cacheable_variables(r, headers->flushes);
|
1042
1209
|
|
1043
|
-
if (plcf->
|
1044
|
-
le.ip = plcf->
|
1210
|
+
if (plcf->body_lengths) {
|
1211
|
+
le.ip = plcf->body_lengths->elts;
|
1045
1212
|
le.request = r;
|
1046
1213
|
le.flushed = 1;
|
1047
1214
|
body_len = 0;
|
@@ -1054,11 +1221,15 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1054
1221
|
ctx->internal_body_length = body_len;
|
1055
1222
|
len += body_len;
|
1056
1223
|
|
1224
|
+
} else if (r->headers_in.chunked && r->reading_body) {
|
1225
|
+
ctx->internal_body_length = -1;
|
1226
|
+
ctx->internal_chunked = 1;
|
1227
|
+
|
1057
1228
|
} else {
|
1058
1229
|
ctx->internal_body_length = r->headers_in.content_length_n;
|
1059
1230
|
}
|
1060
1231
|
|
1061
|
-
le.ip =
|
1232
|
+
le.ip = headers->lengths->elts;
|
1062
1233
|
le.request = r;
|
1063
1234
|
le.flushed = 1;
|
1064
1235
|
|
@@ -1087,7 +1258,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1087
1258
|
i = 0;
|
1088
1259
|
}
|
1089
1260
|
|
1090
|
-
if (ngx_hash_find(&
|
1261
|
+
if (ngx_hash_find(&headers->hash, header[i].hash,
|
1091
1262
|
header[i].lowcase_key, header[i].key.len))
|
1092
1263
|
{
|
1093
1264
|
continue;
|
@@ -1158,12 +1329,12 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1158
1329
|
|
1159
1330
|
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
|
1160
1331
|
|
1161
|
-
e.ip =
|
1332
|
+
e.ip = headers->values->elts;
|
1162
1333
|
e.pos = b->last;
|
1163
1334
|
e.request = r;
|
1164
1335
|
e.flushed = 1;
|
1165
1336
|
|
1166
|
-
le.ip =
|
1337
|
+
le.ip = headers->lengths->elts;
|
1167
1338
|
|
1168
1339
|
while (*(uintptr_t *) le.ip) {
|
1169
1340
|
lcode = *(ngx_http_script_len_code_pt *) le.ip;
|
@@ -1211,7 +1382,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1211
1382
|
i = 0;
|
1212
1383
|
}
|
1213
1384
|
|
1214
|
-
if (ngx_hash_find(&
|
1385
|
+
if (ngx_hash_find(&headers->hash, header[i].hash,
|
1215
1386
|
header[i].lowcase_key, header[i].key.len))
|
1216
1387
|
{
|
1217
1388
|
continue;
|
@@ -1236,9 +1407,10 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1236
1407
|
/* add "\r\n" at the header end */
|
1237
1408
|
*b->last++ = CR; *b->last++ = LF;
|
1238
1409
|
|
1239
|
-
if (plcf->
|
1240
|
-
e.ip = plcf->
|
1410
|
+
if (plcf->body_values) {
|
1411
|
+
e.ip = plcf->body_values->elts;
|
1241
1412
|
e.pos = b->last;
|
1413
|
+
e.skip = 0;
|
1242
1414
|
|
1243
1415
|
while (*(uintptr_t *) e.ip) {
|
1244
1416
|
code = *(ngx_http_script_code_pt *) e.ip;
|
@@ -1249,10 +1421,19 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
|
1249
1421
|
}
|
1250
1422
|
|
1251
1423
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1252
|
-
"http proxy header
|
1424
|
+
"http proxy header:%N\"%*s\"",
|
1253
1425
|
(size_t) (b->last - b->pos), b->pos);
|
1254
1426
|
|
1255
|
-
if (
|
1427
|
+
if (r->request_body_no_buffering) {
|
1428
|
+
|
1429
|
+
u->request_bufs = cl;
|
1430
|
+
|
1431
|
+
if (ctx->internal_chunked) {
|
1432
|
+
u->output.output_filter = ngx_http_proxy_body_output_filter;
|
1433
|
+
u->output.filter_ctx = r;
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
} else if (plcf->body_values == NULL && plcf->upstream.pass_request_body) {
|
1256
1437
|
|
1257
1438
|
body = u->request_bufs;
|
1258
1439
|
u->request_bufs = cl;
|
@@ -1313,6 +1494,173 @@ ngx_http_proxy_reinit_request(ngx_http_request_t *r)
|
|
1313
1494
|
}
|
1314
1495
|
|
1315
1496
|
|
1497
|
+
static ngx_int_t
|
1498
|
+
ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in)
|
1499
|
+
{
|
1500
|
+
ngx_http_request_t *r = data;
|
1501
|
+
|
1502
|
+
off_t size;
|
1503
|
+
u_char *chunk;
|
1504
|
+
ngx_int_t rc;
|
1505
|
+
ngx_buf_t *b;
|
1506
|
+
ngx_chain_t *out, *cl, *tl, **ll, **fl;
|
1507
|
+
ngx_http_proxy_ctx_t *ctx;
|
1508
|
+
|
1509
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1510
|
+
"proxy output filter");
|
1511
|
+
|
1512
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
|
1513
|
+
|
1514
|
+
if (in == NULL) {
|
1515
|
+
out = in;
|
1516
|
+
goto out;
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
out = NULL;
|
1520
|
+
ll = &out;
|
1521
|
+
|
1522
|
+
if (!ctx->header_sent) {
|
1523
|
+
/* first buffer contains headers, pass it unmodified */
|
1524
|
+
|
1525
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1526
|
+
"proxy output header");
|
1527
|
+
|
1528
|
+
ctx->header_sent = 1;
|
1529
|
+
|
1530
|
+
tl = ngx_alloc_chain_link(r->pool);
|
1531
|
+
if (tl == NULL) {
|
1532
|
+
return NGX_ERROR;
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
tl->buf = in->buf;
|
1536
|
+
*ll = tl;
|
1537
|
+
ll = &tl->next;
|
1538
|
+
|
1539
|
+
in = in->next;
|
1540
|
+
|
1541
|
+
if (in == NULL) {
|
1542
|
+
tl->next = NULL;
|
1543
|
+
goto out;
|
1544
|
+
}
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
size = 0;
|
1548
|
+
cl = in;
|
1549
|
+
fl = ll;
|
1550
|
+
|
1551
|
+
for ( ;; ) {
|
1552
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1553
|
+
"proxy output chunk: %d", ngx_buf_size(cl->buf));
|
1554
|
+
|
1555
|
+
size += ngx_buf_size(cl->buf);
|
1556
|
+
|
1557
|
+
if (cl->buf->flush
|
1558
|
+
|| cl->buf->sync
|
1559
|
+
|| ngx_buf_in_memory(cl->buf)
|
1560
|
+
|| cl->buf->in_file)
|
1561
|
+
{
|
1562
|
+
tl = ngx_alloc_chain_link(r->pool);
|
1563
|
+
if (tl == NULL) {
|
1564
|
+
return NGX_ERROR;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
tl->buf = cl->buf;
|
1568
|
+
*ll = tl;
|
1569
|
+
ll = &tl->next;
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
if (cl->next == NULL) {
|
1573
|
+
break;
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
cl = cl->next;
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
if (size) {
|
1580
|
+
tl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
1581
|
+
if (tl == NULL) {
|
1582
|
+
return NGX_ERROR;
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
b = tl->buf;
|
1586
|
+
chunk = b->start;
|
1587
|
+
|
1588
|
+
if (chunk == NULL) {
|
1589
|
+
/* the "0000000000000000" is 64-bit hexadecimal string */
|
1590
|
+
|
1591
|
+
chunk = ngx_palloc(r->pool, sizeof("0000000000000000" CRLF) - 1);
|
1592
|
+
if (chunk == NULL) {
|
1593
|
+
return NGX_ERROR;
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
b->start = chunk;
|
1597
|
+
b->end = chunk + sizeof("0000000000000000" CRLF) - 1;
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter;
|
1601
|
+
b->memory = 0;
|
1602
|
+
b->temporary = 1;
|
1603
|
+
b->pos = chunk;
|
1604
|
+
b->last = ngx_sprintf(chunk, "%xO" CRLF, size);
|
1605
|
+
|
1606
|
+
tl->next = *fl;
|
1607
|
+
*fl = tl;
|
1608
|
+
}
|
1609
|
+
|
1610
|
+
if (cl->buf->last_buf) {
|
1611
|
+
tl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
1612
|
+
if (tl == NULL) {
|
1613
|
+
return NGX_ERROR;
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
b = tl->buf;
|
1617
|
+
|
1618
|
+
b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter;
|
1619
|
+
b->temporary = 0;
|
1620
|
+
b->memory = 1;
|
1621
|
+
b->last_buf = 1;
|
1622
|
+
b->pos = (u_char *) CRLF "0" CRLF CRLF;
|
1623
|
+
b->last = b->pos + 7;
|
1624
|
+
|
1625
|
+
cl->buf->last_buf = 0;
|
1626
|
+
|
1627
|
+
*ll = tl;
|
1628
|
+
|
1629
|
+
if (size == 0) {
|
1630
|
+
b->pos += 2;
|
1631
|
+
}
|
1632
|
+
|
1633
|
+
} else if (size > 0) {
|
1634
|
+
tl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
1635
|
+
if (tl == NULL) {
|
1636
|
+
return NGX_ERROR;
|
1637
|
+
}
|
1638
|
+
|
1639
|
+
b = tl->buf;
|
1640
|
+
|
1641
|
+
b->tag = (ngx_buf_tag_t) &ngx_http_proxy_body_output_filter;
|
1642
|
+
b->temporary = 0;
|
1643
|
+
b->memory = 1;
|
1644
|
+
b->pos = (u_char *) CRLF;
|
1645
|
+
b->last = b->pos + 2;
|
1646
|
+
|
1647
|
+
*ll = tl;
|
1648
|
+
|
1649
|
+
} else {
|
1650
|
+
*ll = NULL;
|
1651
|
+
}
|
1652
|
+
|
1653
|
+
out:
|
1654
|
+
|
1655
|
+
rc = ngx_chain_writer(&r->upstream->writer, out);
|
1656
|
+
|
1657
|
+
ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &out,
|
1658
|
+
(ngx_buf_tag_t) &ngx_http_proxy_body_output_filter);
|
1659
|
+
|
1660
|
+
return rc;
|
1661
|
+
}
|
1662
|
+
|
1663
|
+
|
1316
1664
|
static ngx_int_t
|
1317
1665
|
ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
1318
1666
|
{
|
@@ -2106,6 +2454,30 @@ ngx_http_proxy_internal_body_length_variable(ngx_http_request_t *r,
|
|
2106
2454
|
}
|
2107
2455
|
|
2108
2456
|
|
2457
|
+
static ngx_int_t
|
2458
|
+
ngx_http_proxy_internal_chunked_variable(ngx_http_request_t *r,
|
2459
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
2460
|
+
{
|
2461
|
+
ngx_http_proxy_ctx_t *ctx;
|
2462
|
+
|
2463
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
|
2464
|
+
|
2465
|
+
if (ctx == NULL || !ctx->internal_chunked) {
|
2466
|
+
v->not_found = 1;
|
2467
|
+
return NGX_OK;
|
2468
|
+
}
|
2469
|
+
|
2470
|
+
v->valid = 1;
|
2471
|
+
v->no_cacheable = 0;
|
2472
|
+
v->not_found = 0;
|
2473
|
+
|
2474
|
+
v->data = (u_char *) "chunked";
|
2475
|
+
v->len = sizeof("chunked") - 1;
|
2476
|
+
|
2477
|
+
return NGX_OK;
|
2478
|
+
}
|
2479
|
+
|
2480
|
+
|
2109
2481
|
static ngx_int_t
|
2110
2482
|
ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r, ngx_table_elt_t *h,
|
2111
2483
|
size_t prefix)
|
@@ -2320,7 +2692,7 @@ ngx_http_proxy_rewrite(ngx_http_request_t *r, ngx_table_elt_t *h, size_t prefix,
|
|
2320
2692
|
|
2321
2693
|
if (replacement->len > len) {
|
2322
2694
|
|
2323
|
-
data = ngx_pnalloc(r->pool, new_len);
|
2695
|
+
data = ngx_pnalloc(r->pool, new_len + 1);
|
2324
2696
|
if (data == NULL) {
|
2325
2697
|
return NGX_ERROR;
|
2326
2698
|
}
|
@@ -2329,7 +2701,7 @@ ngx_http_proxy_rewrite(ngx_http_request_t *r, ngx_table_elt_t *h, size_t prefix,
|
|
2329
2701
|
p = ngx_copy(p, replacement->data, replacement->len);
|
2330
2702
|
|
2331
2703
|
ngx_memcpy(p, h->value.data + prefix + len,
|
2332
|
-
h->value.len - len - prefix);
|
2704
|
+
h->value.len - len - prefix + 1);
|
2333
2705
|
|
2334
2706
|
h->value.data = data;
|
2335
2707
|
|
@@ -2338,7 +2710,7 @@ ngx_http_proxy_rewrite(ngx_http_request_t *r, ngx_table_elt_t *h, size_t prefix,
|
|
2338
2710
|
replacement->len);
|
2339
2711
|
|
2340
2712
|
ngx_memmove(p, h->value.data + prefix + len,
|
2341
|
-
h->value.len - len - prefix);
|
2713
|
+
h->value.len - len - prefix + 1);
|
2342
2714
|
}
|
2343
2715
|
|
2344
2716
|
h->value.len = new_len;
|
@@ -2366,6 +2738,29 @@ ngx_http_proxy_add_variables(ngx_conf_t *cf)
|
|
2366
2738
|
}
|
2367
2739
|
|
2368
2740
|
|
2741
|
+
static void *
|
2742
|
+
ngx_http_proxy_create_main_conf(ngx_conf_t *cf)
|
2743
|
+
{
|
2744
|
+
ngx_http_proxy_main_conf_t *conf;
|
2745
|
+
|
2746
|
+
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_main_conf_t));
|
2747
|
+
if (conf == NULL) {
|
2748
|
+
return NULL;
|
2749
|
+
}
|
2750
|
+
|
2751
|
+
#if (NGX_HTTP_CACHE)
|
2752
|
+
if (ngx_array_init(&conf->caches, cf->pool, 4,
|
2753
|
+
sizeof(ngx_http_file_cache_t *))
|
2754
|
+
!= NGX_OK)
|
2755
|
+
{
|
2756
|
+
return NULL;
|
2757
|
+
}
|
2758
|
+
#endif
|
2759
|
+
|
2760
|
+
return conf;
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
|
2369
2764
|
static void *
|
2370
2765
|
ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
2371
2766
|
{
|
@@ -2382,6 +2777,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|
2382
2777
|
* conf->upstream.bufs.num = 0;
|
2383
2778
|
* conf->upstream.ignore_headers = 0;
|
2384
2779
|
* conf->upstream.next_upstream = 0;
|
2780
|
+
* conf->upstream.cache_zone = NULL;
|
2385
2781
|
* conf->upstream.cache_use_stale = 0;
|
2386
2782
|
* conf->upstream.cache_methods = 0;
|
2387
2783
|
* conf->upstream.temp_path = NULL;
|
@@ -2390,34 +2786,47 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|
2390
2786
|
* conf->upstream.location = NULL;
|
2391
2787
|
* conf->upstream.store_lengths = NULL;
|
2392
2788
|
* conf->upstream.store_values = NULL;
|
2789
|
+
* conf->upstream.ssl_name = NULL;
|
2393
2790
|
*
|
2394
2791
|
* conf->method = { 0, NULL };
|
2395
2792
|
* conf->headers_source = NULL;
|
2396
|
-
* conf->
|
2397
|
-
* conf->
|
2398
|
-
* conf->
|
2399
|
-
* conf->
|
2400
|
-
* conf->
|
2793
|
+
* conf->headers.lengths = NULL;
|
2794
|
+
* conf->headers.values = NULL;
|
2795
|
+
* conf->headers.hash = { NULL, 0 };
|
2796
|
+
* conf->headers_cache.lengths = NULL;
|
2797
|
+
* conf->headers_cache.values = NULL;
|
2798
|
+
* conf->headers_cache.hash = { NULL, 0 };
|
2799
|
+
* conf->body_lengths = NULL;
|
2800
|
+
* conf->body_values = NULL;
|
2401
2801
|
* conf->body_source = { 0, NULL };
|
2402
2802
|
* conf->redirects = NULL;
|
2403
2803
|
* conf->ssl = 0;
|
2404
2804
|
* conf->ssl_protocols = 0;
|
2405
2805
|
* conf->ssl_ciphers = { 0, NULL };
|
2806
|
+
* conf->ssl_trusted_certificate = { 0, NULL };
|
2807
|
+
* conf->ssl_crl = { 0, NULL };
|
2808
|
+
* conf->ssl_certificate = { 0, NULL };
|
2809
|
+
* conf->ssl_certificate_key = { 0, NULL };
|
2406
2810
|
*/
|
2407
2811
|
|
2408
2812
|
conf->upstream.store = NGX_CONF_UNSET;
|
2409
2813
|
conf->upstream.store_access = NGX_CONF_UNSET_UINT;
|
2814
|
+
conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
|
2410
2815
|
conf->upstream.buffering = NGX_CONF_UNSET;
|
2816
|
+
conf->upstream.request_buffering = NGX_CONF_UNSET;
|
2411
2817
|
conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
|
2818
|
+
conf->upstream.force_ranges = NGX_CONF_UNSET;
|
2412
2819
|
|
2413
2820
|
conf->upstream.local = NGX_CONF_UNSET_PTR;
|
2414
2821
|
|
2415
2822
|
conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
|
2416
2823
|
conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
|
2417
2824
|
conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
|
2825
|
+
conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
|
2418
2826
|
|
2419
2827
|
conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
|
2420
2828
|
conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
|
2829
|
+
conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE;
|
2421
2830
|
|
2422
2831
|
conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
|
2423
2832
|
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
|
@@ -2427,13 +2836,14 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|
2427
2836
|
conf->upstream.pass_request_body = NGX_CONF_UNSET;
|
2428
2837
|
|
2429
2838
|
#if (NGX_HTTP_CACHE)
|
2430
|
-
conf->upstream.cache =
|
2839
|
+
conf->upstream.cache = NGX_CONF_UNSET;
|
2431
2840
|
conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
|
2432
2841
|
conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
|
2433
2842
|
conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
|
2434
2843
|
conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
|
2435
2844
|
conf->upstream.cache_lock = NGX_CONF_UNSET;
|
2436
2845
|
conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
|
2846
|
+
conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
|
2437
2847
|
conf->upstream.cache_revalidate = NGX_CONF_UNSET;
|
2438
2848
|
#endif
|
2439
2849
|
|
@@ -2441,8 +2851,13 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|
2441
2851
|
conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
|
2442
2852
|
|
2443
2853
|
conf->upstream.intercept_errors = NGX_CONF_UNSET;
|
2854
|
+
|
2444
2855
|
#if (NGX_HTTP_SSL)
|
2445
2856
|
conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
|
2857
|
+
conf->upstream.ssl_server_name = NGX_CONF_UNSET;
|
2858
|
+
conf->upstream.ssl_verify = NGX_CONF_UNSET;
|
2859
|
+
conf->ssl_verify_depth = NGX_CONF_UNSET_UINT;
|
2860
|
+
conf->ssl_passwords = NGX_CONF_UNSET_PTR;
|
2446
2861
|
#endif
|
2447
2862
|
|
2448
2863
|
/* "proxy_cyclic_temp_file" is disabled */
|
@@ -2473,30 +2888,50 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2473
2888
|
|
2474
2889
|
u_char *p;
|
2475
2890
|
size_t size;
|
2891
|
+
ngx_int_t rc;
|
2476
2892
|
ngx_hash_init_t hash;
|
2477
2893
|
ngx_http_core_loc_conf_t *clcf;
|
2478
2894
|
ngx_http_proxy_rewrite_t *pr;
|
2479
2895
|
ngx_http_script_compile_t sc;
|
2480
2896
|
|
2481
|
-
|
2897
|
+
#if (NGX_HTTP_CACHE)
|
2898
|
+
|
2899
|
+
if (conf->upstream.store > 0) {
|
2900
|
+
conf->upstream.cache = 0;
|
2901
|
+
}
|
2902
|
+
|
2903
|
+
if (conf->upstream.cache > 0) {
|
2904
|
+
conf->upstream.store = 0;
|
2905
|
+
}
|
2906
|
+
|
2907
|
+
#endif
|
2908
|
+
|
2909
|
+
if (conf->upstream.store == NGX_CONF_UNSET) {
|
2482
2910
|
ngx_conf_merge_value(conf->upstream.store,
|
2483
2911
|
prev->upstream.store, 0);
|
2484
2912
|
|
2485
|
-
|
2486
|
-
|
2487
|
-
conf->upstream.store_values = prev->upstream.store_values;
|
2488
|
-
}
|
2913
|
+
conf->upstream.store_lengths = prev->upstream.store_lengths;
|
2914
|
+
conf->upstream.store_values = prev->upstream.store_values;
|
2489
2915
|
}
|
2490
2916
|
|
2491
2917
|
ngx_conf_merge_uint_value(conf->upstream.store_access,
|
2492
2918
|
prev->upstream.store_access, 0600);
|
2493
2919
|
|
2920
|
+
ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
|
2921
|
+
prev->upstream.next_upstream_tries, 0);
|
2922
|
+
|
2494
2923
|
ngx_conf_merge_value(conf->upstream.buffering,
|
2495
2924
|
prev->upstream.buffering, 1);
|
2496
2925
|
|
2926
|
+
ngx_conf_merge_value(conf->upstream.request_buffering,
|
2927
|
+
prev->upstream.request_buffering, 1);
|
2928
|
+
|
2497
2929
|
ngx_conf_merge_value(conf->upstream.ignore_client_abort,
|
2498
2930
|
prev->upstream.ignore_client_abort, 0);
|
2499
2931
|
|
2932
|
+
ngx_conf_merge_value(conf->upstream.force_ranges,
|
2933
|
+
prev->upstream.force_ranges, 0);
|
2934
|
+
|
2500
2935
|
ngx_conf_merge_ptr_value(conf->upstream.local,
|
2501
2936
|
prev->upstream.local, NULL);
|
2502
2937
|
|
@@ -2509,6 +2944,9 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2509
2944
|
ngx_conf_merge_msec_value(conf->upstream.read_timeout,
|
2510
2945
|
prev->upstream.read_timeout, 60000);
|
2511
2946
|
|
2947
|
+
ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
|
2948
|
+
prev->upstream.next_upstream_timeout, 0);
|
2949
|
+
|
2512
2950
|
ngx_conf_merge_size_value(conf->upstream.send_lowat,
|
2513
2951
|
prev->upstream.send_lowat, 0);
|
2514
2952
|
|
@@ -2516,6 +2954,9 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2516
2954
|
prev->upstream.buffer_size,
|
2517
2955
|
(size_t) ngx_pagesize);
|
2518
2956
|
|
2957
|
+
ngx_conf_merge_size_value(conf->upstream.limit_rate,
|
2958
|
+
prev->upstream.limit_rate, 0);
|
2959
|
+
|
2519
2960
|
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
|
2520
2961
|
8, ngx_pagesize);
|
2521
2962
|
|
@@ -2634,13 +3075,18 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2634
3075
|
|
2635
3076
|
#if (NGX_HTTP_CACHE)
|
2636
3077
|
|
2637
|
-
|
2638
|
-
|
3078
|
+
if (conf->upstream.cache == NGX_CONF_UNSET) {
|
3079
|
+
ngx_conf_merge_value(conf->upstream.cache,
|
3080
|
+
prev->upstream.cache, 0);
|
3081
|
+
|
3082
|
+
conf->upstream.cache_zone = prev->upstream.cache_zone;
|
3083
|
+
conf->upstream.cache_value = prev->upstream.cache_value;
|
3084
|
+
}
|
2639
3085
|
|
2640
|
-
if (conf->upstream.
|
3086
|
+
if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
|
2641
3087
|
ngx_shm_zone_t *shm_zone;
|
2642
3088
|
|
2643
|
-
shm_zone = conf->upstream.
|
3089
|
+
shm_zone = conf->upstream.cache_zone;
|
2644
3090
|
|
2645
3091
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
2646
3092
|
"\"proxy_cache\" zone \"%V\" is unknown",
|
@@ -2691,6 +3137,9 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2691
3137
|
ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
|
2692
3138
|
prev->upstream.cache_lock_timeout, 5000);
|
2693
3139
|
|
3140
|
+
ngx_conf_merge_msec_value(conf->upstream.cache_lock_age,
|
3141
|
+
prev->upstream.cache_lock_age, 5000);
|
3142
|
+
|
2694
3143
|
ngx_conf_merge_value(conf->upstream.cache_revalidate,
|
2695
3144
|
prev->upstream.cache_revalidate, 0);
|
2696
3145
|
|
@@ -2714,6 +3163,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2714
3163
|
prev->upstream.intercept_errors, 0);
|
2715
3164
|
|
2716
3165
|
#if (NGX_HTTP_SSL)
|
3166
|
+
|
2717
3167
|
ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
|
2718
3168
|
prev->upstream.ssl_session_reuse, 1);
|
2719
3169
|
|
@@ -2725,9 +3175,30 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2725
3175
|
ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
|
2726
3176
|
"DEFAULT");
|
2727
3177
|
|
3178
|
+
if (conf->upstream.ssl_name == NULL) {
|
3179
|
+
conf->upstream.ssl_name = prev->upstream.ssl_name;
|
3180
|
+
}
|
3181
|
+
|
3182
|
+
ngx_conf_merge_value(conf->upstream.ssl_server_name,
|
3183
|
+
prev->upstream.ssl_server_name, 0);
|
3184
|
+
ngx_conf_merge_value(conf->upstream.ssl_verify,
|
3185
|
+
prev->upstream.ssl_verify, 0);
|
3186
|
+
ngx_conf_merge_uint_value(conf->ssl_verify_depth,
|
3187
|
+
prev->ssl_verify_depth, 1);
|
3188
|
+
ngx_conf_merge_str_value(conf->ssl_trusted_certificate,
|
3189
|
+
prev->ssl_trusted_certificate, "");
|
3190
|
+
ngx_conf_merge_str_value(conf->ssl_crl, prev->ssl_crl, "");
|
3191
|
+
|
3192
|
+
ngx_conf_merge_str_value(conf->ssl_certificate,
|
3193
|
+
prev->ssl_certificate, "");
|
3194
|
+
ngx_conf_merge_str_value(conf->ssl_certificate_key,
|
3195
|
+
prev->ssl_certificate_key, "");
|
3196
|
+
ngx_conf_merge_ptr_value(conf->ssl_passwords, prev->ssl_passwords, NULL);
|
3197
|
+
|
2728
3198
|
if (conf->ssl && ngx_http_proxy_set_ssl(cf, conf) != NGX_OK) {
|
2729
3199
|
return NGX_CONF_ERROR;
|
2730
3200
|
}
|
3201
|
+
|
2731
3202
|
#endif
|
2732
3203
|
|
2733
3204
|
ngx_conf_merge_value(conf->redirect, prev->redirect, 1);
|
@@ -2785,12 +3256,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2785
3256
|
|
2786
3257
|
ngx_conf_merge_ptr_value(conf->cookie_paths, prev->cookie_paths, NULL);
|
2787
3258
|
|
2788
|
-
#if (NGX_HTTP_SSL)
|
2789
|
-
if (conf->upstream.ssl == NULL) {
|
2790
|
-
conf->upstream.ssl = prev->upstream.ssl;
|
2791
|
-
}
|
2792
|
-
#endif
|
2793
|
-
|
2794
3259
|
ngx_conf_merge_uint_value(conf->http_version, prev->http_version,
|
2795
3260
|
NGX_HTTP_VERSION_10);
|
2796
3261
|
|
@@ -2814,39 +3279,45 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2814
3279
|
return NGX_CONF_ERROR;
|
2815
3280
|
}
|
2816
3281
|
|
2817
|
-
|
3282
|
+
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
|
3283
|
+
|
3284
|
+
if (clcf->noname
|
3285
|
+
&& conf->upstream.upstream == NULL && conf->proxy_lengths == NULL)
|
3286
|
+
{
|
2818
3287
|
conf->upstream.upstream = prev->upstream.upstream;
|
3288
|
+
conf->location = prev->location;
|
2819
3289
|
conf->vars = prev->vars;
|
2820
|
-
}
|
2821
3290
|
|
2822
|
-
if (conf->proxy_lengths == NULL) {
|
2823
3291
|
conf->proxy_lengths = prev->proxy_lengths;
|
2824
3292
|
conf->proxy_values = prev->proxy_values;
|
3293
|
+
|
3294
|
+
#if (NGX_HTTP_SSL)
|
3295
|
+
conf->upstream.ssl = prev->upstream.ssl;
|
3296
|
+
#endif
|
2825
3297
|
}
|
2826
3298
|
|
2827
|
-
if (
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
conf->location = prev->location;
|
2832
|
-
}
|
3299
|
+
if (clcf->lmt_excpt && clcf->handler == NULL
|
3300
|
+
&& (conf->upstream.upstream || conf->proxy_lengths))
|
3301
|
+
{
|
3302
|
+
clcf->handler = ngx_http_proxy_handler;
|
2833
3303
|
}
|
2834
3304
|
|
2835
3305
|
if (conf->body_source.data == NULL) {
|
3306
|
+
conf->body_flushes = prev->body_flushes;
|
2836
3307
|
conf->body_source = prev->body_source;
|
2837
|
-
conf->
|
2838
|
-
conf->
|
3308
|
+
conf->body_lengths = prev->body_lengths;
|
3309
|
+
conf->body_values = prev->body_values;
|
2839
3310
|
}
|
2840
3311
|
|
2841
|
-
if (conf->body_source.data && conf->
|
3312
|
+
if (conf->body_source.data && conf->body_lengths == NULL) {
|
2842
3313
|
|
2843
3314
|
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
|
2844
3315
|
|
2845
3316
|
sc.cf = cf;
|
2846
3317
|
sc.source = &conf->body_source;
|
2847
|
-
sc.flushes = &conf->
|
2848
|
-
sc.lengths = &conf->
|
2849
|
-
sc.values = &conf->
|
3318
|
+
sc.flushes = &conf->body_flushes;
|
3319
|
+
sc.lengths = &conf->body_lengths;
|
3320
|
+
sc.values = &conf->body_values;
|
2850
3321
|
sc.complete_lengths = 1;
|
2851
3322
|
sc.complete_values = 1;
|
2852
3323
|
|
@@ -2855,17 +3326,39 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2855
3326
|
}
|
2856
3327
|
}
|
2857
3328
|
|
2858
|
-
if (
|
3329
|
+
if (conf->headers_source == NULL) {
|
3330
|
+
conf->headers = prev->headers;
|
3331
|
+
#if (NGX_HTTP_CACHE)
|
3332
|
+
conf->headers_cache = prev->headers_cache;
|
3333
|
+
#endif
|
3334
|
+
conf->headers_source = prev->headers_source;
|
3335
|
+
}
|
3336
|
+
|
3337
|
+
rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers,
|
3338
|
+
ngx_http_proxy_headers);
|
3339
|
+
if (rc != NGX_OK) {
|
2859
3340
|
return NGX_CONF_ERROR;
|
2860
3341
|
}
|
2861
3342
|
|
3343
|
+
#if (NGX_HTTP_CACHE)
|
3344
|
+
|
3345
|
+
if (conf->upstream.cache) {
|
3346
|
+
rc = ngx_http_proxy_init_headers(cf, conf, &conf->headers_cache,
|
3347
|
+
ngx_http_proxy_cache_headers);
|
3348
|
+
if (rc != NGX_OK) {
|
3349
|
+
return NGX_CONF_ERROR;
|
3350
|
+
}
|
3351
|
+
}
|
3352
|
+
|
3353
|
+
#endif
|
3354
|
+
|
2862
3355
|
return NGX_CONF_OK;
|
2863
3356
|
}
|
2864
3357
|
|
2865
3358
|
|
2866
3359
|
static ngx_int_t
|
2867
|
-
|
2868
|
-
|
3360
|
+
ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
3361
|
+
ngx_http_proxy_headers_t *headers, ngx_keyval_t *default_headers)
|
2869
3362
|
{
|
2870
3363
|
u_char *p;
|
2871
3364
|
size_t size;
|
@@ -2878,24 +3371,10 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
2878
3371
|
ngx_http_script_compile_t sc;
|
2879
3372
|
ngx_http_script_copy_code_t *copy;
|
2880
3373
|
|
2881
|
-
if (
|
2882
|
-
conf->flushes = prev->flushes;
|
2883
|
-
conf->headers_set_len = prev->headers_set_len;
|
2884
|
-
conf->headers_set = prev->headers_set;
|
2885
|
-
conf->headers_set_hash = prev->headers_set_hash;
|
2886
|
-
conf->headers_source = prev->headers_source;
|
2887
|
-
}
|
2888
|
-
|
2889
|
-
if (conf->headers_set_hash.buckets
|
2890
|
-
#if (NGX_HTTP_CACHE)
|
2891
|
-
&& ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
|
2892
|
-
#endif
|
2893
|
-
)
|
2894
|
-
{
|
3374
|
+
if (headers->hash.buckets) {
|
2895
3375
|
return NGX_OK;
|
2896
3376
|
}
|
2897
3377
|
|
2898
|
-
|
2899
3378
|
if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
|
2900
3379
|
!= NGX_OK)
|
2901
3380
|
{
|
@@ -2916,27 +3395,16 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
2916
3395
|
}
|
2917
3396
|
}
|
2918
3397
|
|
2919
|
-
|
2920
|
-
if (
|
3398
|
+
headers->lengths = ngx_array_create(cf->pool, 64, 1);
|
3399
|
+
if (headers->lengths == NULL) {
|
2921
3400
|
return NGX_ERROR;
|
2922
3401
|
}
|
2923
3402
|
|
2924
|
-
|
2925
|
-
if (
|
3403
|
+
headers->values = ngx_array_create(cf->pool, 512, 1);
|
3404
|
+
if (headers->values == NULL) {
|
2926
3405
|
return NGX_ERROR;
|
2927
3406
|
}
|
2928
3407
|
|
2929
|
-
|
2930
|
-
#if (NGX_HTTP_CACHE)
|
2931
|
-
|
2932
|
-
h = conf->upstream.cache ? ngx_http_proxy_cache_headers:
|
2933
|
-
ngx_http_proxy_headers;
|
2934
|
-
#else
|
2935
|
-
|
2936
|
-
h = ngx_http_proxy_headers;
|
2937
|
-
|
2938
|
-
#endif
|
2939
|
-
|
2940
3408
|
src = conf->headers_source->elts;
|
2941
3409
|
for (i = 0; i < conf->headers_source->nelts; i++) {
|
2942
3410
|
|
@@ -2948,6 +3416,8 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
2948
3416
|
*s = src[i];
|
2949
3417
|
}
|
2950
3418
|
|
3419
|
+
h = default_headers;
|
3420
|
+
|
2951
3421
|
while (h->key.len) {
|
2952
3422
|
|
2953
3423
|
src = headers_merged.elts;
|
@@ -2987,7 +3457,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
2987
3457
|
}
|
2988
3458
|
|
2989
3459
|
if (ngx_http_script_variables_count(&src[i].value) == 0) {
|
2990
|
-
copy = ngx_array_push_n(
|
3460
|
+
copy = ngx_array_push_n(headers->lengths,
|
2991
3461
|
sizeof(ngx_http_script_copy_code_t));
|
2992
3462
|
if (copy == NULL) {
|
2993
3463
|
return NGX_ERROR;
|
@@ -3005,7 +3475,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3005
3475
|
+ sizeof(uintptr_t) - 1)
|
3006
3476
|
& ~(sizeof(uintptr_t) - 1);
|
3007
3477
|
|
3008
|
-
copy = ngx_array_push_n(
|
3478
|
+
copy = ngx_array_push_n(headers->values, size);
|
3009
3479
|
if (copy == NULL) {
|
3010
3480
|
return NGX_ERROR;
|
3011
3481
|
}
|
@@ -3022,7 +3492,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3022
3492
|
*p++ = CR; *p = LF;
|
3023
3493
|
|
3024
3494
|
} else {
|
3025
|
-
copy = ngx_array_push_n(
|
3495
|
+
copy = ngx_array_push_n(headers->lengths,
|
3026
3496
|
sizeof(ngx_http_script_copy_code_t));
|
3027
3497
|
if (copy == NULL) {
|
3028
3498
|
return NGX_ERROR;
|
@@ -3037,7 +3507,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3037
3507
|
+ src[i].key.len + sizeof(": ") - 1 + sizeof(uintptr_t) - 1)
|
3038
3508
|
& ~(sizeof(uintptr_t) - 1);
|
3039
3509
|
|
3040
|
-
copy = ngx_array_push_n(
|
3510
|
+
copy = ngx_array_push_n(headers->values, size);
|
3041
3511
|
if (copy == NULL) {
|
3042
3512
|
return NGX_ERROR;
|
3043
3513
|
}
|
@@ -3054,16 +3524,16 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3054
3524
|
|
3055
3525
|
sc.cf = cf;
|
3056
3526
|
sc.source = &src[i].value;
|
3057
|
-
sc.flushes = &
|
3058
|
-
sc.lengths = &
|
3059
|
-
sc.values = &
|
3527
|
+
sc.flushes = &headers->flushes;
|
3528
|
+
sc.lengths = &headers->lengths;
|
3529
|
+
sc.values = &headers->values;
|
3060
3530
|
|
3061
3531
|
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
3062
3532
|
return NGX_ERROR;
|
3063
3533
|
}
|
3064
3534
|
|
3065
3535
|
|
3066
|
-
copy = ngx_array_push_n(
|
3536
|
+
copy = ngx_array_push_n(headers->lengths,
|
3067
3537
|
sizeof(ngx_http_script_copy_code_t));
|
3068
3538
|
if (copy == NULL) {
|
3069
3539
|
return NGX_ERROR;
|
@@ -3078,7 +3548,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3078
3548
|
+ sizeof(CRLF) - 1 + sizeof(uintptr_t) - 1)
|
3079
3549
|
& ~(sizeof(uintptr_t) - 1);
|
3080
3550
|
|
3081
|
-
copy = ngx_array_push_n(
|
3551
|
+
copy = ngx_array_push_n(headers->values, size);
|
3082
3552
|
if (copy == NULL) {
|
3083
3553
|
return NGX_ERROR;
|
3084
3554
|
}
|
@@ -3090,14 +3560,14 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3090
3560
|
*p++ = CR; *p = LF;
|
3091
3561
|
}
|
3092
3562
|
|
3093
|
-
code = ngx_array_push_n(
|
3563
|
+
code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
|
3094
3564
|
if (code == NULL) {
|
3095
3565
|
return NGX_ERROR;
|
3096
3566
|
}
|
3097
3567
|
|
3098
3568
|
*code = (uintptr_t) NULL;
|
3099
3569
|
|
3100
|
-
code = ngx_array_push_n(
|
3570
|
+
code = ngx_array_push_n(headers->values, sizeof(uintptr_t));
|
3101
3571
|
if (code == NULL) {
|
3102
3572
|
return NGX_ERROR;
|
3103
3573
|
}
|
@@ -3105,7 +3575,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3105
3575
|
*code = (uintptr_t) NULL;
|
3106
3576
|
}
|
3107
3577
|
|
3108
|
-
code = ngx_array_push_n(
|
3578
|
+
code = ngx_array_push_n(headers->lengths, sizeof(uintptr_t));
|
3109
3579
|
if (code == NULL) {
|
3110
3580
|
return NGX_ERROR;
|
3111
3581
|
}
|
@@ -3113,7 +3583,7 @@ ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
|
3113
3583
|
*code = (uintptr_t) NULL;
|
3114
3584
|
|
3115
3585
|
|
3116
|
-
hash.hash = &
|
3586
|
+
hash.hash = &headers->hash;
|
3117
3587
|
hash.key = ngx_hash_key_lc;
|
3118
3588
|
hash.max_size = conf->headers_hash_max_size;
|
3119
3589
|
hash.bucket_size = conf->headers_hash_bucket_size;
|
@@ -3612,9 +4082,7 @@ ngx_http_proxy_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3612
4082
|
ngx_str_t *value;
|
3613
4083
|
ngx_http_script_compile_t sc;
|
3614
4084
|
|
3615
|
-
if (plcf->upstream.store != NGX_CONF_UNSET
|
3616
|
-
|| plcf->upstream.store_lengths)
|
3617
|
-
{
|
4085
|
+
if (plcf->upstream.store != NGX_CONF_UNSET) {
|
3618
4086
|
return "is duplicate";
|
3619
4087
|
}
|
3620
4088
|
|
@@ -3626,17 +4094,14 @@ ngx_http_proxy_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3626
4094
|
}
|
3627
4095
|
|
3628
4096
|
#if (NGX_HTTP_CACHE)
|
3629
|
-
|
3630
|
-
if (plcf->upstream.cache != NGX_CONF_UNSET_PTR
|
3631
|
-
&& plcf->upstream.cache != NULL)
|
3632
|
-
{
|
4097
|
+
if (plcf->upstream.cache > 0) {
|
3633
4098
|
return "is incompatible with \"proxy_cache\"";
|
3634
4099
|
}
|
3635
|
-
|
3636
4100
|
#endif
|
3637
4101
|
|
4102
|
+
plcf->upstream.store = 1;
|
4103
|
+
|
3638
4104
|
if (ngx_strcmp(value[1].data, "on") == 0) {
|
3639
|
-
plcf->upstream.store = 1;
|
3640
4105
|
return NGX_CONF_OK;
|
3641
4106
|
}
|
3642
4107
|
|
@@ -3668,26 +4133,53 @@ ngx_http_proxy_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3668
4133
|
{
|
3669
4134
|
ngx_http_proxy_loc_conf_t *plcf = conf;
|
3670
4135
|
|
3671
|
-
ngx_str_t
|
4136
|
+
ngx_str_t *value;
|
4137
|
+
ngx_http_complex_value_t cv;
|
4138
|
+
ngx_http_compile_complex_value_t ccv;
|
3672
4139
|
|
3673
4140
|
value = cf->args->elts;
|
3674
4141
|
|
3675
|
-
if (plcf->upstream.cache !=
|
4142
|
+
if (plcf->upstream.cache != NGX_CONF_UNSET) {
|
3676
4143
|
return "is duplicate";
|
3677
4144
|
}
|
3678
4145
|
|
3679
4146
|
if (ngx_strcmp(value[1].data, "off") == 0) {
|
3680
|
-
plcf->upstream.cache =
|
4147
|
+
plcf->upstream.cache = 0;
|
3681
4148
|
return NGX_CONF_OK;
|
3682
4149
|
}
|
3683
4150
|
|
3684
|
-
if (plcf->upstream.store > 0
|
4151
|
+
if (plcf->upstream.store > 0) {
|
3685
4152
|
return "is incompatible with \"proxy_store\"";
|
3686
4153
|
}
|
3687
4154
|
|
3688
|
-
plcf->upstream.cache =
|
3689
|
-
|
3690
|
-
|
4155
|
+
plcf->upstream.cache = 1;
|
4156
|
+
|
4157
|
+
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
|
4158
|
+
|
4159
|
+
ccv.cf = cf;
|
4160
|
+
ccv.value = &value[1];
|
4161
|
+
ccv.complex_value = &cv;
|
4162
|
+
|
4163
|
+
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
|
4164
|
+
return NGX_CONF_ERROR;
|
4165
|
+
}
|
4166
|
+
|
4167
|
+
if (cv.lengths != NULL) {
|
4168
|
+
|
4169
|
+
plcf->upstream.cache_value = ngx_palloc(cf->pool,
|
4170
|
+
sizeof(ngx_http_complex_value_t));
|
4171
|
+
if (plcf->upstream.cache_value == NULL) {
|
4172
|
+
return NGX_CONF_ERROR;
|
4173
|
+
}
|
4174
|
+
|
4175
|
+
*plcf->upstream.cache_value = cv;
|
4176
|
+
|
4177
|
+
return NGX_CONF_OK;
|
4178
|
+
}
|
4179
|
+
|
4180
|
+
plcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0,
|
4181
|
+
&ngx_http_proxy_module);
|
4182
|
+
if (plcf->upstream.cache_zone == NULL) {
|
3691
4183
|
return NGX_CONF_ERROR;
|
3692
4184
|
}
|
3693
4185
|
|
@@ -3725,6 +4217,33 @@ ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3725
4217
|
#endif
|
3726
4218
|
|
3727
4219
|
|
4220
|
+
#if (NGX_HTTP_SSL)
|
4221
|
+
|
4222
|
+
static char *
|
4223
|
+
ngx_http_proxy_ssl_password_file(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
4224
|
+
{
|
4225
|
+
ngx_http_proxy_loc_conf_t *plcf = conf;
|
4226
|
+
|
4227
|
+
ngx_str_t *value;
|
4228
|
+
|
4229
|
+
if (plcf->ssl_passwords != NGX_CONF_UNSET_PTR) {
|
4230
|
+
return "is duplicate";
|
4231
|
+
}
|
4232
|
+
|
4233
|
+
value = cf->args->elts;
|
4234
|
+
|
4235
|
+
plcf->ssl_passwords = ngx_ssl_read_password_file(cf, &value[1]);
|
4236
|
+
|
4237
|
+
if (plcf->ssl_passwords == NULL) {
|
4238
|
+
return NGX_CONF_ERROR;
|
4239
|
+
}
|
4240
|
+
|
4241
|
+
return NGX_CONF_OK;
|
4242
|
+
}
|
4243
|
+
|
4244
|
+
#endif
|
4245
|
+
|
4246
|
+
|
3728
4247
|
static char *
|
3729
4248
|
ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data)
|
3730
4249
|
{
|
@@ -3774,6 +4293,31 @@ ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf)
|
|
3774
4293
|
return NGX_ERROR;
|
3775
4294
|
}
|
3776
4295
|
|
4296
|
+
cln = ngx_pool_cleanup_add(cf->pool, 0);
|
4297
|
+
if (cln == NULL) {
|
4298
|
+
return NGX_ERROR;
|
4299
|
+
}
|
4300
|
+
|
4301
|
+
cln->handler = ngx_ssl_cleanup_ctx;
|
4302
|
+
cln->data = plcf->upstream.ssl;
|
4303
|
+
|
4304
|
+
if (plcf->ssl_certificate.len) {
|
4305
|
+
|
4306
|
+
if (plcf->ssl_certificate_key.len == 0) {
|
4307
|
+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
4308
|
+
"no \"proxy_ssl_certificate_key\" is defined "
|
4309
|
+
"for certificate \"%V\"", &plcf->ssl_certificate);
|
4310
|
+
return NGX_ERROR;
|
4311
|
+
}
|
4312
|
+
|
4313
|
+
if (ngx_ssl_certificate(cf, plcf->upstream.ssl, &plcf->ssl_certificate,
|
4314
|
+
&plcf->ssl_certificate_key, plcf->ssl_passwords)
|
4315
|
+
!= NGX_OK)
|
4316
|
+
{
|
4317
|
+
return NGX_ERROR;
|
4318
|
+
}
|
4319
|
+
}
|
4320
|
+
|
3777
4321
|
if (SSL_CTX_set_cipher_list(plcf->upstream.ssl->ctx,
|
3778
4322
|
(const char *) plcf->ssl_ciphers.data)
|
3779
4323
|
== 0)
|
@@ -3784,13 +4328,25 @@ ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf)
|
|
3784
4328
|
return NGX_ERROR;
|
3785
4329
|
}
|
3786
4330
|
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
4331
|
+
if (plcf->upstream.ssl_verify) {
|
4332
|
+
if (plcf->ssl_trusted_certificate.len == 0) {
|
4333
|
+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
4334
|
+
"no proxy_ssl_trusted_certificate for proxy_ssl_verify");
|
4335
|
+
return NGX_ERROR;
|
4336
|
+
}
|
3791
4337
|
|
3792
|
-
|
3793
|
-
|
4338
|
+
if (ngx_ssl_trusted_certificate(cf, plcf->upstream.ssl,
|
4339
|
+
&plcf->ssl_trusted_certificate,
|
4340
|
+
plcf->ssl_verify_depth)
|
4341
|
+
!= NGX_OK)
|
4342
|
+
{
|
4343
|
+
return NGX_ERROR;
|
4344
|
+
}
|
4345
|
+
|
4346
|
+
if (ngx_ssl_crl(cf, plcf->upstream.ssl, &plcf->ssl_crl) != NGX_OK) {
|
4347
|
+
return NGX_ERROR;
|
4348
|
+
}
|
4349
|
+
}
|
3794
4350
|
|
3795
4351
|
return NGX_OK;
|
3796
4352
|
}
|