[Rt-commit] [svn] r892 - in RT-Client: . lib/LWP/Authen lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Fri May 14 09:29:49 EDT 2004


Author: autrijus
Date: Fri May 14 09:29:44 2004
New Revision: 892

Modified:
   RT-Client/   (props changed)
   RT-Client/lib/LWP/Authen/Wsse.pm
   RT-Client/lib/RT/Client.pm
Log:
 ----------------------------------------------------------------------
 r4867 at not:  autrijus | 2004-05-14T13:29:31.925169Z
 
 * Avoid infinitely redirects on wrong crednetials.
 * Correctly parse Mason errors as true errors.
 ----------------------------------------------------------------------


Modified: RT-Client/lib/LWP/Authen/Wsse.pm
==============================================================================
--- RT-Client/lib/LWP/Authen/Wsse.pm	(original)
+++ RT-Client/lib/LWP/Authen/Wsse.pm	Fri May 14 09:29:44 2004
@@ -1,9 +1,10 @@
 package LWP::Authen::Wsse;
-use strict;
 
-require Digest::MD5;
-require Digest::SHA1;
-require MIME::Base64;
+use strict;
+use DateTime;
+use Digest::MD5;
+use Digest::SHA1;
+use MIME::Base64;
 
 sub authenticate {
     my($class, $ua, $proxy, $auth_param, $response,
@@ -33,9 +34,10 @@
 
     # Need to check this isn't a repeated fail!
     my $r = $response;
+    my $failed;
     while ($r) {
-	my $wsse = $r->request->header('X-WSSE');
-	if ($wsse && $wsse eq $wsse_value) {
+	my $prev = $r->request->{wsse_user_pass};
+	if ($prev and $prev->[0] eq $user and $prev->[1] eq $pass and $r->code == 401 and $failed++) {
 	    # here we know this failed before
 	    $response->header("Client-Warning" =>
 			      "Credentials for '$user' failed before");
@@ -48,7 +50,7 @@
     $referral->header('X-WSSE' => $wsse_value);
 
     # we shouldn't really do this, but...
-    $referral->{digest_user_pass} = [$user, $pass];
+    $referral->{wsse_user_pass} = [$user, $pass];
 
     return $ua->request($referral, $arg, $size, $response);
 }

Modified: RT-Client/lib/RT/Client.pm
==============================================================================
--- RT-Client/lib/RT/Client.pm	(original)
+++ RT-Client/lib/RT/Client.pm	Fri May 14 09:29:44 2004
@@ -79,6 +79,12 @@
     my $res = shift;
     $res->content =~ /<(\w+)/ or return $res->content;
 
+    if ($1 eq 'html') {
+        $self->errstr($res->content);
+        $self->status(500);
+        return undef;
+    }
+
     my $class = $self->_describe_map->{$1} or die "Sorry, type $1 not handled yet";
     return $class->new(Client => $self, Stream => \$res->content, URI => $res->base);
 }


More information about the Rt-commit mailing list