Author: jhorwitz
Date: Wed Jul 20 08:16:38 2005
New Revision: 171
Modified:
mod_parrot/trunk/CHANGES
mod_parrot/trunk/call_list.txt
mod_parrot/trunk/lib/Apache/RequestRec.imc
mod_parrot/trunk/lib/ModParrot/init.imc
mod_parrot/trunk/nci.c
Log:
implement Apache::RequstRec methods: main, next, prev and status
Modified: mod_parrot/trunk/CHANGES
==============================================================================
--- mod_parrot/trunk/CHANGES (original)
+++ mod_parrot/trunk/CHANGES Wed Jul 20 08:16:38 2005
@@ -10,9 +10,14 @@ $Id$
* Parrot*Handler takes an optional language specifier
* Use parrot-config.imc to fetch parrot configuration
* Configure.pl no longer requires Apache::Test
- * New APR::Table class
- * New Apache::RequestRec notes method
* ModParrot::NCI::backtrace returns a backtrace string
+ * New APR::Table class
+ * New Apache::RequestRec methods:
+ - notes
+ - main
+ - prev
+ - next
+ - status
0.2 March 28, 2004
* Formal support for Parrot 0.1.2 "Phoenix"
Modified: mod_parrot/trunk/call_list.txt
==============================================================================
--- mod_parrot/trunk/call_list.txt (original)
+++ mod_parrot/trunk/call_list.txt Wed Jul 20 08:16:38 2005
@@ -11,5 +11,6 @@ t Jp
p Jp
t Jpt
i Jp
+i Jpi
i JPip
t ptt
Modified: mod_parrot/trunk/lib/Apache/RequestRec.imc
==============================================================================
--- mod_parrot/trunk/lib/Apache/RequestRec.imc (original)
+++ mod_parrot/trunk/lib/Apache/RequestRec.imc Wed Jul 20 08:16:38 2005
@@ -72,12 +72,18 @@ class, but is in no way tied to mod_perl
.end
.sub __init method
+ .param pmc new_r
.local pmc request_rec
.local pmc r
.local int offset
+ isnull new_r, GET_R
+ r = new_r
+ goto SETUP_R
+GET_R:
find_global request_rec, 'ModParrot::NCI', 'request_rec'
r = request_rec( )
+SETUP_R:
classoffset offset, self, 'Apache::RequestRec'
setattribute self, offset, r
.end
@@ -206,12 +212,12 @@ Returns the hostname for the current req
.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
@@ -286,7 +292,6 @@ C<get_basic_auth_pw()>.
=cut
-# should have a way to set username here as well
.sub user method
.param string u
.local pmc r
@@ -305,6 +310,34 @@ C<get_basic_auth_pw()>.
.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
@@ -470,6 +503,89 @@ Returns the request's notes table as an
.pcc_end_return
.end
+=item C<PMC main()>
+
+=over 4
+
+Returns the the main request at the top of the chain.
+
+=back
+
+=cut
+
+.sub main method
+ .local pmc r
+ .local pmc main_r
+ .local pmc request_rec_main
+ .local int offset
+
+ classoffset offset, self, 'Apache::RequestRec'
+ getattribute r, self, offset
+
+ find_global request_rec_main, 'ModParrot::NCI', 'request_rec_main'
+ main_r = request_rec_main( r )
+
+ .pcc_begin_return
+ .return main_r
+ .pcc_end_return
+.end
+
+=item C<PMC next()>
+
+=over 4
+
+Returns the the redirected request if this is an external redirect.
+
+=back
+
+=cut
+
+.sub next method
+ .local pmc r
+ .local pmc next_r
+ .local pmc request_rec_next
+ .local int offset
+
+ classoffset offset, self, 'Apache::RequestRec'
+ getattribute r, self, offset
+
+ find_global request_rec_next, 'ModParrot::NCI', 'request_rec_next'
+ next_r = request_rec_next( r )
+
+ .pcc_begin_return
+ .return next_r
+ .pcc_end_return
+.end
+
+=item C<PMC prev()>
+
+=over 4
+
+Returns the the previous request if this is an internal redirect.
+
+=back
+
+=cut
+
+.sub prev method
+ .local pmc r
+ .local pmc prev_r
+ .local pmc request_rec_prev
+ .local int offset
+
+ classoffset offset, self, 'Apache::RequestRec'
+ getattribute r, self, offset
+
+ find_global request_rec_prev, 'ModParrot::NCI', 'request_rec_prev'
+ $P0 = request_rec_prev( r )
+ $I0 = find_type 'Apache::RequestRec'
+ prev_r = new $I0, $P0
+
+ .pcc_begin_return
+ .return prev_r
+ .pcc_end_return
+.end
+
=back
=head1 AUTHOR
Modified: mod_parrot/trunk/lib/ModParrot/init.imc
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/init.imc (original)
+++ mod_parrot/trunk/lib/ModParrot/init.imc Wed Jul 20 08:16:38 2005
@@ -32,6 +32,15 @@
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
+
+ dlfunc func, nul, "mpnci_request_rec_next", "pJp"
+ store_global "ModParrot::NCI", "request_rec_next", func
+
+ 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
@@ -41,6 +50,9 @@
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
Modified: mod_parrot/trunk/nci.c
==============================================================================
--- mod_parrot/trunk/nci.c (original)
+++ mod_parrot/trunk/nci.c Wed Jul 20 08:16:38 2005
@@ -99,6 +99,21 @@ const char *mpnci_request_rec_hostname(P
return(r->hostname);
}
+request_rec *mpnci_request_rec_main(Parrot_Interp interp, request_rec *r)
+{
+ return(r->main);
+}
+
+request_rec *mpnci_request_rec_next(Parrot_Interp interp, request_rec *r)
+{
+ return(r->next);
+}
+
+request_rec *mpnci_request_rec_prev(Parrot_Interp interp, request_rec *r)
+{
+ return(r->prev);
+}
+
char *mpnci_request_rec_filename(Parrot_Interp interp, request_rec *r,
char *fname)
{
@@ -124,6 +139,14 @@ char *mpnci_request_rec_user(Parrot_Inte
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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.