Tests: {SHA} password scheme tests (ticket #50).
diff --git a/auth_basic.t b/auth_basic.t
index 2f74579..89938d9 100644
--- a/auth_basic.t
+++ b/auth_basic.t
@@ -23,7 +23,7 @@
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(15)
+my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(19)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
@@ -63,7 +63,10 @@
'plain:' . '{PLAIN}password' . "\n" .
'ssha:' . '{SSHA}yI6cZwQadOA1e+/f+T+H3eCQQhRzYWx0' . "\n" .
'ssha2:' . '{SSHA}_____wQadOA1e+/f+T+H3eCQQhRzYWx0' . "\n" .
- 'ssha3:' . '{SSHA}Zm9vCg==' . "\n"
+ 'ssha3:' . '{SSHA}Zm9vCg==' . "\n" .
+ 'sha:' . '{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' . "\n" .
+ 'sha2:' . '{SHA}_____Mm5Pz8GgiULbPgzG37mj9g=' . "\n" .
+ 'sha3:' . '{SHA}Zm9vCg==' . "\n"
);
$t->run();
@@ -93,20 +96,29 @@
SKIP: {
# SHA1 may not be available unless we have OpenSSL
- skip 'no sha1', 1 unless $t->has_module('--with-http_ssl_module')
+ skip 'no sha1', 2 unless $t->has_module('--with-http_ssl_module')
or $t->has_module('--with-sha1')
or $t->has_module('--with-openssl');
like(http_get_auth('/', 'ssha', 'password'), qr!SEETHIS!, 'ssha');
+
+TODO: {
+ local $TODO = 'not yet';
+ like(http_get_auth('/', 'sha', 'password'), qr!SEETHIS!, 'sha');
+}
+
}
unlike(http_get_auth('/', 'apr1', '123'), qr!SEETHIS!, 'apr1 md5 wrong');
unlike(http_get_auth('/', 'plain', '123'), qr!SEETHIS!, 'plain wrong');
unlike(http_get_auth('/', 'ssha', '123'), qr!SEETHIS!, 'ssha wrong');
+unlike(http_get_auth('/', 'sha', '123'), qr!SEETHIS!, 'sha wrong');
like(http_get_auth('/', 'apr12', '1'), qr!401 Unauthorized!, 'apr1 md5 broken');
like(http_get_auth('/', 'ssha2', '1'), qr!401 Unauthorized!, 'ssha broken 1');
like(http_get_auth('/', 'ssha3', '1'), qr!401 Unauthorized!, 'ssha broken 2');
+like(http_get_auth('/', 'sha2', '1'), qr!401 Unauthorized!, 'sha broken 1');
+like(http_get_auth('/', 'sha3', '1'), qr!401 Unauthorized!, 'sha broken 2');
###############################################################################