9 Jan 2008 08:33
Re: WSGI Content-Length issues.
Graham Dumpleton wrote: > Can the group mind provide some clarification on the following please. > > 1. The WSGI specification does not require that a WSGI > adapter provide an EOF indicator if an attempt is made to > read more data from wsgi.input than defined by request > Content-Length. This is not a problem when the Content-Length header is provided in the request, because the application should never read more than <Content-Length> bytes. RFC 2616 says "The presence of a message-body in a request is signaled by the inclusion of a Content-Length or Transfer-Encoding header field in the request's message-headers." If those headers are missing, then the application has to assume there is no message body, and the WSGI gateway is free to dispose of any message body it can detect. I do agree that the handling of chunked request bodies is not ideal; the current wording implies that the gateway must buffer the entire chunked request body until it can calculate the Content-Length, before calling the application object. This pretty much defeats the purpose of chunked encoding. On the other hand, it is a pretty minor issue because chunked request bodies are very rare. > Is though a WSGI adapter required to > explicitly discard any request content which wasn't consumed > or is the WSGI applications responsibility to ensure that all > request content up to the length specified is always consumed?(Continue reading)
RSS Feed