# HG changeset patch # User Sergey Kandaurov # Date 1545670575 -10800 # Node ID 2d7fcd713b66768d570783fc7c734e70ed9fd259 # Parent 4e48bf51714f28215128b2d0c4a825bfe10c8607 Tests: added userid tests with IPv6 and unix sockets. diff --git a/userid.t b/userid.t --- a/userid.t +++ b/userid.t @@ -26,7 +26,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http userid map/)->plan(33); +my $t = Test::Nginx->new()->has(qw/http userid map unix/); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -48,6 +48,8 @@ http { server { listen 127.0.0.1:8080; + listen [::1]:%%PORT_8080%%; + listen unix:%%TESTDIR%%/unix.sock; server_name localhost; add_header X-Got $uid_got; @@ -117,6 +119,16 @@ http { userid_mark t; } + location /ip6 { + userid off; + proxy_pass http://[::1]:%%PORT_8080%%/; + } + + location /unix { + userid off; + proxy_pass http://unix:%%TESTDIR%%/unix.sock:/; + } + location /clog { userid log; } @@ -135,7 +147,7 @@ EOF $t->write_file('cv1', ''); $t->write_file('clog', ''); $t->write_file('coff', ''); -$t->run(); +$t->try_run('no inet6 support')->plan(35); ############################################################################### @@ -212,6 +224,16 @@ is(substr(uid_set(http_get('/')), 0, 8), $addr = $bigendian ? "0000FFFE" : "FEFF0000"; is(substr(uid_set(http_get('/service')), 0, 8), $addr, 'service custom'); +$addr = $bigendian ? "00000001" : "01000000"; +is(substr(uid_set(http_get('/ip6')), 0, 8), $addr, 'service ipv6'); + +TODO: { +local $TODO = 'not yet'; + +is(substr(uid_set(http_get('/unix')), 0, 8), "00000000", 'service unix'); + +} + # reset log send_uid('/?log', cookie($r, 'uid'));