# HG changeset patch # User Sergey Kandaurov # Date 1625086125 -10800 # Node ID 53a801bf4d0bb50f56c236534d0b13a9eba13622 # Parent 672018971a623addb49e7354feb97e10c01910d4 Tests: auth_basic_user_file variable tests with conf_prefix. diff --git a/auth_basic.t b/auth_basic.t --- a/auth_basic.t +++ b/auth_basic.t @@ -23,7 +23,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(21) +my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(24) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -48,6 +48,12 @@ http { auth_basic off; alias %%TESTDIR%%/; } + + location /var { + # prepended with conf_prefix + auth_basic_user_file $arg_f; + alias %%TESTDIR%%/; + } } } } @@ -112,6 +118,13 @@ like(http_get_auth('/', 'sha3', '1'), qr like(http_get_auth('/', 'notfound', '1'), qr!401 Unauthorized!, 'not found'); like(http_get('/inner/'), qr!SEETHIS!, 'inner off'); +like(http_get_auth('/var/?f=htpasswd', 'apr1', 'password'), qr!SEETHIS!, + 'user file variable'); +unlike(http_get_auth('/var/?f=nx', 'apr1', 'password'), qr!SEETHIS!, + 'user file variable not found'); +unlike(http_get_auth('/var/', 'apr1', 'password'), qr!SEETHIS!, + 'user file variable bad value'); + ############################################################################### sub http_get_auth {