You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2003/10/23 06:34:06 UTC

[apreq-2] libapreq_cgi tests under env/t

Hi,
  The libapreq_cgi tests under env/cgi_test/t/, which
are now separately from the mod_apreq tests under
env/t/, all now pass (a patch to enable the building
and running of these tests under unix is attached - I've not
had a lot of experience with automake/autoconf, so may have
missed something here). These tests include fetching
paramaters and getting/setting cookie data.
   However, in trying to move the libapreq_cgi tests to run
with the mod_apreq tests under env/t/, there's still a
problem with GET requests. For example, this test:
============================================================
my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
my $line_end = WIN32 ? "\r\n" : "\n";
my $filler = "0123456789" x 5; # < 64K

ok t_cmp("\tfoo => ?$line_end\tbar => hello world$line_end",
         GET_BODY("$script?foo=%3F&bar=hello+world"),
"simple get");
=======================================================================
results in a server error, with this in the error log:
=====================================================================
[Wed Oct 22 22:54:58 2003] [notice] Apache/2.0.47 (Unix) configured --
 resuming normal operations

[Wed Oct 22 22:54:58 2003] [debug] prefork.c(1037):
AcceptMutex: pthread (default: pthread)

[Wed Oct 22 22:54:59 2003] [debug] mod_apreq.c(215): [client
127.0.0.1] apreq request is now initialized (135596168)

[Wed Oct 22 22:54:59 2003] [debug] mod_apreq.c(333): [client
127.0.0.1] apreq filter is initialized (135596144)

[Wed Oct 22 22:54:59 2003] [debug] mod_apreq.c(365): [client
127.0.0.1] (70008)Partial results are valid but processing
is incomplete: entering filter (1)

[Wed Oct 22 22:54:59 2003] [debug] mod_apreq.c(427): [client
127.0.0.1] (70022)There is no error, this value signifies an
initialized error code: leaving filter (1)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(215): [client
127.0.0.1] apreq request is now initialized (135597488)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(333): [client
127.0.0.1] apreq filter is initialized (135597464)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(365): [client
127.0.0.1] (70008)Partial results are valid but processing
is incomplete: entering filter (1)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(427): [client
127.0.0.1] (70022)There is no error, this value signifies an
initialized error code: leaving filter (1)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(365): [client
127.0.0.1] (70022)There is no error, this value signifies an
initialized error code: entering filter (1)

[Wed Oct 22 22:55:00 2003] [debug] mod_apreq.c(399): [client
127.0.0.1] (70022)There is no error, this value signifies an
initialized error code: removing filter(0)

===============================================================================
A POST request, such as
==============================================================================
my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
my $line_end = WIN32 ? "\r\n" : "\n";
my $filler = "0123456789" x 5; # < 64K

my $body = POST_BODY("/$script", content =>
                     "aaa=$filler;foo=1;bar=2;filler=$filler");
ok t_cmp("\tfoo => 1$line_end\tbar => 2$line_end",
         $body, "simple post");
===========================================================================
is successful, and to compare, this is in the error log:
==========================================================================
[Wed Oct 22 22:55:35 2003] [notice] Apache/2.0.47 (Unix)
configured -- resuming normal operations

[Wed Oct 22 22:55:35 2003] [debug] prefork.c(1037):
AcceptMutex: pthread (default: pthread)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(215): [client
127.0.0.1] apreq request is now initialized (135596168)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(333): [client
127.0.0.1] apreq filter is initialized (135596144)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(365): [client
127.0.0.1] (70008)Partial results are valid but processing
is incomplete: entering filter (1)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(427): [client
127.0.0.1] (70022)There is no error, this value signifies an
initialized error code: leaving filter (1)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(215): [client
127.0.0.1] apreq request is now initialized (135596488)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(365): [client
127.0.0.1] (70008)Partial results are valid but processing
is incomplete: entering filter (1)

[Wed Oct 22 22:55:35 2003] [debug] mod_apreq.c(427): [client
127.0.0.1] leaving filter (1)

[Wed Oct 22 22:55:35 2003] [error] [client 127.0.0.1]
[cgi_test.c(109)] Creating apreq_request

[Wed Oct 22 22:55:35 2003] [error] [client 127.0.0.1]
[cgi_test.c(113)] Fetching the parameters

[Wed Oct 22 22:55:35 2003] [error] [client 127.0.0.1]
[cgi_test.c(124)] foo => 1

[Wed Oct 22 22:55:35 2003] [error] [client 127.0.0.1]
[cgi_test.c(128)] bar => 2
===========================================================================

(the [error] coming from cgi_test.c arises from the
use of fprintf(stderr, ...) in the trace, so is not
a server error).

I'm not sure what to look for here ... In the failed
GET request, the tracing in cgi_test.c aren't reached,
and one difference between the two is that the GET
request reports (at the end) that a filter was removed,
whereas in the POST request such removal doesn't happen.
Does the above suggest someplace to look further as to
what is going wrong?

-- 
best regards,
randy

Re: [apreq-2] libapreq_cgi tests under env/t

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 23 Oct 2003, Joe Schaefer wrote:

> Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
>
> > Hi,
> >   The libapreq_cgi tests under env/cgi_test/t/, which
> > are now separately from the mod_apreq tests under
> > env/t/, all now pass (a patch to enable the building
> > and running of these tests under unix is attached - I've not
> > had a lot of experience with automake/autoconf, so may have
> > missed something here). These tests include fetching
> > paramaters and getting/setting cookie data.
>
> Great!  The patch to enable the tests looks fine to me,
> but if there's an easy fix that'll allow the tests to
> work in env/t, maybe we should go that route instead.
>
> >    However, in trying to move the libapreq_cgi tests to run
> > with the mod_apreq tests under env/t/, there's still a
> > problem with GET requests.

[ snipped error logs ]

> What bothers me first about the error logs is that the
> mod_apreq filter is even participating in the cgi request.
> Any ideas about which of our test handlers is injecting it?
> A likely candidate would be the access test module.  See if
> this patch helps any:
[ .. ]
That patch alone caused a crash; however, with the other
changes made in the current cvs today, the libapreq_cgi
tests now all pass under env/t/! And the error log now shows
mod_apreq isn't participating at all in these particular
tests.

I'll make up something to move and enable the libapreq_cgi
tests under env/t/.

-- 
best regards,
randy

Re: [apreq-2] libapreq_cgi tests under env/t

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:

> Hi,
>   The libapreq_cgi tests under env/cgi_test/t/, which
> are now separately from the mod_apreq tests under
> env/t/, all now pass (a patch to enable the building
> and running of these tests under unix is attached - I've not
> had a lot of experience with automake/autoconf, so may have
> missed something here). These tests include fetching
> paramaters and getting/setting cookie data.

Great!  The patch to enable the tests looks fine to me,
but if there's an easy fix that'll allow the tests to
work in env/t, maybe we should go that route instead.

>    However, in trying to move the libapreq_cgi tests to run
> with the mod_apreq tests under env/t/, there's still a
> problem with GET requests. For example, this test:
> ============================================================
> my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
> my $line_end = WIN32 ? "\r\n" : "\n";
> my $filler = "0123456789" x 5; # < 64K
> 
> ok t_cmp("\tfoo => ?$line_end\tbar => hello world$line_end",
>          GET_BODY("$script?foo=%3F&bar=hello+world"),
> "simple get");
> =======================================================================
> results in a server error, with this in the error log:
> =====================================================================

[...]

> ===============================================================================
> A POST request, such as
> ==============================================================================
> my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
> my $line_end = WIN32 ? "\r\n" : "\n";
> my $filler = "0123456789" x 5; # < 64K
> 
> my $body = POST_BODY("/$script", content =>
>                      "aaa=$filler;foo=1;bar=2;filler=$filler");
> ok t_cmp("\tfoo => 1$line_end\tbar => 2$line_end",
>          $body, "simple post");
> ===========================================================================
> is successful, and to compare, this is in the error log:
> ==========================================================================

[...]

> ===========================================================================
> 
> (the [error] coming from cgi_test.c arises from the
> use of fprintf(stderr, ...) in the trace, so is not
> a server error).
> 
> I'm not sure what to look for here ... In the failed
> GET request, the tracing in cgi_test.c aren't reached,
> and one difference between the two is that the GET
> request reports (at the end) that a filter was removed,
> whereas in the POST request such removal doesn't happen.
> Does the above suggest someplace to look further as to
> what is going wrong?

What bothers me first about the error logs is that the
mod_apreq filter is even participating in the cgi request.  
Any ideas about which of our test handlers is injecting it?
A likely candidate would be the access test module.  See if
this patch helps any:

Index: env/c-modules/apreq_access_test/mod_apreq_access_test.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/c-modules/apreq_access_test/mod_apreq_access_test.c,v
retrieving revision 1.4
diff -u -r1.4 mod_apreq_access_test.c
--- env/c-modules/apreq_access_test/mod_apreq_access_test.c	1 Oct 2003 20:00:36 -0000	1.4
+++ env/c-modules/apreq_access_test/mod_apreq_access_test.c	23 Oct 2003 05:12:36 -0000
@@ -101,7 +101,7 @@
 
 static int apreq_access_checker(request_rec *r)
 {
-    apreq_request_t *req = apreq_request(r, NULL);
+    apreq_request_t *req;
     apreq_param_t *param;
     struct access_test_cfg *cfg = (struct access_test_cfg *)
         ap_get_module_config(r->per_dir_config, &apreq_access_test_module);
@@ -109,6 +109,7 @@
     if (!cfg || !cfg->param)
         return DECLINED;
 
+    req = apreq_request(r, NULL);
     param = apreq_param(req, cfg->param);
     if (param) {
         apreq_log(APREQ_DEBUG 0, r, "%s => %s", cfg->param, param->v.data);


-- 
Joe Schaefer