On Thu, 16 Oct 2014 09:36:19 -0400
"Eric Johanson" <er...@valmarc.com> wrote:

> My output filter hooked function is defined as follows:
>        apr_status_t mts_out_filter(ap_filter_t *f,apr_bucket_brigade *bb)
> 
> I need this function to "do something" that causes the whole request to be
> redirected such that the client sees a 503 error status with no
> body/content.
> 
> Things that I've tried so far:
> * Returning HTTP_SERVICE_UNAVAILABLE from the output filter function after
> calling "ap_pass_brigade(f->next,bb)"

HTTP_SERVICE_UNAVAILABLE isn't an apr_status_t!

> * Setting f->r->status to HTTP_SERVICE_UNAVAILABLE after calling
> "ap_pass_brigade(f->next,bb)"

after ap_pass_brigade, you've already returned a status down the
line to the client.  It's too late to change it!

> * calling "ap_send_error_response(f->r,HTTP_SERVICE_UNAVAILABLE)"

That would have to go through the filter chain.

Filters are supposed to be about your data.  They can in limited
circumstances change metadata (e.g. set a 503), but you'd need
at least to set r->status before the first call to f->next.


-- 
Nick Kew

Reply via email to