Try this:
apr_status_t my_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
{
   ....
   if (I_should_return_503)
   {
       ap_remove_output_filter(f);
       f->r->status = HTTP_SERVICE_UNAVAILABLE;
       return HTTP_OK;
   }
   ....
}


On Tue, Dec 9, 2008 at 4:25 PM, John Zhang <[EMAIL PROTECTED]> wrote:

> When I encounter certain error conditions in my output filter, I would like
> to return a specific error code/page (eg 503 - service not available).
>  However, the following code results in a 500 beeing returned to the
> browser:
>
> apr_status_t my_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
> {
>    ....
>    if (I_should_return_503)
>    {
>        ap_remove_output_filter(f);
>        // f->r->status = HTTP_SERVICE_UNAVAILABLE;
>        return HTTP_SERVICE_UNAVAILABLE;
>    }
>    ....
> }
>
> In fact, no matter what error code I return, the browser always gets a 500
> error.  Also, if I uncomment the "f->r->..." line, the browser gets an empty
> (200) page.
>
> Any suggestions?
>
> Thanks in advance,
> John
>
>

Reply via email to