Permalink
Browse files

fix some concerns with has_basic_auth method

  • Loading branch information...
1 parent 8208c6e commit 1ab69054737518e8523bf7dacce69c218f2ad488 @ronaldxs ronaldxs committed Aug 23, 2011
Showing with 8 additions and 5 deletions.
  1. +5 −5 lib/LWP/Simple.pm
  2. +3 −0 t/basic-auth.t
View
@@ -20,12 +20,12 @@ method base64encode ($user, $pass) {
method has_basic_auth (Str $host) {
# ^ <username> : <password> @ <hostname> $
- warn "has_basic_auth deprecated - not in p5 LWP simple and now returned by pares_url";
+ warn "has_basic_auth deprecated - not in p5 LWP simple and now returned by parse_url";
if $host ~~ /^ (\w+) \: (\w+) \@ (\N+) $/ {
- my $host = $0.Str;
- my $user = $1.Str;
- my $pass = $2.Str;
- return $host, $user, $pass;
+ my $user = $0.Str;
+ my $pass = $1.Str;
+ my $host = $2.Str;
+ return $user, $pass, $host;
}
return;
View
@@ -18,6 +18,9 @@ is(@url[3], '/p6-lwp-simple/basic-auth/', 'Path extracted correctly');
is(@url[4]<user>, 'ron', 'Basic auth info extracted correctly: user');
is(@url[4]<password>, 'Camelia', 'Basic auth info extracted correctly: pass');
is(@url[4]<host>, 'www.software-path.com', 'Basic auth info extracted correctly: hostname');
+# my ($auth_u, $auth_p, $auth_h)= LWP::Simple.has_basic_auth(@url[1]);
+# ok($auth_h eq 'www.software-path.com' && $auth_u eq 'ron' && $auth_p eq 'Camelia',
+# 'test deprecated has_basic_auth method');
# Encode test
is(

0 comments on commit 1ab6905

Please sign in to comment.