Subject: | LWP::UserAgent 302/303 redirection incorrect |
When UserAgent->request is called on a page that returns either 302 or
303, the method resets itself to GET.
The following snippet (from the request subroutine) clearly shows the
GET method being set unless the method is GET or HEAD.
if ($code == &HTTP::Status::RC_SEE_OTHER ||
$code == &HTTP::Status::RC_FOUND)
{
my $method = uc($referral->method);
unless ($method eq "GET" || $method eq "HEAD") {
$referral->method("GET");
$referral->content("");
$referral->remove_content_headers;
}
}
By W3C HTTP/1.1 standards (rfc2616), 302 should not redirect, but rather
prompt the user for redirection. Now, very very few browsers actually
do this, they just continue on. However, reformatting the data as GET
is not a viable solution when a host only allows POST.
The 303 should only contain a link and should not redirect at all.
(Again, most browsers ignore this and just continue on.)
As for a solution... Simply modifying the routine to check based on the
"requests_redirectable" data rather than what's hardcoded seems like a
logical route to me.
If you need more info or help, feel free to ask!
Thanks!
-Clif