On 4/23/2010 10:25 AM, Brian J. France wrote: > > On Apr 23, 2010, at 10:08 AM, William A. Rowe Jr. wrote: > >> On 4/23/2010 9:03 AM, Brian J. France wrote: >>> >>> You can build a module that is able to insert a trailer by adding a filter >>> and ap_hook_create_request call. >> >> But doesn't this defeat the purpose of using a modular server >> architecture? It seems this should be a facility of the core HTTP >> filter, if anyone wants to offer the patch for 2.3. > > > I agree, my module was more of a proof of concept that I can do it and then > get some other server to able able to use it.
:) > Not sure what the best solution would be because multiple things need to > happen. First part is you have to force chunk encoding either by removing > content_length filter or tweaking the code to not add it if doing a trailer > (which you might not know until it is time to insert a tailer). Well, you also have to insert the 'Trailers' header, which must be known at the beginning of the request, so that becomes a simple trigger for dropping the content-length and forcing chunked encoding. "If no Trailer header field is present, the trailer SHOULD NOT include any header fields" is a very explicit statement :) This could be constructed from r->trailers_out, however users need to understand that after the beginning of the response, r->trailers out cannot be extended, only modified. > Then you have to tweak modules/http/chunk_filter.c to allow others to insert > a trailer, like adding a ap_hook_http_trailer or a optional function for > inserting it. I don't know if multiple modules should be allowed to add a > trailer, if you do how to you join them since a trailer is nothing but a > string ending with ASCII_CRLF (just strcat?). Should we just grab > r->notes['http_trailer'] and let modules just add/set/append values? > > I think there is a bigger design discussion that should happen, but I might > have a patch down the road as a starter if all goes well at work. These pieces seem more like implementation details.
