[Httpmail-devel] Patches to libwww-perl to fix redirect problem
Status: Beta
Brought to you by:
fuzz
From: Rob N. <na...@bi...> - 2002-10-01 22:12:12
|
httpmail should work if you apply these patches to libwww libraries. I submitted the patches to li...@pe..., so it probably will be some time before they get into a release. Rob ---------------------------------------------------------------- From: Rob Nagler <na...@bi...> To: li...@pe... Subject: LWP::Authen::Digest patch for multiple authentications Date: Tue, 1 Oct 2002 15:51:17 -0600 httpmail (httpmail.sourceforge.net) needs this patch. hotmail.com reauthenticates with the same user/pass but a different uri (going to passport). The code in LWP::Authen::Digest assumed a re-auth failure only if the user/pass matched. This code adds the uri to the mix. Rob ---------------------------------------------------------------- Index: Digest.pm =================================================================== *** Digest.pm 2002/09/04 17:25:21 1.1 --- Digest.pm 2002/10/01 21:33:57 1.2 *************** *** 66,76 **** my $auth_header = $proxy ? "Proxy-Authorization" : "Authorization"; my $auth_value = "Digest " . join(", ", @pairs); ! # Need to check this isn't a repeated fail! my $r = $response; while ($r) { my $u = $r->request->{digest_user_pass}; ! if ($u && $u->[0] eq $user && $u->[1] eq $pass) { # here we know this failed before $response->header("Client-Warning" => "Credentials for '$user' failed before"); --- 66,78 ---- my $auth_header = $proxy ? "Proxy-Authorization" : "Authorization"; my $auth_value = "Digest " . join(", ", @pairs); ! # Need to check this isn't a repeated fail for this [user, pass, uri] my $r = $response; + my $failed_uri = $r->request->url->as_string; while ($r) { my $u = $r->request->{digest_user_pass}; ! if ($u && $u->[0] eq $user && $u->[1] eq $pass ! && $u->[2] eq $failed_uri) { # here we know this failed before $response->header("Client-Warning" => "Credentials for '$user' failed before"); *************** *** 82,88 **** my $referral = $request->clone; $referral->header($auth_header => $auth_value); # we shouldn't really do this, but... ! $referral->{digest_user_pass} = [$user, $pass]; return $ua->request($referral, $arg, $size, $response); } --- 84,90 ---- my $referral = $request->clone; $referral->header($auth_header => $auth_value); # we shouldn't really do this, but... ! $referral->{digest_user_pass} = [$user, $pass, $failed_uri]; return $ua->request($referral, $arg, $size, $response); } ---------------------------------------------------------------- From: Rob Nagler <na...@bi...> To: li...@pe... Subject: LWP::UserAgent patch for redirects after authentications Date: Tue, 1 Oct 2002 15:58:21 -0600 httpmail (httpmail.sourceforge.net) needs this patch. hotmail.com is fussy about receiving an Authorization: header. Thanks to Frank de Lange for explaining the bug: http://sourceforge.net/mailarchive/forum.php?thread_id=693641&forum_id=2580 Rob ---------------------------------------------------------------- retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** UserAgent.pm 2002/09/04 17:25:21 1.1 --- UserAgent.pm 2002/10/01 21:35:08 1.2 *************** *** 463,468 **** --- 463,471 ---- $referral->url($referral_uri); $referral->remove_header('Host', 'Cookie'); + # Don't resend authorization unless server asks for it. + $referral->remove_header('Authorization') + unless $response->header('WWW-Authenticate'); return $response unless $self->redirect_ok($referral); |