You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Craig Shelley <cr...@microtron.org.uk> on 2003/09/04 21:12:00 UTC
Re: SubRequest in Filter MP2 [QUESTION]
Hello..
Just Forwarding this to the list
> Having no idea as to how the internals of modperl and apache actually
> work, this may seem like a bit of a dumb suggestion.
>
> When doing a subrequest from within a filter, the most ideal situation
> would be to have access to the output from within the same filter.
> I don't know how this would be best done, but one example i can think
of
> would be maybe to be given access to file handle which can be read
from.
> The data from the subrequest can then be processed and incorporated as
> required.
>
> The reason I have ended up fiddling around with subrequests in filters
> is because i was originally writing a few extensions for SSI in MP1.
> My original plan was to create a small library of includable objects
> such as hit counters, fortune generators and photo albums etc
> The idea then was that other people with local access to my server can
> create simple html files that contain SSI directives to include the
> various objects.
>
> It was all going extremely well, until I tried to set a cookie from
> within a subrequest.
> After that, i ran into a whole load of trouble trying to capture the
> output from a subrequest, and ended up turning to mp2
>
> I was wondering if there are any other avenues I should explore in
order
> to set up such a system.
>
> Thank you for spending time on this problem I appreciate it greatly
>
---------
On Thu, 2003-09-04 at 14:21, Geoffrey Young wrote:
see Apache::SSI for mp1 - it does exactly what you are trying to do and
is
subclassable, so you can add your own tags/functionality if you want.
>> After that, i ran into a whole load of trouble trying to capture the
>> output from a subrequest
see recipe 5.7 in the mod_perl developer's cookbook for that, or look at
the
Apache::SSI source, which does it a different way.
--
Craig Shelley <cr...@microtron.org.uk>
Homepage: <http://www.microtron.org.uk>
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
Re: SubRequest in Filter MP2 [QUESTION]
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Craig Shelley wrote:
> Hello again..
>
>
>>On Thu, 2003-09-04 at 14:21, Geoffrey Young wrote:
>>
>>see Apache::SSI for mp1 - it does exactly what you are trying to do
>
> and
>
>>is
>>subclassable, so you can add your own tags/functionality if you want.
>>
>
> That is exactly what I am already doing.
> When using #exec directive I noticed I could not set the headers
> properly.
typically, a subrequest gets its headers from the current request.
if you want to alter them, use $r->headers_in->set, but this is generally
only used to test what-if scenarios: what if the current request had a
cookie, could it access this document?
anyway, if you need that, then you could probably create your own subclass
and override ssi_exec to simply set the incoming headers and then
SUPER::ssi_exec.
or something like that (off the top of my head, anyway ;)
>
>
>>see recipe 5.7 in the mod_perl developer's cookbook for that, or look
>
> at
>
>>the
>>Apache::SSI source, which does it a different way.
>
>
> That is something i have yet to get my hands on!
the book has a simpler example as well, but you should be able to figure out
the important LWP bits from the online code example
http://www.modperlcookbook.org/code/ch05/Cookbook/SubRequestContent.pm
--Geoff
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
Re: SubRequest in Filter MP2 [QUESTION]
Posted by Craig Shelley <cr...@microtron.org.uk>.
Hello again..
>
> On Thu, 2003-09-04 at 14:21, Geoffrey Young wrote:
>
> see Apache::SSI for mp1 - it does exactly what you are trying to do
and
> is
> subclassable, so you can add your own tags/functionality if you want.
>
That is exactly what I am already doing.
When using #exec directive I noticed I could not set the headers
properly.
> see recipe 5.7 in the mod_perl developer's cookbook for that, or look
at
> the
> Apache::SSI source, which does it a different way.
That is something i have yet to get my hands on!
--
Craig Shelley <cr...@microtron.org.uk>
Homepage: <http://www.microtron.org.uk>
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html