You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <bi...@wstoddard.com> on 2003/03/03 17:36:56 UTC

Sending error responses to the client

I see two ways for the server to send an error response to the client.

First way:
- set r->status
- call ap_send_error_response()
(see protocol.c for an example)

Second way:
- call ap_bucket_error_create(r->status)
- send the error bucket along with an EOS down the output filter stack

Which is the preferred way and why? Seems we should be able to pick one 
way and use it consistently.

Bill


Re: Sending error responses to the client

Posted by Bill Stoddard <bi...@wstoddard.com>.
William A. Rowe, Jr. wrote:
> Filters must use 'the second way'.
> 
> Early hooks (before ap_run_handler()) must use 'the first way'.

Why?  I have a filter using the first way and it appears to work. I can 
dig in the code as well as anyone so don't go to a lot of effort, just 
trying to save some time by mining the knowledge base on list :-)

Thanks,
Bill

> 
> I guess handlers do as they will. 
> 
> Bill
> 
> At 10:36 AM 3/3/2003, Bill Stoddard wrote:
> 
>>I see two ways for the server to send an error response to the client.
>>
>>First way:
>>- set r->status
>>- call ap_send_error_response()
>>(see protocol.c for an example)
>>
>>Second way:
>>- call ap_bucket_error_create(r->status)
>>- send the error bucket along with an EOS down the output filter stack
>>
>>Which is the preferred way and why? Seems we should be able to pick one way and use it consistently.
>>
>>Bill
>>
> 
> 
> 



Re: Sending error responses to the client

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Filters must use 'the second way'.

Early hooks (before ap_run_handler()) must use 'the first way'.

I guess handlers do as they will. 

Bill

At 10:36 AM 3/3/2003, Bill Stoddard wrote:
>I see two ways for the server to send an error response to the client.
>
>First way:
>- set r->status
>- call ap_send_error_response()
>(see protocol.c for an example)
>
>Second way:
>- call ap_bucket_error_create(r->status)
>- send the error bucket along with an EOS down the output filter stack
>
>Which is the preferred way and why? Seems we should be able to pick one way and use it consistently.
>
>Bill
>