You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eric Covener <co...@gmail.com> on 2012/10/29 02:59:26 UTC

suspendable handlers and internal redirects (mod_dialup vs mod_rewrite)

I was playing with mod_dialup, and for some reason ended up using
mod_rewrite with it and it broke.

The problem is when an asynch handler returns SUSPENDED from an
internal redirect:

* ap_internal_redirect() doesn't know to to skip ap_die()
* ap_internal_redirect() returns void, so the "original" handler who
did the internal redirect can't know to also return suspended.

I fixed the former, and for the latter I put a kludge into
ap_internal_redirect() and mod_rewrite's handler_redirect to pass a
hint via r->notes and it got mod_dialup working.

(Without the second bit, an EOR bucket ends up getting created and
passed from the original handler returning DONE -- between
post-suspend callbacks to mod_dialup!)

Could ap_internal_redirect return a status to accomodate this? Some
return codes would be ambiguous because ap_internal_redirect calls
more than the handler, but checking for SUSPENDED specifically to
propagate it back would be pretty clear.
Or should this be passed back somewhere in the original request_rec
that callers have to check?

-- 
Eric Covener
covener@gmail.com

Re: suspendable handlers and internal redirects (mod_dialup vs mod_rewrite)

Posted by Ruediger Pluem <rp...@apache.org>.

Eric Covener wrote:
> On Sun, Oct 28, 2012 at 9:59 PM, Eric Covener <co...@gmail.com> wrote:
>> I was playing with mod_dialup, and for some reason ended up using
>> mod_rewrite with it and it broke.
>>
>> The problem is when an asynch handler returns SUSPENDED from an
>> internal redirect:
>>
>> * ap_internal_redirect() doesn't know to to skip ap_die()
>> * ap_internal_redirect() returns void, so the "original" handler who
>> did the internal redirect can't know to also return suspended.
>>
>> I fixed the former, and for the latter I put a kludge into
>> ap_internal_redirect() and mod_rewrite's handler_redirect to pass a
>> hint via r->notes and it got mod_dialup working.
>>
>> (Without the second bit, an EOR bucket ends up getting created and
>> passed from the original handler returning DONE -- between
>> post-suspend callbacks to mod_dialup!)
>>
>> Could ap_internal_redirect return a status to accomodate this? Some
>> return codes would be ambiguous because ap_internal_redirect calls
>> more than the handler, but checking for SUSPENDED specifically to
>> propagate it back would be pretty clear.
>> Or should this be passed back somewhere in the original request_rec
>> that callers have to check?
> 
> Is it a minor bump to return a value from ap_internal_redirect() or
> would I need ap_internal_redirect_ex()?

IMHO it requires ap_internal_redirect_ex to be backportable.
Otherwise it is a major bump.

Regards

RĂ¼diger

Re: suspendable handlers and internal redirects (mod_dialup vs mod_rewrite)

Posted by Graham Leggett <mi...@sharp.fm>.
On 02 Nov 2012, at 4:36 AM, Eric Covener <co...@gmail.com> wrote:

> Is it a minor bump to return a value from ap_internal_redirect() or
> would I need ap_internal_redirect_ex()?
> 
> AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);

Would now be an opportunity to split the SUSPENDED result code into two codes for the benefit of async SSL, perhaps SUSPENDED_WANTS_READ and SUSPENDED_WANTS_WRITE?

Regards,
Graham
--


Re: suspendable handlers and internal redirects (mod_dialup vs mod_rewrite)

Posted by Eric Covener <co...@gmail.com>.
On Sun, Oct 28, 2012 at 9:59 PM, Eric Covener <co...@gmail.com> wrote:
> I was playing with mod_dialup, and for some reason ended up using
> mod_rewrite with it and it broke.
>
> The problem is when an asynch handler returns SUSPENDED from an
> internal redirect:
>
> * ap_internal_redirect() doesn't know to to skip ap_die()
> * ap_internal_redirect() returns void, so the "original" handler who
> did the internal redirect can't know to also return suspended.
>
> I fixed the former, and for the latter I put a kludge into
> ap_internal_redirect() and mod_rewrite's handler_redirect to pass a
> hint via r->notes and it got mod_dialup working.
>
> (Without the second bit, an EOR bucket ends up getting created and
> passed from the original handler returning DONE -- between
> post-suspend callbacks to mod_dialup!)
>
> Could ap_internal_redirect return a status to accomodate this? Some
> return codes would be ambiguous because ap_internal_redirect calls
> more than the handler, but checking for SUSPENDED specifically to
> propagate it back would be pretty clear.
> Or should this be passed back somewhere in the original request_rec
> that callers have to check?

Is it a minor bump to return a value from ap_internal_redirect() or
would I need ap_internal_redirect_ex()?

AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);