httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: [Fwd: Re: Having some issues with subrequests and filters]
Date Tue, 18 Aug 2009 11:56:51 GMT
On Tue, Aug 18, 2009 at 08:38, Michael Spiegle<> wrote:
> Nick Kew wrote:
>> Michael Spiegle wrote:
>>> Hello,
>>> I have a module I am writing which implements a content-generator and
>>> a filter.  If I make a sub-request from within my content-generator,
>>> the filter's (request_rec*)f->r only points to the original request.
>>> How do I access the current sub-request from within my filter?
>> How do you know the subrequest exists at the point where you access
>> it from the filter?
>> Put whatever you need on your module's filter's context.
> I was hoping that when my filter starts receiving data for a subrequest, the
> request_rec* attached to the filter would indicate that it was a subrequest
> via f->r->main not being NULL.  It seems like you can use that logic
> everywhere else, so why not in the filter context?

I use the following code:

request_rec *newreq = ap_sub_req_lookup_uri(url, req, NULL);
ap_filter_t *flt = ap_add_output_filter(FILTER_NAME, NULL, newreq,
// flt->ctx = &flt_ctx;
int ret_code = ap_run_sub_req(newreq);

The filter is

apr_status_t output_filter(ap_filter_t *f, apr_bucket_brigade *bb) {
 // f->r->main is not NULL !

This code works for me.

I hope this helps.


A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

View raw message