Tests: added proxy_bind test with port.
diff --git a/proxy_bind.t b/proxy_bind.t index a4c5fbb..ca6629a 100644 --- a/proxy_bind.t +++ b/proxy_bind.t
@@ -26,7 +26,7 @@ plan(skip_all => '127.0.0.2 local address required') unless defined IO::Socket::INET->new( LocalAddr => '127.0.0.2' ); -my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(4) +my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -63,6 +63,12 @@ proxy_bind $arg_b; proxy_pass http://127.0.0.1:%%PORT_1%%/; } + + location /port { + proxy_bind 127.0.0.2:$remote_port; + proxy_pass http://127.0.0.1:%%PORT_1%%/; + add_header X-Client-Port $remote_port; + } } server { @@ -71,6 +77,7 @@ location / { add_header X-IP $remote_addr; + add_header X-Port $remote_port; } } } @@ -87,4 +94,11 @@ like(http_get('/off'), qr/X-IP: 127.0.0.1/, 'bind off'); like(http_get('/var?b=127.0.0.2'), qr/X-IP: 127.0.0.2/, 'bind var'); +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.11.2'); + +like(http_get('/port'), qr/Port: (\d+)(?!\d).*Port: \1/s, 'bind port'); + +} + ###############################################################################