On Apr 22, 2010, at 8:40 PM, Mark Nottingham wrote: > I couldn't find any obvious way to set HTTP trailers in Apache 2.x without > taking over all response processing (a la nph). > > Did I miss something?
I started hacking on this at work, but got the point where I can't insert a filter in the right spot. The problem I ran into is that if the Content-Length header is set (which ap_content_length_filter_handle sets), then the chunking filter doesn't kick in. Something about wanting to use sendfile so don't chunk. I can't get a filter inserted after ap_content_length_filter_handle, but before ap_http_header_filter (which adds the chunking filter). My plan was to insert a filter that removes the Content-Length header so the response will be chunked and add another filter after the chunking filter that would search for ASCII_ZERO ASCII_CRLF ASCII_CRLF and insert the trailer data before the last ASCII_CRLF. This was just a proof of concept to see if it would work and output data in the right format. If it all worked my plan was add a trailers hook and call the hook in chunk_filter.c in place of the /* <trailers> */ comment. Brian After typing this up and working through it again, I think I can add a filter AP_FTYPE_TRANSCODE+1 for the after chunking filter and AP_FTYPE_PROTOCOL+1 and get them to be in the right order. Will test that out now.
