X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibwww-perl%2Flibwww-perl-5.813%2Ft%2Fbase%2Fheaders-auth.t;fp=dev%2Farm%2Flibwww-perl%2Flibwww-perl-5.813%2Ft%2Fbase%2Fheaders-auth.t;h=51a2d1120af631f91ec72300d14cb0570520d4bc;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libwww-perl/libwww-perl-5.813/t/base/headers-auth.t b/dev/arm/libwww-perl/libwww-perl-5.813/t/base/headers-auth.t new file mode 100644 index 0000000..51a2d11 --- /dev/null +++ b/dev/arm/libwww-perl/libwww-perl-5.813/t/base/headers-auth.t @@ -0,0 +1,41 @@ +print "1..4\n"; + +use HTTP::Response; +use HTTP::Headers::Auth; + +$res = HTTP::Response->new(401); +$res->push_header(WWW_Authenticate => qq(Foo realm="WallyWorld", foo=bar, Bar realm="WallyWorld2")); +$res->push_header(WWW_Authenticate => qq(Basic Realm="WallyWorld", foo=bar, bar=baz)); + +print $res->as_string; + +%auth = $res->www_authenticate; + +print "not " unless keys(%auth) == 3; +print "ok 1\n"; + +print "not " unless $auth{basic}{realm} eq "WallyWorld" && + $auth{bar}{realm} eq "WallyWorld2"; +print "ok 2\n"; + +$a = $res->www_authenticate; +print "not " unless $a eq 'Foo realm="WallyWorld", foo=bar, Bar realm="WallyWorld2", Basic Realm="WallyWorld", foo=bar, bar=baz'; +print "ok 3\n"; + +$res->www_authenticate("Basic realm=foo1"); +print $res->as_string; + +$res->www_authenticate(Basic => {realm => foo2}); +print $res->as_string; + +$res->www_authenticate(Basic => [realm => foo3, foo=>33], + Digest => {nonce=>"bar", foo=>'foo'}); +print $res->as_string; + +$_ = $res->as_string; + +print "not " unless /WWW-Authenticate: Basic realm="foo3", foo=33/ && + (/WWW-Authenticate: Digest nonce=bar, foo=foo/ || + /WWW-Authenticate: Digest foo=foo, nonce=bar/); +print "ok 4\n"; +