You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Steve Hay <st...@uk.radan.com> on 2003/09/17 11:22:02 UTC
[mp2] t/apache/cookie[2].t test failures
Hi,
The apache/cookie.t and apache/cookie2.t tests also fail on Win32
(Apache 2.0.47, perl@21233, mp2 CVS):
=====
C:\Temp\modperl-2.0>perl t/TEST -verbose t/apache/cookie.t
C:\apache2/bin/Apache.exe -d C:/Temp/modperl-2.0/t -f
C:/Temp/modperl-2.0/t/con
f/httpd.conf -DAPACHE2 -DPERL_USEITHREADS
using Apache/2.0.47 (winnt MPM)
[snip]
apache/cookie....1..2
# Running under perl version 5.008001 for MSWin32
# Current time local: Wed Sep 17 09:48:47 2003
# Current time GMT: Wed Sep 17 08:48:47 2003
# Using Test.pm version 1.24
request has failed (the response code was: 400)
see t/logs/error_log for more details
dubious
Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
apache/cookie.t 9 2304 2 4 200.00% 1-2
!!! error running tests (please examine t\logs\error_log)
=====
The error_log contains one interesting line:
[Wed Sep 17 09:48:47 2003] [error] [client 127.0.0.1] Invalid URI in
request GET TestApache__cookie?header HTTP/1.0
and
=====
C:\Temp\modperl-2.0>perl t/TEST -verbose t/apache/cookie2.t
C:\apache2/bin/Apache.exe -d C:/Temp/modperl-2.0/t -f
C:/Temp/modperl-2.0/t/con
f/httpd.conf -DAPACHE2 -DPERL_USEITHREADS
using Apache/2.0.47 (winnt MPM)
[snip]
apache/cookie2....1..2
# Running under perl version 5.008001 for MSWin32
# Current time local: Wed Sep 17 09:49:54 2003
# Current time GMT: Wed Sep 17 08:49:54 2003
# Using Test.pm version 1.24
# Testing cookie in PerlResponseHandler
# -- testing cookie from header
# Failed test 1 in apache/cookie2.t at line 20
# testing : content is 'bar'
# expected: bar
# received: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
# <html><head>
# <title>400 Bad Request</title>
# </head><body>
# <h1>Bad Request</h1>
# <p>Your browser sent a request that this server could not
understand.<br />
# </p>
# </body></html>
not ok 1
# -- testing cookie from env
# Failed test 2 in apache/cookie2.t at line 20 fail #2
# testing : content is 'bar'
# expected: bar
# received: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
# <html><head>
# <title>400 Bad Request</title>
# </head><body>
# <h1>Bad Request</h1>
# <p>Your browser sent a request that this server could not
understand.<br />
# </p>
# </body></html>
not ok 2
FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
apache/cookie2.t 2 2 100.00% 1-2
!!! error running tests (please examine t\logs\error_log)
=====
with two lines of interest in the error_log:
[Wed Sep 17 09:49:54 2003] [error] [client 127.0.0.1] Invalid URI in
request GET TestApache__cookie2?header HTTP/1.0
[Wed Sep 17 09:49:54 2003] [error] [client 127.0.0.1] Invalid URI in
request GET TestApache__cookie2?env HTTP/1.0
- Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Steve Hay <st...@uk.radan.com>.
Geoffrey Young wrote:
>
>
> Steve Hay wrote:
>
>> Hi,
>>
>> The apache/cookie.t and apache/cookie2.t tests also fail on Win32
>> (Apache 2.0.47, perl@21233, mp2 CVS):
>
>
>> [Wed Sep 17 09:48:47 2003] [error] [client 127.0.0.1] Invalid URI in
>> request GET TestApache__cookie?header HTTP/1.0
>
>
> yucko.
>
> try the attached patch.
Yep - your patch fixes the failures in both those test scripts for me.
Thanks,
- Steve
>
>
> --Geoff
>
>------------------------------------------------------------------------
>
>Index: t/apache/cookie2.t
>===================================================================
>RCS file: /home/cvspublic/modperl-2.0/t/apache/cookie2.t,v
>retrieving revision 1.1
>diff -u -r1.1 cookie2.t
>--- t/apache/cookie2.t 23 Aug 2003 02:39:10 -0000 1.1
>+++ t/apache/cookie2.t 17 Sep 2003 15:36:00 -0000
>@@ -8,13 +8,13 @@
> plan tests => 2;
>
> my $module = 'TestApache::cookie2';
>-my $location = Apache::TestRequest::module2path($module);
>+my $location = '/' . Apache::TestRequest::module2path($module);
> my $cookie = 'foo=bar';
>
> t_debug("Testing cookie in PerlResponseHandler");
>
> for (qw/header env/) {
>- t_debug("-- testing cookie from $_");
>+ t_debug("-- testing cookie from $location$_");
> my $res = GET "$location?$_", Cookie => $cookie;
>
> ok t_cmp('bar', $res->content,
>Index: t/apache/cookie.t
>===================================================================
>RCS file: /home/cvspublic/modperl-2.0/t/apache/cookie.t,v
>retrieving revision 1.2
>diff -u -r1.2 cookie.t
>--- t/apache/cookie.t 12 Sep 2003 02:17:12 -0000 1.2
>+++ t/apache/cookie.t 17 Sep 2003 15:36:00 -0000
>@@ -8,7 +8,7 @@
> plan tests => 2;
>
> my $module = 'TestApache::cookie';
>-my $location = Apache::TestRequest::module2path($module);
>+my $location = '/' . Apache::TestRequest::module2path($module);
> my $val = "bar";
> my $cookie = "key=$val";
>
>@@ -19,6 +19,7 @@
> );
>
> for (qw/header env/) {
>+ t_debug("-- testing cookie from $location?$_");
> my $received = GET_BODY_ASSERT "$location?$_", Cookie => $cookie;
> ok t_cmp($expected{$_}, $received);
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>> my $module = "Foo::bar";
>> {
>> my $path = Apache::TestRequest::module2path($module);
>> GET $path; # GET "/Foo__bar"
>> }
>> {
>> my $url = Apache::TestRequest::module2url($module, "http");
>> GET $url; # GET "http://localhost:8545/Foo__bar"
>> }
>
> So what do you think?
sure
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> OK, I've slept well on this issue and the first thing I thought of in
> the morning is a brilliant solution ;) obviously, what else could you
> expect after such a good sleep ;)
>
> my $module = "Foo::bar";
> {
> my $path = Apache::TestRequest::module2path($module);
> GET $path; # GET "/Foo__bar"
> }
> {
> my $url = Apache::TestRequest::module2url($module, "http");
> GET $url; # GET "http://localhost:8545/Foo__bar"
> }
>
> notice how much simpler it's than it used to be. Internally module2url
> does:
>
> sub module2url {
> my $module = shift;
> my $scheme = shift || "http";
>
> Apache::TestRequest::module($module);
> my $config = Apache::Test::config();
> my $hostport = Apache::TestRequest::hostport($config);
> my $path = Apache::TestRequest::module2path($module);
> return "$scheme://$hostport$path";
> }
>
> of course we fix module2path to prepend /.
So what do you think?
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Stas Bekman <st...@stason.org>.
OK, I've slept well on this issue and the first thing I thought of in the
morning is a brilliant solution ;) obviously, what else could you expect after
such a good sleep ;)
my $module = "Foo::bar";
{
my $path = Apache::TestRequest::module2path($module);
GET $path; # GET "/Foo__bar"
}
{
my $url = Apache::TestRequest::module2url($module, "http");
GET $url; # GET "http://localhost:8545/Foo__bar"
}
notice how much simpler it's than it used to be. Internally module2url does:
sub module2url {
my $module = shift;
my $scheme = shift || "http";
Apache::TestRequest::module($module);
my $config = Apache::Test::config();
my $hostport = Apache::TestRequest::hostport($config);
my $path = Apache::TestRequest::module2path($module);
return "$scheme://$hostport$path";
}
of course we fix module2path to prepend /.
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>
>>
>>> my $uri = Apache::TestRequest->parse($module);
>>> $uri->query('env');
>>> $uri->unparse.
>>>
>>> if Apache::TestRequest::hostport() returns true, then the unparsed
>>> value is an absolute URI, otherwise it's relative.
>>
>>
>>
>> That sounds as too error-prone to me. What happens if the same test
>> mixes requests to a specific hostport and to the default port as well?
>> We have quite a few tests like this and that logic will break them.
>
> well, of course the idea was to have a consistent API that worked and
> felt familiar, not one that was error prone - figuring out exactly which
> variant of
>
> Apache::TestRequest::module($module);
> my $config = Apache::Test::config();
> my $hostport = Apache::TestRequest::hostport($config);
> my $path = Apache::TestRequest::module2path($module);
>
> my $location = "http://$hostport/$path";
>
> you need for a given situation is error prone enough for me.
I'm not following you, you suggested to add magic to automatically prepend the
leading /. that's what I've called error-prone.
> but you seem to have it figured out, so just do what you think is best.
Hmm, look at t/directive/perlloadmodule3.t.
Clearly we are talking about different things.
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>
>> my $uri = Apache::TestRequest->parse($module);
>> $uri->query('env');
>> $uri->unparse.
>>
>> if Apache::TestRequest::hostport() returns true, then the unparsed
>> value is an absolute URI, otherwise it's relative.
>
>
> That sounds as too error-prone to me. What happens if the same test
> mixes requests to a specific hostport and to the default port as well?
> We have quite a few tests like this and that logic will break them.
well, of course the idea was to have a consistent API that worked and felt
familiar, not one that was error prone - figuring out exactly which variant of
Apache::TestRequest::module($module);
my $config = Apache::Test::config();
my $hostport = Apache::TestRequest::hostport($config);
my $path = Apache::TestRequest::module2path($module);
my $location = "http://$hostport/$path";
you need for a given situation is error prone enough for me.
but you seem to have it figured out, so just do what you think is best.
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>
>>> -my $location = Apache::TestRequest::module2path($module);
>>> +my $location = '/' . Apache::TestRequest::module2path($module);
>>
>>
>>
>> The module2path is really there because of win32, which doesn't like
>> paths like /TestApache::cookie. But since we already provide a
>> wrapper, this seems to be ugly:
>>
>> '/' . Apache::TestRequest::module2path($module);
>>
>> or at least the name is misleading (I know I gave it that name). So
>> should we probably rename it to be module2segment or something like
>> that, which doesn't suggest that it returns a valid path?
>>
>> Alternatively fix it to append / internally, though it'll make othe
>> concatenations uglier:
>>
>> my $location "http://$hostport$path";
>>
>> instead of:
>>
>> my $location "http://$hostport/$path";
>>
>> or does the former look good?
>
>
> given all the permutations, maybe we need an Apache::URI-like module
> that accounts for Win32 paths as well.
eh? win32 paths? besides the :: problem there are no win32 paths
> my $uri = Apache::TestRequest->parse($module);
> $uri->query('env');
> $uri->unparse.
>
> if Apache::TestRequest::hostport() returns true, then the unparsed value
> is an absolute URI, otherwise it's relative.
That sounds as too error-prone to me. What happens if the same test mixes
requests to a specific hostport and to the default port as well? We have quite
a few tests like this and that logic will break them.
all I suggested is to fix the module2path name not to suggest that it returns
a path.
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>> -my $location = Apache::TestRequest::module2path($module);
>> +my $location = '/' . Apache::TestRequest::module2path($module);
>
>
> The module2path is really there because of win32, which doesn't like
> paths like /TestApache::cookie. But since we already provide a wrapper,
> this seems to be ugly:
>
> '/' . Apache::TestRequest::module2path($module);
>
> or at least the name is misleading (I know I gave it that name). So
> should we probably rename it to be module2segment or something like
> that, which doesn't suggest that it returns a valid path?
>
> Alternatively fix it to append / internally, though it'll make othe
> concatenations uglier:
>
> my $location "http://$hostport$path";
>
> instead of:
>
> my $location "http://$hostport/$path";
>
> or does the former look good?
given all the permutations, maybe we need an Apache::URI-like module that
accounts for Win32 paths as well.
my $uri = Apache::TestRequest->parse($module);
$uri->query('env');
$uri->unparse.
if Apache::TestRequest::hostport() returns true, then the unparsed value is
an absolute URI, otherwise it's relative.
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>
>
> Steve Hay wrote:
>
>> Hi,
>>
>> The apache/cookie.t and apache/cookie2.t tests also fail on Win32
>> (Apache 2.0.47, perl@21233, mp2 CVS):
>
>
>> [Wed Sep 17 09:48:47 2003] [error] [client 127.0.0.1] Invalid URI in
>> request GET TestApache__cookie?header HTTP/1.0
> -my $location = Apache::TestRequest::module2path($module);
> +my $location = '/' . Apache::TestRequest::module2path($module);
The module2path is really there because of win32, which doesn't like paths
like /TestApache::cookie. But since we already provide a wrapper, this seems
to be ugly:
'/' . Apache::TestRequest::module2path($module);
or at least the name is misleading (I know I gave it that name). So should we
probably rename it to be module2segment or something like that, which doesn't
suggest that it returns a valid path?
Alternatively fix it to append / internally, though it'll make other
concatenations uglier:
my $location "http://$hostport$path";
instead of:
my $location "http://$hostport/$path";
or does the former look good?
__________________________________________________________________
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
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] t/apache/cookie[2].t test failures
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Steve Hay wrote:
> Hi,
>
> The apache/cookie.t and apache/cookie2.t tests also fail on Win32
> (Apache 2.0.47, perl@21233, mp2 CVS):
> [Wed Sep 17 09:48:47 2003] [error] [client 127.0.0.1] Invalid URI in
> request GET TestApache__cookie?header HTTP/1.0
yucko.
try the attached patch.
--Geoff