OK, here is what I did:
First at the beginning of my program I have:
$agent->requests_redirectable( [] );
Now here is where I click a continue button that loads the page that is supposed to redirect me to the final page (note that redirects are disabled and I am retrieving and then GETing the redirect URL manually):
$post_response = $agent->click('continue');
my $status = $agent->status();
if (($status >= 300) && ($status < 400))
{
my $location = $agent->response()->header('Location');
if (defined $location)
{
print "Redirected to $location\n";
$post_response = $agent->get(URI->new_abs($location, $agent->b
+ase()));
printf("post_response is %s\n", $post_response->status_line);
}
}
This seems to successfully capture the redirect URL and outputs the following (actual long hex strings and other info replaced with 'X'):
Redirected to /misc/XXXX/processocp.cgi?email=XXXX&back=httpXXXXX&spla
+sh=X&vskey=XXXX
post_response is 200 OK
However I can tell from my program that is isn't successfully navigating to the final screen of the process, because when I run:
$post_response->decoded_content()
I get (again, the info in the redirect URL has been replaced with 'X'):
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta http-equiv="refresh" content="1;url=http://XXXX/processocp.cgi?e
+mail=XXXXX&back=XXXXXX&vskey=XXXXX">
</head>
<body>
<div style="font-size: 1.5em; text-align: center; width: 300px; margin
+: 0px auto; margin-top: 40px">
Processing...please wait<br/>
</div>
</body>
</html>
As you can see, it still seems to be stuck at the "processing.." screen, even though I told the program to "get" the redirect URL, i.e. the URL that would normally be automatically retrieved if redirects were enabled.
What is going on here? |