ngx_add_timer(c->write, http->conf->timeout);
#if (NGX_SSL)
- if (ngx_js_conf_proxy(http->conf) && http->ssl != NULL && c->ssl == NULL) {
+ if (ngx_js_http_proxy(http) && http->ssl != NULL && c->ssl == NULL) {
http->proxy.pending = ngx_js_chain_to_buf(http->pool, &http->chain);
if (http->proxy.pending == NULL) {
ngx_js_http_error(http, "memory error");
http->process = ngx_js_http_process_connect_response;
} else {
- if (ngx_js_conf_proxy(http->conf) && http->ssl != NULL && c->ssl != NULL) {
+ if (ngx_js_http_proxy(http) && http->ssl != NULL && c->ssl != NULL) {
http->proxy.state = HTTP_STATE_PROXY_TUNNEL_READY;
}
http->process = ngx_js_http_process_status_line;
}
- if (http->ssl != NULL && c->ssl == NULL && !ngx_js_conf_proxy(http->conf)) {
+ if (http->ssl != NULL && c->ssl == NULL && !ngx_js_http_proxy(http)) {
ngx_js_http_ssl_init_connection(http);
return;
}
#if (NGX_SSL)
if (http->ssl != NULL && http->peer.connection->ssl == NULL
- && !ngx_js_conf_proxy(http->conf))
+ && !ngx_js_http_proxy(http))
{
ngx_js_http_ssl_init_connection(http);
return;
location /https_no_proxy {
js_content test.https_fetch;
}
+
+ location /https_empty_variable_proxy {
+ set $proxy_url "";
+ js_fetch_proxy $proxy_url;
+ js_content test.https_fetch;
+ }
}
server {
. $t->read_file('intermediate.crt'));
}
-$t->try_run('no js_fetch_proxy')->plan(9);
+$t->try_run('no js_fetch_proxy')->plan(10);
$t->run_daemon(\&https_proxy_daemon, $p2, 1);
$t->run_daemon(\&https_proxy_daemon, $p4, 0);
like(http_get('/https_no_proxy?domain=example.com'), qr/ORIGIN/,
'https without proxy');
+like(http_get('/https_empty_variable_proxy?domain=example.com'), qr/ORIGIN/,
+ 'https with empty variable proxy connects directly');
+
like(http_get('/https_via_proxy?domain=nonexistent.dest.domain'),
qr/connect failed/, 'https through proxy nonexistent.dest.domain');
like(http_get('/https_via_broken_proxy?domain=example.com'),