You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by David Wheeler <da...@kineticode.com> on 2003/07/11 19:45:17 UTC
Re: [PATCH] Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestRequest.pm
On Friday, July 11, 2003, at 09:27 AM, Sander Temme wrote:
>> The above patch doesn't work. But this does:
>
> Ehm... works for me. I think you're working in the mod_perl space and
> I'm
> just concentrating on the Apache core. Maybe there are side effects
> that I'm
> not seeing?
Yes, the redirect_ok subroutine, which is relevant to using lwp to send
requests to the server.. It might work to have it return 0 instead of
undef, though.
> I don't think it will... I need redirect to be 1 under the
> circumstances
> that I described: during those apache/acceptpathinfo and modules/alias
> tests
> that need it. So, unless there is a compelling reason (like
> $args->{requests_redirectable} existing and containing pertinent
> information), we should leave $RedirectOK alone here.
Oops, of course. The problem was actually my stupid use of local in a
block where it actually wouldn't do anything. So try this, instead:
--- TestRequest.pm.~1.81.~ Fri Jul 11 09:02:32 2003
+++ TestRequest.pm Fri Jul 11 10:43:36 2003
@@ -88,14 +88,13 @@
$UA = undef;
}
- if (my $redir = $args->{requests_redirectable}) {
+ if (exists $args->{requests_redirectable}) {
+ my $redir = $args->{requests_redirectable};
if (ref $redir and (@$redir > 1 or $redir->[0] ne 'POST')) {
$RedirectOK = 1;
} else {
$RedirectOK = 0;
}
- } else {
- $RedirectOK = $redir;
}
$args->{keep_alive} ||= $ENV{APACHE_TEST_HTTP11};
@@ -298,9 +297,9 @@
sub UPLOAD {
my($url, $pass, $keep) = prepare(@_);
- if (exists $keep->{redirect_ok}) {
- local $RedirectOK = $keep->{redirect_ok};
- }
+ local $RedirectOK = exists $keep->{redirect_ok} ?
+ $keep->{redirect_ok} : $RedirectOK;
+
if ($keep->{filename}) {
return upload_file($url, $keep->{filename}, $pass);
}
@@ -461,9 +460,8 @@
*$name = sub {
my($url, $pass, $keep) = prepare(@_);
- if (exists $keep->{redirect_ok}) {
- local $RedirectOK = $keep->{redirect_ok};
- }
+ local $RedirectOK = exists $keep->{redirect_ok} ?
+ $keep->{redirect_ok} : $RedirectOK;
return lwp_call($method, undef, $url, @$pass);
};
Regards,
David
--
David Wheeler AIM: dwTheory
david@kineticode.com ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]
Re: [PATCH] Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache
TestRequest.pm
Posted by Stas Bekman <st...@stason.org>.
David Wheeler wrote:
> On Friday, July 11, 2003, at 09:27 AM, Sander Temme wrote:
>
>>> The above patch doesn't work. But this does:
>>
>>
>> Ehm... works for me. I think you're working in the mod_perl space and I'm
>> just concentrating on the Apache core. Maybe there are side effects
>> that I'm
>> not seeing?
>
>
> Yes, the redirect_ok subroutine, which is relevant to using lwp to send
> requests to the server.. It might work to have it return 0 instead of
> undef, though.
>
>> I don't think it will... I need redirect to be 1 under the circumstances
>> that I described: during those apache/acceptpathinfo and modules/alias
>> tests
>> that need it. So, unless there is a compelling reason (like
>> $args->{requests_redirectable} existing and containing pertinent
>> information), we should leave $RedirectOK alone here.
>
>
> Oops, of course. The problem was actually my stupid use of local in a
> block where it actually wouldn't do anything. So try this, instead:
>
> --- TestRequest.pm.~1.81.~ Fri Jul 11 09:02:32 2003
> +++ TestRequest.pm Fri Jul 11 10:43:36 2003
> @@ -88,14 +88,13 @@
> $UA = undef;
> }
>
> - if (my $redir = $args->{requests_redirectable}) {
> + if (exists $args->{requests_redirectable}) {
> + my $redir = $args->{requests_redirectable};
> if (ref $redir and (@$redir > 1 or $redir->[0] ne 'POST')) {
> $RedirectOK = 1;
> } else {
> $RedirectOK = 0;
> }
> - } else {
> - $RedirectOK = $redir;
> }
>
> $args->{keep_alive} ||= $ENV{APACHE_TEST_HTTP11};
> @@ -298,9 +297,9 @@
> sub UPLOAD {
> my($url, $pass, $keep) = prepare(@_);
>
> - if (exists $keep->{redirect_ok}) {
> - local $RedirectOK = $keep->{redirect_ok};
> - }
> + local $RedirectOK = exists $keep->{redirect_ok} ?
> + $keep->{redirect_ok} : $RedirectOK;
> +
> if ($keep->{filename}) {
> return upload_file($url, $keep->{filename}, $pass);
> }
> @@ -461,9 +460,8 @@
>
> *$name = sub {
> my($url, $pass, $keep) = prepare(@_);
> - if (exists $keep->{redirect_ok}) {
> - local $RedirectOK = $keep->{redirect_ok};
> - }
> + local $RedirectOK = exists $keep->{redirect_ok} ?
> + $keep->{redirect_ok} : $RedirectOK;
> return lwp_call($method, undef, $url, @$pass);
> };
That looks good. I've committed it. Thanks David!
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com