On Sun, May 24, 2009 at 11:53, Toby Collett <tcollett+li...@plan9.net.nz> wrote:
> Hi all,
> I am writing a proxy module that supports a custom extension to the mostly
> unimplemented 'Delta coding' RFC. The original standard uses a 226 http
> status code for its responses to help deal with HTTP 1.0 web caches
> (although this does not completely solve the caching problem).
>
> To be compatible with the delta coding standard I need to be able to set the
> 226 status code on my responses, but I have having trouble working out how I
> would do this in the apache module framework. From what I understand this
> needs to be done during header parsing, as the headers are sent to the
> downstream server before the body is processed, but I have been unable to
> find the right mechanism to do this.

You can do it in your handler without any problem. The output headers
are written out to the socket by ap_http_header_filter. The call to
this filter is triggered by passing the first bucket brigade down the
filter chain. This happens only when you start writing out your
response. All in all, you can set the status in the handler.

It is very important to set r->status_line as well. Apache checks that
the return code appears in the status_line. If it doesn't, it gives
500 internal server error.

r->status = 226;
r->status_line = "HTTP/1.0 226 My custom message";
return 226;

If it doesn't work, try

r->status = 226;
r->status_line = "HTTP/1.0 226 blabla";
return OK;

I do not remember exactly how a colleague of mine did it and I don't
have access to the sources today. I can have a look tomorrow.

S



>
> Regards,
> Toby Collett
>



-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Reply via email to