theory 2004/07/30 19:43:33
Modified: perl-framework/Apache-Test Changes
perl-framework/Apache-Test/lib/Apache TestRequest.pm
Log:
Fix requests_redirectable and document passing an array to it.
Revision Changes Path
1.152 +8 -0 httpd-test/perl-framework/Apache-Test/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -r1.151 -r1.152
--- Changes 31 Jul 2004 01:35:25 -0000 1.151
+++ Changes 31 Jul 2004 02:43:33 -0000 1.152
@@ -39,6 +39,14 @@
message if verbosity is enabled (e.g., by passing --verbose when
executing Build.PL). [David]
+Fixed the "requests_redirectable" parameter to
+Apache::TestRequest::user_agent() so that it works as docmented when
+passed a negative value. [Boris Zentner]
+
+Documented support for passing an array reference to the
+"requests_redirectable" parameter to Apache::TestRequest::user_agent()
+to be passed to LWP::UserAgent if LWP ist installed. [David]
+
=item 1.12 - June 28, 2004
1.97 +19 -7
httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm
Index: TestRequest.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- TestRequest.pm 6 May 2004 19:11:33 -0000 1.96
+++ TestRequest.pm 31 Jul 2004 02:43:33 -0000 1.97
@@ -117,6 +117,10 @@
my $redir = $args->{requests_redirectable};
if (ref $redir and (@$redir > 1 or $redir->[0] ne 'POST')) {
$RedirectOK = 1;
+ } elsif ($redir) {
+ $args->{requests_redirectable} = [ qw/GET HEAD POST/ ]
+ if $have_lwp;
+ $RedirectOK = 1;
} else {
$RedirectOK = 0;
}
@@ -727,16 +731,24 @@
C<L<LWP::UserAgent|LWP::UserAgent>> documentation, has the effect of
loading and enabling the new experimental HTTP/1.1 protocol module).
-And finally, the semantics of the C<requests_redirectable> parameter
-is different than for C<LWP::UserAgent>: It either follows
-redirects for a request, or it doesn't. Thus
-C<requests_redirectable> is a boolean value instead of the array
-reference that C<LWP::UserAgent> expects. To force
-C<Apache::TestRequest> not to follow redirects in any of its
-convenience functions, pass a false value to C<requests_redirectable>:
+And finally, the semantics of the C<requests_redirectable> parameter is
+different than for C<LWP::UserAgent> in that you can pass it a boolean
+value as well as an array for C<LWP::UserAgent>. To force
+C<Apache::TestRequest> not to follow redirects in any of its convenience
+functions, pass a false value to C<requests_redirectable>:
Apache::TestRequest::user_agent(reset => 1,
requests_redirectable => 0);
+
+If LWP is not installed, then you can still pass in an array reference
+as C<LWP::UserAgent> expects. C<Apache::TestRequest> will examine the
+array and allow redirects if the array contains more than one value or
+if there is only one value and that value is not "POST":
+
+ # Always allow redirection.
+ my $redir = have_lwp ? [qw(GET HEAD POST)] : 1;
+ Apache::TestRequest::user_agent(reset => 1,
+ requests_redirectable => $redir);
=head1 FUNCTIONS