You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sumeet Singh <su...@openwave.com> on 2004/04/06 19:25:53 UTC
Internal redirect from an output filter (Apache2.x)
Hi,
I was wondering if invoking an internal-redirect from within an
output filter is legal. I need to do that from my output filter but want
to make sure that it conforms to apache2.0 API before I go ahead and
design/code it.
thanks,
-ss
p.s.
http_header_filter actually does that (indirectly) by invoking
ap_die while processing an error_bucket. ap_die will call
internal-redirect if the corresponding custom error response
(ErrorDocument) is a url.
Re: [apache-modules] Re: Internal redirect from an output filter
(Apache2.x)
Posted by Sumeet Singh <su...@openwave.com>.
André Malo wrote:
>* Sumeet Singh <su...@openwave.com> wrote:
>
>[internal redirects in output filters]
>
>
>
>>Yes, I also find it unsafe. However, note that some standard modules do
>>that too. For example mod_include runs sub-requests from within its
>>output filters. In my opinion this shouldn't be allowed, because with
>>the wrong configuration a web-admin could cause the server to go into
>>recursion. But since mod_include is a standard module, I guess what it
>>does is considered legal.
>>
>>
>
>Subrequests and internal redirects are entirely different things. A subrequest
>can be done from almost everywhere and affects just the data flow (if at all).
>An internal redirect affects the current _control flow_.
>
>nd
>
>
>
I understand how a sub-request is different from an internal-redirect.
However, my point was that of recursion. If you have any light to shed
on the original question I asked (that whether it is legal to invoke
ap_internal_redirect from an output filter) I would really appreciate that.
-rgds,
ss
p.s.
And by the way, I don't agree that sub-requests are *entirely different*
from internal-redirects. For example if you did a subrequest-uri-lookup
followed by a ap_run_sub_req you would still end-up running all the
stages (except post-read-request) and generating data and sending it
down the output filter stack. Same thing is done by internal-redirect.
There are subtle differences like the state of r->main/r->next/r->prev,
filters inherited by the new request, running or not running of
post_read_request and quick-handler stages, but finally both are
recursions. And both the above generate data going down the output
filter stack. After calling ap_internal_redirect you are supposed return
immediately with a OK/DONE, but what if you didn't - then you would
essentially be doing what people do with subrequests.
If you wish to continue this discussion, please start a separate thread.
Re: [apache-modules] Re: Internal redirect from an output filter
(Apache2.x)
Posted by André Malo <nd...@perlig.de>.
* Sumeet Singh <su...@openwave.com> wrote:
[internal redirects in output filters]
> Yes, I also find it unsafe. However, note that some standard modules do
> that too. For example mod_include runs sub-requests from within its
> output filters. In my opinion this shouldn't be allowed, because with
> the wrong configuration a web-admin could cause the server to go into
> recursion. But since mod_include is a standard module, I guess what it
> does is considered legal.
Subrequests and internal redirects are entirely different things. A subrequest
can be done from almost everywhere and affects just the data flow (if at all).
An internal redirect affects the current _control flow_.
nd
Re: [apache-modules] Re: Internal redirect from an output filter
(Apache2.x)
Posted by Sumeet Singh <su...@openwave.com>.
William A. Rowe, Jr. wrote:
>Sumeet Singh wrote:
>
>
>
>>> I was wondering if invoking an internal-redirect from within an output filter is legal. I need to do that from my output filter but want to make sure that it conforms to apache2.0 API before I go ahead and design/code it.
>>>
>>>
>
>I presume this is not safe, but is tolerated by die because we will mop up all
>of the resources very soon thereafter. Note that it is only successful if the
>headers had not been set up in an earlier call to pass brigade that made it
>to the protocol stack. I would look at the log results carefully and trace the
>request to ensure you are satisfied with the processing.
>
>It is certainly not recommended, that does not mean it's not possible.
>
>Bill
>
>
>
Yes, I also find it unsafe. However, note that some standard modules do
that too. For example mod_include runs sub-requests from within its
output filters. In my opinion this shouldn't be allowed, because with
the wrong configuration a web-admin could cause the server to go into
recursion. But since mod_include is a standard module, I guess what it
does is considered legal.
>---------------------------------------------------------------------
>To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
>For additional commands, e-mail: apache-modules-help@covalent.net
>
>
>
>
Re: [apache-modules] Re: Internal redirect from an output filter
(Apache2.x)
Posted by Sumeet Singh <su...@openwave.com>.
William A. Rowe, Jr. wrote:
>Sumeet Singh wrote:
>
>
>
>>> I was wondering if invoking an internal-redirect from within an output filter is legal. I need to do that from my output filter but want to make sure that it conforms to apache2.0 API before I go ahead and design/code it.
>>>
>>>
>
>I presume this is not safe, but is tolerated by die because we will mop up all
>of the resources very soon thereafter. Note that it is only successful if the
>headers had not been set up in an earlier call to pass brigade that made it
>to the protocol stack. I would look at the log results carefully and trace the
>request to ensure you are satisfied with the processing.
>
>It is certainly not recommended, that does not mean it's not possible.
>
>Bill
>
>
>
Yes, I also find it unsafe. However, note that some standard modules do
that too. For example mod_include runs sub-requests from within its
output filters. In my opinion this shouldn't be allowed, because with
the wrong configuration a web-admin could cause the server to go into
recursion. But since mod_include is a standard module, I guess what it
does is considered legal.
>---------------------------------------------------------------------
>To unsubscribe, e-mail: apache-modules-unsubscribe@covalent.net
>For additional commands, e-mail: apache-modules-help@covalent.net
>
>
>
>
Re: Internal redirect from an output filter (Apache2.x)
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Sumeet Singh wrote:
>> I was wondering if invoking an internal-redirect from within an output filter is legal. I need to do that from my output filter but want to make sure that it conforms to apache2.0 API before I go ahead and design/code it.
I presume this is not safe, but is tolerated by die because we will mop up all
of the resources very soon thereafter. Note that it is only successful if the
headers had not been set up in an earlier call to pass brigade that made it
to the protocol stack. I would look at the log results carefully and trace the
request to ensure you are satisfied with the processing.
It is certainly not recommended, that does not mean it's not possible.
Bill
Re: Internal redirect from an output filter (Apache2.x)
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Sumeet Singh wrote:
>> I was wondering if invoking an internal-redirect from within an output filter is legal. I need to do that from my output filter but want to make sure that it conforms to apache2.0 API before I go ahead and design/code it.
I presume this is not safe, but is tolerated by die because we will mop up all
of the resources very soon thereafter. Note that it is only successful if the
headers had not been set up in an earlier call to pass brigade that made it
to the protocol stack. I would look at the log results carefully and trace the
request to ensure you are satisfied with the processing.
It is certainly not recommended, that does not mean it's not possible.
Bill
Re: Internal redirect from an output filter (Apache2.x)
Posted by Sumeet Singh <su...@openwave.com>.
Can anybody help me out here ?
Sumeet Singh wrote:
> Hi,
> I was wondering if invoking an internal-redirect from within an
> output filter is legal. I need to do that from my output filter but
> want to make sure that it conforms to apache2.0 API before I go ahead
> and design/code it.
>
> thanks,
> -ss
> p.s.
> http_header_filter actually does that (indirectly) by invoking
> ap_die while processing an error_bucket. ap_die will call
> internal-redirect if the corresponding custom error response
> (ErrorDocument) is a url.
>
Re: Internal redirect from an output filter (Apache2.x)
Posted by Sumeet Singh <su...@openwave.com>.
Can anybody help me out here ?
Sumeet Singh wrote:
> Hi,
> I was wondering if invoking an internal-redirect from within an
> output filter is legal. I need to do that from my output filter but
> want to make sure that it conforms to apache2.0 API before I go ahead
> and design/code it.
>
> thanks,
> -ss
> p.s.
> http_header_filter actually does that (indirectly) by invoking
> ap_die while processing an error_bucket. ap_die will call
> internal-redirect if the corresponding custom error response
> (ErrorDocument) is a url.
>