Eventually applied as:

Index: lib/LWP/UserAgent.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/UserAgent.pm,v
retrieving revision 2.9
diff -u -p -r2.9 UserAgent.pm
--- lib/LWP/UserAgent.pm        15 Oct 2003 12:47:37 -0000      2.9
+++ lib/LWP/UserAgent.pm        15 Oct 2003 13:11:21 -0000
@@ -468,7 +468,10 @@ sub request
                       "Unknown code $code"));

     if ($code == &HTTP::Status::RC_MOVED_PERMANENTLY or
-       $code == &HTTP::Status::RC_MOVED_TEMPORARILY) {
+       $code == &HTTP::Status::RC_FOUND or
+       $code == &HTTP::Status::RC_SEE_OTHER or
+       $code == &HTTP::Status::RC_TEMPORARY_REDIRECT)
+    {

        # Make a copy of the request and initialize it with the new URI
        my $referral = $request->clone;
@@ -483,6 +486,11 @@ sub request
            $referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
                            ->abs($base);
        }
+
+       $referral->method("GET")
+           if ($code == &HTTP::Status::RC_SEE_OTHER ||
+               $code == &HTTP::Status::RC_FOUND) &&
+                   $referral->method ne "HEAD";

        $referral->url($referral_uri);
        $referral->remove_header('Host', 'Cookie');



Tom Hughes <[EMAIL PROTECTED]> writes:

> --- UserAgent.pm.orig Fri Aug  2 08:17:42 2002
> +++ UserAgent.pm      Fri Aug  2 08:47:25 2002
> @@ -445,7 +445,9 @@
>                      "Unknown code $code"));
>  
>      if ($code == &HTTP::Status::RC_MOVED_PERMANENTLY or
> -     $code == &HTTP::Status::RC_MOVED_TEMPORARILY) {
> +     $code == &HTTP::Status::RC_FOUND or
> +     $code == &HTTP::Status::RC_SEE_OTHER or
> +     $code == &HTTP::Status::RC_TEMPORARY_REDIRECT) {
>  
>       # Make a copy of the request and initialize it with the new URI
>       my $referral = $request->clone;
> @@ -464,7 +466,11 @@
>       $referral->url($referral_uri);
>       $referral->remove_header('Host', 'Cookie');
>  
> -     return $response unless $self->redirect_ok($referral);
> +     if ($code == &HTTP::Status::RC_SEE_OTHER) {
> +         $referral->method("GET");
> +     } else {
> +         return $response unless $self->redirect_ok($referral);
> +     }
>  
>       # Check for loop in the redirects
>       my $count = 0;

Reply via email to