[Web-SIG] WSGI 2.0

Clark C. Evans cce at clarkevans.com
Fri Apr 6 23:48:14 CEST 2007


On Fri, Apr 06, 2007 at 12:08:17PM +1000, Graham Dumpleton wrote:
| On 03/04/07, Clark C. Evans <cce at clarkevans.com> wrote:
| >On Fri, Mar 30, 2007 at 11:10:17AM +1000, Graham Dumpleton wrote:
| >| One other issue if aiming at supporting chunked encoding for a request,
| >| is how (if one even can) make available the trailing headers if present
| >| after the final null data block. Personally I am not sure this one is
| >| worth the trouble and may be quite hard to even implement with some web
| >| servers as they don't even provide them as a separate set of headers but
| >| simply merge them on top of the main request headers.
| >
| >In my particular application it'd be quite helpful if I could return
| >Chunked-Body responses (especially ones with additional trailing
| >headers). Since WSGI rules the use of transfer encodings, then it should
| >have a mechanism to request this sort of behavior aka, yield a "flush"
| >object that has optional trailing headers that should be included in the
| >chunk that is returned.
| 
| Do you know of any actual web servers that provide a facility for
| sending trailers after the final null chunk in a response? Apache for
| one doesn't provide a way of doing this

I'm starting to add support for 14.46 "Warning" headers [1] to my server
application and custom client.  Often times a warning might happen
*after* the 200 has been sent; buffering isn't an option unfortunately.
So, I need to find a way to send this additional information to the
client.  Most headers are kinda senseless as trailing headers, but this
one is particularly useful.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46

| Note the comment that step 2, sending of trailers doesn't yet exist.

Sounds like Apache isn't a fully-compliant webserver ;)

| So even if WSGI had a way of supplying trailers, I doubt there would
| be many WSGI adapters for web servers that could actually implement
| it.

This doesn't mean our API shouldn't support it.  It's a valid need
and when I get time, I'd like to find a way to update paste's 
httpserver to support this sort of thing.

| FWIW, in mod_wsgi I have now added a directive which allows one to
| enable within a specific context that chunked transfer encoding should
| be used for a response when a HTTP/1.1 client is being used. 

That's great ;)

| At this stage is probably better than nothing given that WSGI doesn't
| provide a way of enabling it.

In your implementation, how would I indicate where the chunk boundaries
should be?  Or is this just a fixed size thing?

Best,

Clark


More information about the Web-SIG mailing list