changeset 961:4993ece8620e

Tests: avoid unexpected match in proxy_protocol_port.t at all. Use client port in PROXY protocol header that doesn't fall into ephemeral range.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 27 Jun 2016 11:15:34 +0300
parents d4a0232425ee
children e214983c605b
files proxy_protocol_port.t
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/proxy_protocol_port.t
+++ b/proxy_protocol_port.t
@@ -68,22 +68,22 @@ EOF
 
 ###############################################################################
 
-my $tcp4 = 'PROXY TCP4 192.0.2.1 192.0.2.2 12345 5678' . CRLF;
-my $tcp6 = 'PROXY TCP6 2001:Db8::1 2001:Db8::2 12345 5678' . CRLF;
+my $tcp4 = 'PROXY TCP4 192.0.2.1 192.0.2.2 123 5678' . CRLF;
+my $tcp6 = 'PROXY TCP6 2001:Db8::1 2001:Db8::2 123 5678' . CRLF;
 my $unk = 'PROXY UNKNOWN 1 2 3 4 5 6' . CRLF;
 
 # realip
 
-like(pp_get('/pp', $tcp4), qr/X-PP-Port: 12345/, 'pp port tcp4');
-like(pp_get('/pp', $tcp6), qr/X-PP-Port: 12345/, 'pp port tcp6');
+like(pp_get('/pp', $tcp4), qr/X-PP-Port: 123\x0d/, 'pp port tcp4');
+like(pp_get('/pp', $tcp6), qr/X-PP-Port: 123\x0d/, 'pp port tcp6');
 unlike(pp_get('/pp', $unk), qr/X-PP-Port/, 'pp port unknown');
 
 # remote_port
 
-like(pp_get('/pp/real', $tcp4), qr/X-Remote-Port: 12345/, 'remote port tcp4');
-unlike(pp_get('/pp', $tcp4), qr/X-Remote-Port: 12345/, 'no remote port tcp4');
-like(pp_get('/pp/real', $tcp6), qr/X-Remote-Port: 12345/, 'remote port tcp6');
-unlike(pp_get('/pp', $tcp6), qr/X-Remote-Port: 12345/, 'no remote port tcp6');
+like(pp_get('/pp/real', $tcp4), qr/X-Remote-Port: 123\x0d/, 'remote port tcp4');
+unlike(pp_get('/pp', $tcp4), qr/X-Remote-Port: 123\x0d/, 'no remote port tcp4');
+like(pp_get('/pp/real', $tcp6), qr/X-Remote-Port: 123\x0d/, 'remote port tcp6');
+unlike(pp_get('/pp', $tcp6), qr/X-Remote-Port: 123\x0d/, 'no remote port tcp6');
 
 # log
 
@@ -94,7 +94,7 @@ pp_get('/log', $tcp4);
 my $log = $t->read_file('/port.log');
 chomp $log;
 
-is($log, 12345, 'pp port log');
+is($log, 123, 'pp port log');
 
 ###############################################################################