Tests: added userid tests with IPv6 and unix sockets.
diff --git a/userid.t b/userid.t
index 99b175e..5578eb3 100644
--- a/userid.t
+++ b/userid.t
@@ -26,7 +26,7 @@
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 @@
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 @@
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 @@
$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 @@
$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'));