[svn:mod_parrot] r187 - in mod_parrot/trunk: . build lib/Apache lib/ModParrot t t/conf t/lib
[email protected] 2 Aug 2005 01:13:38 -0000
Newsgroups
perl.cvs.mod_parrot
Message-ID
<[email protected] >
Author: jhorwitz
Date: Mon Aug 1 18:13:37 2005
New Revision: 187
Added:
mod_parrot/trunk/build/
- copied from r186, mod_parrot/branches/autogen/build/
Modified:
mod_parrot/trunk/CHANGES
mod_parrot/trunk/Configure.pl
mod_parrot/trunk/Makefile.in
mod_parrot/trunk/call_list.txt
mod_parrot/trunk/lib/Apache/Constants.imc
mod_parrot/trunk/lib/Apache/RequestRec.imc
mod_parrot/trunk/lib/ModParrot/init.imc
mod_parrot/trunk/nci.c
mod_parrot/trunk/t/01RequestRec.t
mod_parrot/trunk/t/conf/extra.conf.in
mod_parrot/trunk/t/lib/handlers.imc
Log:
merged with autogen branch (autogen was previously merged with trunk)
Modified: mod_parrot/trunk/CHANGES
==============================================================================
--- mod_parrot/trunk/CHANGES (original)
+++ mod_parrot/trunk/CHANGES Mon Aug 1 18:13:37 2005
@@ -3,6 +3,7 @@ $Id$
0.3-dev
* Support for Parrot 0.2.2 (geeksunite)
* Support new Parrot calling conventions (still backwards compatible)
+ * Autogeneration of request_rec methods
* All Apache hooks are implemented
* The init file is no longer required to be PBC
* Include a very simple mod_pugs proof of concept, with tests
@@ -13,7 +14,7 @@ $Id$
* ModParrot::NCI::backtrace returns a backtrace string
* New APR::Table class
* New Apache::RequestRec methods:
- - notes
+ - notes (returns APR::Table object)
- main
- prev
- next
Modified: mod_parrot/trunk/Configure.pl
==============================================================================
--- mod_parrot/trunk/Configure.pl (original)
+++ mod_parrot/trunk/Configure.pl Mon Aug 1 18:13:37 2005
@@ -52,16 +52,16 @@ print "\n";
my $defines;
print "Determining Parrot calling conventions...";
-my $out = `$parrot_build_dir/parrot cc_test.imc`;
-chomp($out);
-if ($out eq 'new') {
+my $calling_conventions = `$parrot_build_dir/parrot cc_test.imc`;
+chomp($calling_conventions);
+if ($calling_conventions eq 'new') {
$defines = '-DPARROT_NEW_CALL_CONV';
}
else {
- die 'calling convention test failed!' if $out ne 'old';
+ die 'calling convention test failed!' if $calling_conventions ne 'old';
}
-print "$out\n";
+print "$calling_conventions\n";
# where are apache includes?
my $apache_include_dir = `$apxs -q INCLUDEDIR`;
@@ -95,6 +95,7 @@ $template =~ s/\@PERL\@/$perl/g;
$template =~ s/\@PARROT_SOURCE\@/$parrot_build_dir/g;
$template =~ s/\@PARROT\@/$parrot_build_dir\/parrot/g;
$template =~ s/\@APACHE_INCLUDE_DIR\@/$apache_include_dir/g;
+$template =~ s/\@CALLING_CONVENTIONS\@/$calling_conventions/g;
open(MAKEFILE, ">Makefile") or die $!;
print MAKEFILE $template;
close(MAKEFILE);
Modified: mod_parrot/trunk/Makefile.in
==============================================================================
--- mod_parrot/trunk/Makefile.in (original)
+++ mod_parrot/trunk/Makefile.in Mon Aug 1 18:13:37 2005
@@ -10,6 +10,8 @@ PERL=@PERL@
APXS=@APXS@
PARROT_SOURCE=@PARROT_SOURCE@
PARROT=@PARROT@
+APACHE_INCLUDE_DIR=@APACHE_INCLUDE_DIR@
+CALLING_CONVENTIONS=@CALLING_CONVENTIONS@
SOURCE_FILES=mod_parrot.c parrot_util.c modparrot_config.c nci.c context.c
PARROT_OBJS=$(PARROT_SOURCE)/src/parrot_config.o
@@ -20,7 +22,7 @@ MPLIBS= lib/Apache/RequestRec \
lib/ModParrot/HLL/pir \
lib/ModParrot/HLL/pugs
-all: mod_parrot.la
+all: gen-src mod_parrot.la
mod_parrot.la: $(SOURCE_FILES)
$(APXS) -c $(DEFINES) $(CFLAGS) $(LDFLAGS) $(LIBS) $(SOURCE_FILES) $(PARROT_OBJS)
@@ -28,6 +30,7 @@ mod_parrot.la: $(SOURCE_FILES)
files-clean:
rm -f *.o *.lo *.slo *.la core core.*
rm -rf .libs
+ rm -f nci_sig_test
libraries:
@echo Compiling libraries:
@@ -37,6 +40,13 @@ libraries:
$(PARROT) -o $$i.pbc $$i.imc; \
done
+gen-src:
+ @echo Generating Source...
+ perl build/lib/generate_source.pl --apache-include-dir=$(APACHE_INCLUDE_DIR) --calling-conventions=$(CALLING_CONVENTIONS)
+
+gen-src-clean:
+ rm -rf build/src
+
libraries-clean:
for i in $(MPLIBS); \
do \
@@ -48,7 +58,7 @@ test-clean:
t/conf/extra.conf t/conf/apache_test_config.pm t/TEST \
t/htdocs/index.html t/core.* nci_sig_test
-clean: files-clean libraries-clean
+clean: files-clean libraries-clean gen-src-clean test-clean
distclean: clean test-clean
rm -f Makefile Makefile.old
Modified: mod_parrot/trunk/call_list.txt
==============================================================================
--- mod_parrot/trunk/call_list.txt (original)
+++ mod_parrot/trunk/call_list.txt Mon Aug 1 18:13:37 2005
@@ -15,3 +15,5 @@ i Jpi
i JPip
v ptt
v pit
+i Jpii
+i ip
Modified: mod_parrot/trunk/lib/Apache/Constants.imc
==============================================================================
--- mod_parrot/trunk/lib/Apache/Constants.imc (original)
+++ mod_parrot/trunk/lib/Apache/Constants.imc Mon Aug 1 18:13:37 2005
@@ -43,79 +43,8 @@ Jeff Horwitz
.namespace [ 'Apache::Constants' ]
+.include 'build/src/imc/ap_constants.imc'
+
.sub _initialize @LOAD
_init_const_table( )
.end
-
-.sub _init_const_table
- .local pmc ap_constants
-
- ap_constants = new .OrderedHash
-
- # Handler responses
- ap_constants[ "OK" ] = 0
- ap_constants[ "DECLINED" ] = -1
- ap_constants[ "DONE" ] = -2
-
- # HTTP Response Codes
- ap_constants[ "HTTP_CONTINUE" ] = 100
- ap_constants[ "HTTP_SWITCHING_PROTOCOLS" ] = 101
- ap_constants[ "HTTP_PROCESSING" ] = 102
- ap_constants[ "HTTP_OK" ] = 200
- ap_constants[ "HTTP_CREATED" ] = 201
- ap_constants[ "HTTP_ACCEPTED" ] = 202
- ap_constants[ "HTTP_NON_AUTHORITATIVE" ] = 203
- ap_constants[ "HTTP_NO_CONTENT" ] = 204
- ap_constants[ "HTTP_RESET_CONTENT" ] = 205
- ap_constants[ "HTTP_PARTIAL_CONTENT" ] = 206
- ap_constants[ "HTTP_MULTI_STATUS" ] = 207
- ap_constants[ "HTTP_MULTIPLE_CHOICES" ] = 300
- ap_constants[ "HTTP_MOVED_PERMANENTLY" ] = 301
- ap_constants[ "HTTP_MOVED_TEMPORARILY" ] = 302
- ap_constants[ "HTTP_SEE_OTHER" ] = 303
- ap_constants[ "HTTP_NOT_MODIFIED" ] = 304
- ap_constants[ "HTTP_USE_PROXY" ] = 305
- ap_constants[ "HTTP_TEMPORARY_REDIRECT" ] = 307
- ap_constants[ "HTTP_BAD_REQUEST" ] = 400
- ap_constants[ "HTTP_UNAUTHORIZED" ] = 401
- ap_constants[ "HTTP_PAYMENT_REQUIRED" ] = 402
- ap_constants[ "HTTP_FORBIDDEN" ] = 403
- ap_constants[ "HTTP_NOT_FOUND" ] = 404
- ap_constants[ "HTTP_METHOD_NOT_ALLOWED" ] = 405
- ap_constants[ "HTTP_NOT_ACCEPTABLE" ] = 406
- ap_constants[ "HTTP_PROXY_AUTHENTICATION_REQUIRED" ] = 407
- ap_constants[ "HTTP_REQUEST_TIME_OUT" ] = 408
- ap_constants[ "HTTP_CONFLICT" ] = 409
- ap_constants[ "HTTP_GONE" ] = 410
- ap_constants[ "HTTP_LENGTH_REQUIRED" ] = 411
- ap_constants[ "HTTP_PRECONDITION_FAILED" ] = 412
- ap_constants[ "HTTP_REQUEST_ENTITY_TOO_LARGE" ] = 413
- ap_constants[ "HTTP_REQUEST_URI_TOO_LARGE" ] = 414
- ap_constants[ "HTTP_UNSUPPORTED_MEDIA_TYPE" ] = 415
- ap_constants[ "HTTP_RANGE_NOT_SATISFIABLE" ] = 416
- ap_constants[ "HTTP_EXPECTATION_FAILED" ] = 417
- ap_constants[ "HTTP_UNPROCESSABLE_ENTITY" ] = 422
- ap_constants[ "HTTP_LOCKED" ] = 423
- ap_constants[ "HTTP_FAILED_DEPENDENCY" ] = 424
- ap_constants[ "HTTP_UPGRADE_REQUIRED" ] = 426
- ap_constants[ "HTTP_INTERNAL_SERVER_ERROR" ] = 500
- ap_constants[ "HTTP_NOT_IMPLEMENTED" ] = 501
- ap_constants[ "HTTP_BAD_GATEWAY" ] = 502
- ap_constants[ "HTTP_SERVICE_UNAVAILABLE" ] = 503
- ap_constants[ "HTTP_GATEWAY_TIME_OUT" ] = 504
- ap_constants[ "HTTP_VERSION_NOT_SUPPORTED" ] = 505
- ap_constants[ "HTTP_VARIANT_ALSO_VARIES" ] = 506
- ap_constants[ "HTTP_INSUFFICIENT_STORAGE" ] = 507
- ap_constants[ "HTTP_NOT_EXTENDED" ] = 510
-
- # Log severity
- ap_constants[ "APLOG_EMERG"] = 0
- ap_constants[ "APLOG_ALERT"] = 1
- ap_constants[ "APLOG_CRIT"] = 2
- ap_constants[ "APLOG_ERR"] = 3
- ap_constants[ "APLOG_WARNING"] = 4
- ap_constants[ "APLOG_NOTICE"] = 5
- ap_constants[ "APLOG_INFO"] = 6
- ap_constants[ "APLOG_DEBUG"] = 7
- store_global 'Apache::Constants', 'ap_constants', ap_constants
-.end
Modified: mod_parrot/trunk/lib/Apache/RequestRec.imc
==============================================================================
--- mod_parrot/trunk/lib/Apache/RequestRec.imc (original)
+++ mod_parrot/trunk/lib/Apache/RequestRec.imc Mon Aug 1 18:13:37 2005
@@ -55,6 +55,9 @@ class, but is in no way tied to mod_perl
dlfunc func, nul, "ap_rputs", "itp"
store_global "Apache::NCI", "ap_rputs", func
+ dlfunc func, nul, "ap_rputc", "iip"
+ store_global "Apache::NCI", "ap_rputc", func
+
dlfunc func, nul, "ap_log_rerror", "vtiiiptt"
store_global "Apache::NCI", "ap_log_rerror", func
@@ -91,6 +94,8 @@ SETUP_R:
setattribute self, offset, r
.end
+.include 'build/src/imc/request_rec.imc'
+
=item C<puts(STRING str)>
=over 4
@@ -113,63 +118,61 @@ Outputs a string into the HTTP content.
ap_rputs( data, r )
.end
-=item C<INT write(pmc, size)>
+=item C<putc(INT int)>
=over 4
-Writes data from a PMC of size C<size> into the HTTP content. Returns the
-number of bytes written.
-
-THIS METHOD IS EXPERIMENTAL!
+Outputs an int into the HTTP content. No return value.
=back
=cut
-.sub write method
- .param pmc data
+.sub putc method
+ .param int data
.param int size
.local pmc r
- .local pmc ap_rwrite
+ .local pmc ap_rputc
.local int offset
- .local int bytes
classoffset offset, self, 'Apache::RequestRec'
getattribute r, self, offset
- find_global ap_rwrite, 'ModParrot::NCI', 'rwrite'
- bytes = ap_rwrite( data, size, r )
+ find_global ap_rputc, 'Apache::NCI', 'ap_rputc'
+ ap_rputc( data, r )
- .pcc_begin_return
- .return bytes
- .pcc_end_return
+ # Hack until I get ap_rputc to work.
+ #$S0 = data
+ #puts( $S0 )
.end
-=item C<STRING args([STRING a])>
+=item C<INT write(pmc, size)>
=over 4
-Get or set the raw HTTP query string for the current request. There is
-currently no conversion performed for HTML entities (e.g. %20 == C<space>),
-and there is no argument splitting on ampersands (C<&>).
+Writes data from a PMC of size C<size> into the HTTP content. Returns the
+number of bytes written.
+
+THIS METHOD IS EXPERIMENTAL!
=back
=cut
-.sub args method
- .param string a
+.sub write method
+ .param pmc data
+ .param int size
.local pmc r
- .local pmc request_rec_args
+ .local pmc ap_rwrite
.local int offset
- .local string args
+ .local int bytes
classoffset offset, self, 'Apache::RequestRec'
getattribute r, self, offset
- find_global request_rec_args, 'ModParrot::NCI', 'request_rec_args'
- args = request_rec_args( r, a )
+ find_global ap_rwrite, 'ModParrot::NCI', 'rwrite'
+ bytes = ap_rwrite( data, size, r )
.pcc_begin_return
- .return args
+ .return bytes
.pcc_end_return
.end
@@ -200,61 +203,6 @@ Get or set the local filename correspond
.pcc_end_return
.end
-=item C<STRING hostname()>
-
-=over 4
-
-Returns the hostname for the current request.
-
-=back
-
-=cut
-
-.sub hostname method
- .local pmc r
- .local pmc request_rec_hostname
- .local int offset
- .local string hostname
-
- classoffset offset, self, 'Apache::RequestRec'
- getattribute r, self, offset
- find_global request_rec_hostname, 'ModParrot::NCI', 'request_rec_hostname'
- hostname = request_rec_hostname( r )
-
- .pcc_begin_return
- .return hostname
- .pcc_end_return
-.end
-
-
-=item C<STRING content_type([STRING type])>
-
-=over 4
-
-If C<type> is omitted, this method will simply return the response's current
-content type. If set, the content type will be changed to C<type>.
-
-=back
-
-=cut
-
-.sub content_type method
- .param string type
- .local pmc r
- .local pmc request_rec_content_type
- .local int offset
- .local string content_type
-
- classoffset offset, self, 'Apache::RequestRec'
- getattribute r, self, offset
- find_global request_rec_content_type, 'ModParrot::NCI', 'request_rec_content_type'
- content_type = request_rec_content_type(r, type )
-
- .pcc_begin_return
- .return content_type
- .pcc_end_return
-.end
-
=item C<log_rerror(STRING file, INT line, INT level, STRING msg)>
=over 4
@@ -284,63 +232,6 @@ message to be written into the error log
ap_log_rerror( file, line, level, 0, r, "%s", msg )
.end
-=item C<STRING user(STRING u)>
-
-=over 4
-
-Get or set the current username. Only valid after calling
-C<get_basic_auth_pw()>.
-
-=back
-
-=cut
-
-.sub user method
- .param string u
- .local pmc r
- .local int offset
- .local pmc request_rec_user
- .local string user
-
- classoffset offset, self, 'Apache::RequestRec'
- getattribute r, self, offset
-
- find_global request_rec_user, 'ModParrot::NCI', 'request_rec_user'
- user = request_rec_user( r, u )
-
- .pcc_begin_return
- .return user
- .pcc_end_return
-.end
-
-=item C<INT status(INT status)>
-
-=over 4
-
-Get or set the current HTTP status.
-
-=back
-
-=cut
-
-.sub status method
- .param int s
- .local pmc r
- .local int offset
- .local pmc request_rec_status
- .local int status
-
- classoffset offset, self, 'Apache::RequestRec'
- getattribute r, self, offset
-
- find_global request_rec_status, 'ModParrot::NCI', 'request_rec_status'
- status = request_rec_status( r, s )
-
- .pcc_begin_return
- .return status
- .pcc_end_return
-.end
-
=item C<(INT, STRING) = get_basic_auth_pw()>
=over 4
@@ -400,79 +291,79 @@ otherwise.
.pcc_end_return
.end
-=item C<STRING auth_type()>
+=item C<STRING auth_name()>
=over 4
-Returns the authentication type for the request (C<AuthType> Apache directive).
+Returns the authentication name for the request (C<AuthName> Apache directive).
=back
=cut
-.sub auth_type method
+.sub auth_name method
.local pmc r
.local int offset
- .local pmc ap_auth_type
+ .local pmc ap_auth_name
classoffset offset, self, 'Apache::RequestRec'
getattribute r, self, offset
- find_global ap_auth_type, 'Apache::NCI', 'ap_auth_type'
- $S0 = ap_auth_type( r )
+ find_global ap_auth_name, 'Apache::NCI', 'ap_auth_name'
+ $S0 = ap_auth_name( r )
.pcc_begin_return
.return $S0
.pcc_end_return
.end
-=item C<STRING auth_name()>
+=item C<note_basic_auth_failure()>
=over 4
-Returns the authentication name for the request (C<AuthName> Apache directive).
-
+Sets headers to request authentication from the client. This method only works
+for basic authentication.
+
=back
=cut
-.sub auth_name method
+.sub note_basic_auth_failure method
.local pmc r
.local int offset
- .local pmc ap_auth_name
+ .local pmc ap_note_basic_auth_failure
classoffset offset, self, 'Apache::RequestRec'
getattribute r, self, offset
- find_global ap_auth_name, 'Apache::NCI', 'ap_auth_name'
- $S0 = ap_auth_name( r )
-
- .pcc_begin_return
- .return $S0
- .pcc_end_return
+ find_global ap_note_basic_auth_failure, 'Apache::NCI', 'ap_note_basic_auth_failure'
+ ap_note_basic_auth_failure( r )
.end
-=item C<note_basic_auth_failure()>
+=item C<STRING auth_type()>
=over 4
-Sets headers to request authentication from the client. This method only works
-for basic authentication.
-
+Returns the authentication type for the request (C<AuthType> Apache directive).
+
=back
=cut
-.sub note_basic_auth_failure method
+.sub auth_type method
.local pmc r
.local int offset
- .local pmc ap_note_basic_auth_failure
+ .local pmc ap_auth_type
classoffset offset, self, 'Apache::RequestRec'
getattribute r, self, offset
- find_global ap_note_basic_auth_failure, 'Apache::NCI', 'ap_note_basic_auth_failure'
- ap_note_basic_auth_failure( r )
+ find_global ap_auth_type, 'Apache::NCI', 'ap_auth_type'
+ $S0 = ap_auth_type( r )
+
+ .pcc_begin_return
+ .return $S0
+ .pcc_end_return
.end
=item C<PMC notes()>
Modified: mod_parrot/trunk/lib/ModParrot/init.imc
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/init.imc (original)
+++ mod_parrot/trunk/lib/ModParrot/init.imc Mon Aug 1 18:13:37 2005
@@ -23,15 +23,14 @@
null nul
+ .include "build/src/imc/request_rec_dlfunc.imc"
+
dlfunc func, nul, "mpnci_backtrace", "tJ"
store_global "ModParrot::NCI", "backtrace", func
dlfunc func, nul, "mpnci_request_rec", "pJ"
store_global "ModParrot::NCI", "request_rec", func
- dlfunc func, nul, "mpnci_request_rec_hostname", "tJp"
- store_global "ModParrot::NCI", "request_rec_hostname", func
-
dlfunc func, nul, "mpnci_request_rec_main", "pJp"
store_global "ModParrot::NCI", "request_rec_main", func
@@ -41,24 +40,12 @@
dlfunc func, nul, "mpnci_request_rec_prev", "pJp"
store_global "ModParrot::NCI", "request_rec_prev", func
- dlfunc func, nul, "mpnci_request_rec_filename", "tJpt"
- store_global "ModParrot::NCI", "request_rec_filename", func
-
- dlfunc func, nul, "mpnci_request_rec_args", "tJpt"
- store_global "ModParrot::NCI", "request_rec_args", func
-
dlfunc func, nul, "mpnci_request_rec_user", "tJpt"
store_global "ModParrot::NCI", "request_rec_user", func
- dlfunc func, nul, "mpnci_request_rec_status", "iJpi"
- store_global "ModParrot::NCI", "request_rec_status", func
-
dlfunc func, nul, "mpnci_request_rec_notes", "pJp"
store_global "ModParrot::NCI", "request_rec_notes", func
- dlfunc func, nul, "mpnci_request_rec_content_type", "tJpt"
- store_global "ModParrot::NCI", "request_rec_content_type", func
-
dlfunc func, nul, "mpnci_request_rec_get_basic_auth_pw", "iJp"
store_global "ModParrot::NCI", "request_rec_get_basic_auth_pw", func
@@ -79,7 +66,6 @@
dlfunc func, nul, "mpnci_server_rec", "pJ"
store_global "ModParrot::NCI", "server_rec", func
-
dlfunc func, nul, "mpnci_conn_rec", "pJ"
store_global "ModParrot::NCI", "conn_rec", func
Modified: mod_parrot/trunk/nci.c
==============================================================================
--- mod_parrot/trunk/nci.c (original)
+++ mod_parrot/trunk/nci.c Mon Aug 1 18:13:37 2005
@@ -30,6 +30,8 @@
#include "mod_parrot.h"
+#include "build/src/nci/request_rec.c"
+
request_rec *mpnci_request_rec(Parrot_Interp interp)
{
modparrot_context *ctxp;
@@ -94,11 +96,6 @@ conn_rec *mpnci_csd(Parrot_Interp interp
return(ctxp->csd);
}
-const char *mpnci_request_rec_hostname(Parrot_Interp interp, request_rec *r)
-{
- return(r->hostname);
-}
-
request_rec *mpnci_request_rec_main(Parrot_Interp interp, request_rec *r)
{
return(r->main);
@@ -114,54 +111,11 @@ request_rec *mpnci_request_rec_prev(Parr
return(r->prev);
}
-char *mpnci_request_rec_filename(Parrot_Interp interp, request_rec *r,
- char *fname)
-{
- if (fname) {
- r->filename = (char *)apr_pstrdup(r->pool, fname);
- }
- return(r->filename);
-}
-
-char *mpnci_request_rec_args(Parrot_Interp interp, request_rec *r, char *args)
-{
- if (args) {
- r->args = (char *)apr_pstrdup(r->pool, args);
- }
- return(r->args);
-}
-
-char *mpnci_request_rec_user(Parrot_Interp interp, request_rec *r, char *user)
-{
- if (user) {
- r->user = (char *)apr_pstrdup(r->pool, user);
- }
- return(r->user);
-}
-
-int mpnci_request_rec_status(Parrot_Interp interp, request_rec *r, int status)
-{
- if (status) {
- r->status = status;
- }
- return(r->status);
-}
-
apr_table_t *mpnci_request_rec_notes(Parrot_Interp interp, request_rec *r)
{
return(r->notes);
}
-const char *mpnci_request_rec_content_type(Parrot_Interp interp, request_rec *r,
- char *t)
-{
- if (t) {
- /* should we allocate from parrot here instead??? */
- r->content_type = (char *)apr_pstrdup(r->pool, t);
- }
- return(r->content_type);
-}
-
/* We implement ap_get_basic_auth_pw as a wrapper because there is no NCI
* signature type that handles the function's char ** password parameter.
* Even 'B', which is "void **", doesn't work. Should investigate further.
Modified: mod_parrot/trunk/t/01RequestRec.t
==============================================================================
--- mod_parrot/trunk/t/01RequestRec.t (original)
+++ mod_parrot/trunk/t/01RequestRec.t Mon Aug 1 18:13:37 2005
@@ -7,7 +7,7 @@ use Test::More;
my $content;
-plan tests => 10, (need_lwp);
+plan tests => 36, (need_lwp);
# Apache::RequestRec->content_type
my $res = GET '/parrot-test/RequestRec-content_type';
@@ -67,3 +67,137 @@ $res = GET '/parrot-test/RequestRec-auth
username => 'joeuser', password => 'password';
chomp($content = $res->content);
is($content, 'Parrot Test', "auth_name == 'Parrot Test'");
+
+# Apache::RequestRec->the_request
+$res = GET '/parrot-test/RequestRec-the_request';
+chomp($content = $res->content);
+is($content, "GET /parrot-test/RequestRec-the_request HTTP/1.0", 'the_request match');
+
+# Apache::RequestRec->protocol
+$res = GET '/parrot-test/RequestRec-protocol';
+chomp($content = $res->content);
+is($content, "HTTP/1.0", 'protocol match');
+
+# Apache::RequestRec->status_line
+$res = GET '/parrot-test/RequestRec-status_line';
+chomp($content = $res->content);
+is($content, "", 'status_line match');
+
+# Apache::RequestRec->range
+$res = GET '/parrot-test/RequestRec-range';
+chomp($content = $res->content);
+is($content, "", 'range match');
+
+# Apache::RequestRec->handler
+$res = GET '/parrot-test/RequestRec-handler';
+chomp($content = $res->content);
+is($content, "parrot-code", 'handler match');
+
+# Apache::RequestRec->content_encoding
+$res = GET '/parrot-test/RequestRec-content_encoding';
+chomp($content = $res->content);
+is($content, "", 'content_encoding match');
+
+# Apache::RequestRec->vlist_validator
+$res = GET '/parrot-test/RequestRec-vlist_validator';
+chomp($content = $res->content);
+is($content, "", 'vlist_validator match');
+
+# Apache::RequestRec->unparsed_uri
+my $uri = '/parrot-test/RequestRec-unparsed_uri?test';
+$res = GET $uri;
+chomp($content = $res->content);
+is($content, $uri, 'unparsed_uri match');
+
+# Apache::RequestRec->uri
+$res = GET '/parrot-test/RequestRec-uri?test';
+chomp($content = $res->content);
+is($content, '/parrot-test/RequestRec-uri', 'uri match');
+
+# Apache::RequestRec->path_info
+$res = GET '/parrot-test/RequestRec-path_info';
+chomp($content = $res->content);
+is($content, '/RequestRec-path_info', 'content match');
+
+TODO: {
+ local $TODO = "Tests need to be written.";
+
+ # Apache::RequestRec->filename
+ $res = GET '/parrot-test/RequestRec-filename';
+ chomp($content = $res->content);
+ is($content, '', 'filename match');
+
+ # Apache::RequestRec->canonical_filename
+ $res = GET '/parrot-test/RequestRec-canonical_filename';
+ chomp($content = $res->content);
+ is($content, '', 'canonical_filename match');
+
+ # Apache::RequestRec->user
+ $res = GET '/parrot-test/RequestRec-user';
+ chomp($content = $res->content);
+ is($content, '', 'user match');
+}
+
+SKIP: {
+ skip "ap_rputc not properly wrapped yet.", 13;
+
+ # Apache::RequestRec->assbackwards
+ $res = GET '/parrot-test/RequestRec-assbackwards';
+ chomp($content = $res->content);
+ is($content, '0', 'assbackwards match');
+
+ # Apache::RequestRec->proxyreq
+ $res = GET '/parrot-test/RequestRec-proxyreq';
+ chomp($content = $res->content);
+ is($content, '0', 'proxyreq match');
+
+ # Apache::RequestRec->header_only
+ $res = GET '/parrot-test/RequestRec-header_only';
+ chomp($content = $res->content);
+ is($content, '0', 'header_only match');
+
+ # Apache::RequestRec->proto_num
+ $res = GET '/parrot-test/RequestRec-proto_num';
+ chomp($content = $res->content);
+ is($content, '1000', 'proto_num match');
+
+ # Apache::RequestRec->method_number
+ $res = GET '/parrot-test/RequestRec-method_number';
+ chomp($content = $res->content);
+ is($content, '0', 'method_number match');
+
+ # Apache::RequestRec->chunked
+ $res = GET '/parrot-test/RequestRec-chunked';
+ chomp($content = $res->content);
+ is($content, '0', 'chunked match');
+
+ # Apache::RequestRec->read_body
+ $res = GET '/parrot-test/RequestRec-read_body';
+ chomp($content = $res->content);
+ is($content, '0', 'read_body match');
+
+ # Apache::RequestRec->read_chunked
+ $res = GET '/parrot-test/RequestRec-read_chunked';
+ chomp($content = $res->content);
+ is($content, '0', 'read_chunked match');
+
+ # Apache::RequestRec->no_cache
+ $res = GET '/parrot-test/RequestRec-no_cache';
+ chomp($content = $res->content);
+ is($content, '0', 'no_cache match');
+
+ # Apache::RequestRec->no_local_copy
+ $res = GET '/parrot-test/RequestRec-no_local_copy';
+ chomp($content = $res->content);
+ is($content, '0', 'no_local_copy match');
+
+ # Apache::RequestRec->used_path_info
+ $res = GET '/parrot-test/RequestRec-used_path_info';
+ chomp($content = $res->content);
+ is($content, '2', 'used_path_info match');
+
+ # Apache::RequestRec->eos_sent
+ $res = GET '/parrot-test/RequestRec-eos_sent';
+ chomp($content = $res->content);
+ is($content, '0', 'eos_sent match');
+}
Modified: mod_parrot/trunk/t/conf/extra.conf.in
==============================================================================
--- mod_parrot/trunk/t/conf/extra.conf.in (original)
+++ mod_parrot/trunk/t/conf/extra.conf.in Mon Aug 1 18:13:37 2005
@@ -109,6 +109,138 @@ ParrotLoad @ServerRoot@/../lib/pugs/Apac
Require valid-user
</Location>
+<Location /parrot-test/RequestRec-the_request>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::the_request
+</Location>
+
+<Location /parrot-test/RequestRec-protocol>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::protocol
+</Location>
+
+<Location /parrot-test/RequestRec-status_line>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::status_line
+</Location>
+
+<Location /parrot-test/RequestRec-range>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::range
+</Location>
+
+<Location /parrot-test/RequestRec-handler>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::handler
+</Location>
+
+<Location /parrot-test/RequestRec-content_encoding>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::content_encoding
+</Location>
+
+<Location /parrot-test/RequestRec-vlist_validator>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::vlist_validator
+</Location>
+
+<Location /parrot-test/RequestRec-unparsed_uri>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::unparsed_uri
+</Location>
+
+<Location /parrot-test/RequestRec-uri>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::uri
+</Location>
+
+<Location /parrot-test/RequestRec-path_info>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::path_info
+</Location>
+
+<Location /parrot-test/RequestRec-assbackwards>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::assbackwards
+</Location>
+
+<Location /parrot-test/RequestRec-proxyreq>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::proxyreq
+</Location>
+
+<Location /parrot-test/RequestRec-header_only>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::header_only
+</Location>
+
+<Location /parrot-test/RequestRec-proto_num>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::proto_num
+</Location>
+
+<Location /parrot-test/RequestRec-method_number>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::method_number
+</Location>
+
+<Location /parrot-test/RequestRec-chunked>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::chunked
+</Location>
+
+<Location /parrot-test/RequestRec-read_body>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::read_body
+</Location>
+
+<Location /parrot-test/RequestRec-read_chunked>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::read_chunked
+</Location>
+
+<Location /parrot-test/RequestRec-no_cache>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::no_cache
+</Location>
+
+<Location /parrot-test/RequestRec-no_local_copy>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::no_local_copy
+</Location>
+
+<Location /parrot-test/RequestRec-used_path_info>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::used_path_info
+</Location>
+
+<Location /parrot-test/RequestRec-eos_sent>
+ SetHandler parrot-code
+ ParrotLanguage PIR
+ ParrotHandler ModParrot::Test::eos_sent
+</Location>
+
<Location /parrot-test/pugs/handler>
SetHandler parrot-code
ParrotLanguage pugs
Modified: mod_parrot/trunk/t/lib/handlers.imc
==============================================================================
--- mod_parrot/trunk/t/lib/handlers.imc (original)
+++ mod_parrot/trunk/t/lib/handlers.imc Mon Aug 1 18:13:37 2005
@@ -243,6 +243,380 @@ authz_done:
.pcc_end_return
.end
+.namespace [ 'ModParrot::Test::the_request' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'the_request'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::protocol' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'protocol'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::status_line' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'status_line'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::range' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'range'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::handler' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'handler'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::content_encoding' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'content_encoding'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::vlist_validator' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'vlist_validator'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::unparsed_uri' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'unparsed_uri'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::uri' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'uri'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::path_info' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $S0 = r.'path_info'( )
+ r.'puts'($S0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::assbackwards' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'assbackwards'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::proxyreq' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'proxyreq'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::header_only' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'header_only'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::proto_num' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'proto_num'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::method_number' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'method_number'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::chunked' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'chunked'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::read_body' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'read_body'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::read_chunked' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'read_chunked'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::no_cache' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'no_cache'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::no_local_copy' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'no_local_copy'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::used_path_info' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'used_path_info'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
+.namespace [ 'ModParrot::Test::eos_sent' ]
+
+.sub _handler
+ .param pmc r
+ .local pmc ap_const
+
+ $I0 = r.'eos_sent'( )
+ r.'putc'($I0)
+
+ ap_const = find_global 'Apache::Constants', 'ap_constants'
+ $I0 = ap_const['OK']
+
+ .pcc_begin_return
+ .return $I0
+ .pcc_end_return
+.end
+
.namespace [ 'ModParrot::Test::notes' ]
.sub _handler