httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Zhang <john_zzh...@yahoo.com>
Subject How to return an error code/page from output filter?
Date Tue, 09 Dec 2008 21:25:09 GMT
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
View raw message