You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by ra...@apache.org on 2003/10/12 06:46:20 UTC
cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore extra.conf.in
randyk 2003/10/11 21:46:20
Added: env/cgi_test cgi_test.c
env/cgi_test/t TEST.PL cgi.t
env/cgi_test/t/cgi-bin .cvsignore
env/cgi_test/t/conf .cvsignore extra.conf.in
Log:
Moved cgi_test.c, a cgi C script used to test libapreq_cgi,
to its own directory, and make separate associated test files, as
there were conflicts when run under env/t/ due to loading
of mod_apreq.
Revision Changes Path
1.1 httpd-apreq-2/env/cgi_test/cgi_test.c
Index: cgi_test.c
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "apreq.h"
#include "apreq_env.h"
#include "apreq_params.h"
#include "apreq_parsers.h"
#include "apreq_cookie.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_tables.h"
typedef struct env_ctx {
apr_pool_t *pool;
apreq_request_t *req;
apreq_jar_t *jar;
apr_bucket_brigade *bb;
int loglevel;
apr_status_t status;
} env_ctx;
static int dump_table(void *ctx, const char *key, const char *value)
{
env_ctx *c = (env_ctx *) ctx;
apreq_log(APREQ_DEBUG 0, c, "%s => %s", key, value);
printf("\t%s => %s\n", key, value);
return 1;
}
int main(void)
{
apreq_request_t *req;
env_ctx *ctx;
apr_pool_t *pool;
if (apr_initialize() != APR_SUCCESS) {
fprintf(stderr, "apr_initialize failed\n");
exit(-1);
}
if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
fprintf(stderr, "apr_pool_create failed\n");
exit(-1);
}
ctx = (env_ctx *) apr_palloc(pool, sizeof(*ctx));
ctx->loglevel = 0;
ctx->pool = pool;
apreq_log(APREQ_DEBUG 0, ctx, "%s", "Creating apreq_request");
req = apreq_request(ctx, NULL);
printf("%s", "Content-Type: text/plain\n\n");
apreq_log(APREQ_DEBUG 0, ctx, "%s", "Fetching the parameters");
printf("ARGS:\n");
apr_table_do(dump_table, ctx, req->args, NULL);
if (req->body) {
printf("BODY:\n");
apr_table_do(dump_table, ctx, req->body, NULL);
}
apreq_log(APREQ_DEBUG 0, ctx, "%s", "Done!");
return 0;
}
1.1 httpd-apreq-2/env/cgi_test/t/TEST.PL
Index: TEST.PL
===================================================================
#!perl
use strict;
use warnings FATAL => 'all';
use Apache::TestRun();
Apache::TestRun->new->run(@ARGV);
1.1 httpd-apreq-2/env/cgi_test/t/cgi.t
Index: cgi.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestConfig;
use Apache::TestRequest qw(GET_BODY UPLOAD_BODY POST_BODY GET_RC);
use constant WIN32 => Apache::TestConfig::WIN32;
plan tests => 2;
my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
my $line_end = WIN32 ? "\r\n" : "\n";
ok t_cmp("ARGS:$line_end\tfoo => 1$line_end",
GET_BODY("$script?foo=1"), "simple get");
ok t_cmp("ARGS:$line_end\tbar => hello world$line_end\tfoo => ?$line_end",
GET_BODY("$script?bar=hello+world;foo=%3F"), "simple get");
1.1 httpd-apreq-2/env/cgi_test/t/cgi-bin/.cvsignore
Index: .cvsignore
===================================================================
cgi_test
cgi_test.exe
1.1 httpd-apreq-2/env/cgi_test/t/conf/.cvsignore
Index: .cvsignore
===================================================================
httpd.conf
extra.conf
extra.last.conf
mime.types
modperl_inc.pl
modperl_startup.pl
apache_test_config.pm
1.1 httpd-apreq-2/env/cgi_test/t/conf/extra.conf.in
Index: extra.conf.in
===================================================================
ScriptAlias /cgi-bin/ "@ServerRoot@/cgi-bin/"
<Directory "@ServerRoot@/cgi-bin">
AllowOverride None
Options None
</Directory>
Re: cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore
extra.conf.in
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sun, 12 Oct 2003, Randy Kobes wrote:
> On Sun, 12 Oct 2003, Joe Schaefer wrote:
> [ .. ]
> > Oh, well. I just would have liked to see the cgi tests incorporated
> > into env/t (as you originally planned) instead of their own location.
> > Maybe we can move them back in the future, after we've sorted all
> > this oddness out.
>
> That'd certainly be better to have them incorportated - I'll
> keep looking at it. The main reason I separated them
> (temporarily) is so that while these things are being
> sorted out the mod_apreq tests aren't affected.
Further to this, I now find that if, within cgi.t, I use
POST_BODY, rather than GET_BODY, to send the request, the
libapreq_cgi test can be run (and passes) within env/.
Changing it back to GET_BODY (which works in env/cgi_test/)
results in a server error when run under env/.
--
best regards,
randy
Re: cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore
extra.conf.in
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sun, 12 Oct 2003, Joe Schaefer wrote:
[ .. ]
> The cgi "script" compiles and links against libapreq_cgi before
> the tests actually run, so I don't think this is a linking issue
> on Win32 (btw- Unix libapreq_cgi is only built statically, maybe
> the Win32 build should do this also).
I've also had it build libapreq_cgi statically on Win32,
but there's still problems ...
> The question I'm wondering about is how httpd sets up the subprocess
> environment for the cgi-script prior to execution. Maybe httpd's
> mod_cgi has a bug on Win32? Or maybe we need to use mod_cgid
> instead?
> Oh, well. I just would have liked to see the cgi tests incorporated
> into env/t (as you originally planned) instead of their own location.
> Maybe we can move them back in the future, after we've sorted all
> this oddness out.
That'd certainly be better to have them incorportated - I'll
keep looking at it. The main reason I separated them
(temporarily) is so that while these things are being
sorted out the mod_apreq tests aren't affected.
--
best regards,
randy
Re: cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore extra.conf.in
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
[...]
> I'm not sure if this is a Win32 thing or not, but when
> I tried running the cgi tests from within env/t/, it
> crashed due to the
> LoadModule apreq_request_test_module ...
> LoadModule apreq_access_test_module ...
> LoadModule apreq_redirect_test_module ...
> directives - if I commented those out (as well as the
> directives in the associated <Location></Location> blocks),
> then things were OK. So I couldn't run the two tests
> concurrently. I thought this was due to conflicts with
> mod_apreq - there was a problem linking the c-modules on
> Win32 that required inclusion of -lmod_apreq (just as what
> happens with the perl glue). This may be peculiar to Win32
> - I was going to try to put together the Makefiles on
> Linux to see what happens there, and also try, on
> Win32, to see how one can build the c-modules and perl glue
> without having to explicitly add -lmod_apreq.
The cgi "script" compiles and links against libapreq_cgi before
the tests actually run, so I don't think this is a linking issue
on Win32 (btw- Unix libapreq_cgi is only built statically, maybe
the Win32 build should do this also).
The question I'm wondering about is how httpd sets up the subprocess
environment for the cgi-script prior to execution. Maybe httpd's
mod_cgi has a bug on Win32? Or maybe we need to use mod_cgid
instead?
Oh, well. I just would have liked to see the cgi tests incorporated
into env/t (as you originally planned) instead of their own location.
Maybe we can move them back in the future, after we've sorted all
this oddness out.
--
Joe Schaefer
Re: cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore
extra.conf.in
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sun, 12 Oct 2003, Joe Schaefer wrote:
> randyk@apache.org writes:
>
> > randyk 2003/10/11 21:46:20
> >
> > Added: env/cgi_test cgi_test.c
> > env/cgi_test/t TEST.PL cgi.t
> > env/cgi_test/t/cgi-bin .cvsignore
> > env/cgi_test/t/conf .cvsignore extra.conf.in
> > Log:
> > Moved cgi_test.c, a cgi C script used to test libapreq_cgi,
> > to its own directory, and make separate associated test files, as
> > there were conflicts when run under env/t/ due to loading
> > of mod_apreq.
>
> I'm confused by this- can you say more about the mod_apreq conflicts
> you were seeing? Why is mod_apreq getting loaded into the cgi process?
I'm not sure if this is a Win32 thing or not, but when
I tried running the cgi tests from within env/t/, it
crashed due to the
LoadModule apreq_request_test_module ...
LoadModule apreq_access_test_module ...
LoadModule apreq_redirect_test_module ...
directives - if I commented those out (as well as the
directives in the associated <Location></Location> blocks),
then things were OK. So I couldn't run the two tests
concurrently. I thought this was due to conflicts with
mod_apreq - there was a problem linking the c-modules on
Win32 that required inclusion of -lmod_apreq (just as what
happens with the perl glue). This may be peculiar to Win32
- I was going to try to put together the Makefiles on
Linux to see what happens there, and also try, on
Win32, to see how one can build the c-modules and perl glue
without having to explicitly add -lmod_apreq.
--
best regards,
randy
Re: cvs commit: httpd-apreq-2/env/cgi_test/t/conf .cvsignore extra.conf.in
Posted by Joe Schaefer <jo...@sunstarsys.com>.
randyk@apache.org writes:
> randyk 2003/10/11 21:46:20
>
> Added: env/cgi_test cgi_test.c
> env/cgi_test/t TEST.PL cgi.t
> env/cgi_test/t/cgi-bin .cvsignore
> env/cgi_test/t/conf .cvsignore extra.conf.in
> Log:
> Moved cgi_test.c, a cgi C script used to test libapreq_cgi,
> to its own directory, and make separate associated test files, as
> there were conflicts when run under env/t/ due to loading
> of mod_apreq.
I'm confused by this- can you say more about the mod_apreq conflicts
you were seeing? Why is mod_apreq getting loaded into the cgi process?
--
Joe Schaefer