You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Aryeh Katz <ar...@secured-services.com> on 2003/08/06 21:37:48 UTC
ap_run_sub_req problem
In certain circumstances, I need to do an internal redirect on the client's
request (without sending back a redirect to the client).
I tried using ap_sub_req_method_uri (specifying NULL for the filter), and then
ap_run_sub_req.
I see that the content type of the new request is correct (in my case,
image/gif). However, when the request is sent to the client, the content type
is text/plain. Thus, the reply to the client doesn't render properly.
I suspect I am not invoking ap_run_sub_req properly.
Is there something I should know about how to invoke run_sub_req?
Thanks.
Aryeh
---
Aryeh Katz
Secured-Services Inc.
Re: ap_run_sub_req problem
Posted by "William A. Rowe, Jr." <wr...@apache.org>.
Aryeh, please take a look at mod_negotiation for an example of where we
look at several subrequests, choose a best-match based on mime headers,
and then promote that subrequest to become the real request.
Bill
At 09:22 AM 8/8/2003, Aryeh Katz wrote:
>Bill,
>I was wondering if the following in the filter documentation is a doc bug based
>on your comments below:
>
>"The second case for sub-requests is when one sub-request is going to
>become the real request. This happens whenever a sub-request is created
>outside of a handler or filter, and NULL is passed as the next filter to the
>make_sub_request function."
>
>This seems to imply that it is possible to pass a NULL for the filter, and still
>have it become the real request (which I assume is done in a method similar
>to run_sub_req).
>Can you shed some light on this please?
>Thanks.
>Aryeh
>
>
>> The NULL argument for the filter is *ONLY* to be used for testing
>> subrequests that are not actually run to the client. E.g.
>> mod_autoindex uses the NULL arg to consider what files might be
>> served, and if they are, in fact, actually valid content files, or if
>> they have been protected or otherwise cannot be handled.
>>
>> You must pass the appropriate filter arg in order to pass the response
>> through the filter stack back to the client.
>>
>> Look, instead, at mod_include.c or another module that actually serves
>> the subrequest, for an example of the appropriate way to use this API.
>>
>> Bill
>>
>> At 02:37 PM 8/6/2003, Aryeh Katz wrote:
>> >In certain circumstances, I need to do an internal redirect on the
>> >client's request (without sending back a redirect to the client). I
>> >tried using ap_sub_req_method_uri (specifying NULL for the filter),
>> >and then ap_run_sub_req. I see that the content type of the new
>> >request is correct (in my case, image/gif). However, when the request
>> >is sent to the client, the content type is text/plain. Thus, the
>> >reply to the client doesn't render properly. I suspect I am not
>> >invoking ap_run_sub_req properly. Is there something I should know
>> >about how to invoke run_sub_req? Thanks. Aryeh
>> >
>> >---
>> >Aryeh Katz
>> >Secured-Services Inc.
>>
>
>
>---
>Aryeh Katz
>Secured-Services Inc.
Re: ap_run_sub_req problem
Posted by Aryeh Katz <ar...@secured-services.com>.
Bill,
I was wondering if the following in the filter documentation is a doc bug based
on your comments below:
"The second case for sub-requests is when one sub-request is going to
become the real request. This happens whenever a sub-request is created
outside of a handler or filter, and NULL is passed as the next filter to the
make_sub_request function."
This seems to imply that it is possible to pass a NULL for the filter, and still
have it become the real request (which I assume is done in a method similar
to run_sub_req).
Can you shed some light on this please?
Thanks.
Aryeh
> The NULL argument for the filter is *ONLY* to be used for testing
> subrequests that are not actually run to the client. E.g.
> mod_autoindex uses the NULL arg to consider what files might be
> served, and if they are, in fact, actually valid content files, or if
> they have been protected or otherwise cannot be handled.
>
> You must pass the appropriate filter arg in order to pass the response
> through the filter stack back to the client.
>
> Look, instead, at mod_include.c or another module that actually serves
> the subrequest, for an example of the appropriate way to use this API.
>
> Bill
>
> At 02:37 PM 8/6/2003, Aryeh Katz wrote:
> >In certain circumstances, I need to do an internal redirect on the
> >client's request (without sending back a redirect to the client). I
> >tried using ap_sub_req_method_uri (specifying NULL for the filter),
> >and then ap_run_sub_req. I see that the content type of the new
> >request is correct (in my case, image/gif). However, when the request
> >is sent to the client, the content type is text/plain. Thus, the
> >reply to the client doesn't render properly. I suspect I am not
> >invoking ap_run_sub_req properly. Is there something I should know
> >about how to invoke run_sub_req? Thanks. Aryeh
> >
> >---
> >Aryeh Katz
> >Secured-Services Inc.
>
---
Aryeh Katz
Secured-Services Inc.
Re: ap_run_sub_req problem
Posted by Aryeh Katz <ar...@secured-services.com>.
> The NULL argument for the filter is *ONLY* to be used for testing
> subrequests that are not actually run to the client. E.g.
> mod_autoindex uses the NULL arg to consider what files might be
> served, and if they are, in fact, actually valid content files, or if
> they have been protected or otherwise cannot be handled.
>
> You must pass the appropriate filter arg in order to pass the response
> through the filter stack back to the client.
>
Thanks for the heads up.
Aryeh
> Look, instead, at mod_include.c or another module that actually serves
> the subrequest, for an example of the appropriate way to use this API.
>
> Bill
>
> At 02:37 PM 8/6/2003, Aryeh Katz wrote:
> >In certain circumstances, I need to do an internal redirect on the
> >client's request (without sending back a redirect to the client). I
> >tried using ap_sub_req_method_uri (specifying NULL for the filter),
> >and then ap_run_sub_req. I see that the content type of the new
> >request is correct (in my case, image/gif). However, when the request
> >is sent to the client, the content type is text/plain. Thus, the
> >reply to the client doesn't render properly. I suspect I am not
> >invoking ap_run_sub_req properly. Is there something I should know
> >about how to invoke run_sub_req? Thanks. Aryeh
> >
> >---
> >Aryeh Katz
> >Secured-Services Inc.
>
---
Aryeh Katz
Secured-Services Inc.
Re: ap_run_sub_req problem
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
The NULL argument for the filter is *ONLY* to be used for testing subrequests
that are not actually run to the client. E.g. mod_autoindex uses the NULL arg
to consider what files might be served, and if they are, in fact, actually valid
content files, or if they have been protected or otherwise cannot be handled.
You must pass the appropriate filter arg in order to pass the response through
the filter stack back to the client.
Look, instead, at mod_include.c or another module that actually serves the
subrequest, for an example of the appropriate way to use this API.
Bill
At 02:37 PM 8/6/2003, Aryeh Katz wrote:
>In certain circumstances, I need to do an internal redirect on the client's
>request (without sending back a redirect to the client).
>I tried using ap_sub_req_method_uri (specifying NULL for the filter), and then
>ap_run_sub_req.
>I see that the content type of the new request is correct (in my case,
>image/gif). However, when the request is sent to the client, the content type
>is text/plain. Thus, the reply to the client doesn't render properly.
>I suspect I am not invoking ap_run_sub_req properly.
>Is there something I should know about how to invoke run_sub_req?
>Thanks.
>Aryeh
>
>---
>Aryeh Katz
>Secured-Services Inc.