httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Subra Aswathanarayanan" <aswat...@gmail.com>
Subject Re: How to return an error code/page from output filter?
Date Tue, 09 Dec 2008 21:28:34 GMT
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 <john_zzhang@yahoo.com> 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message