dvdotsenko / git_http_backend.py

Port of git's "Smart HTTP" (git-http-backend) server component to Python WSGI interface.
git_http_backend_python_wsgi
GNU Lesser General Public License v2.1
72 stars 15 forks source link

BUG: Content-Length is not set manually #12

Closed dvdotsenko closed 14 years ago

dvdotsenko commented 14 years ago

Neither the Static WSGI code, nor the Git-RPC-specific code set the Content-Length header on the response.

This means that some WSGI servers may set that header incorrectly or omit it altogether, resulting in git client not reading the complete response.

dvdotsenko commented 14 years ago

Per PEP333:

If the application does not supply a Content-Length header, a server or gateway may choose one of several approaches to handling it.

  1. close the client connection when the response is completed.
  2. If the application does not call the write() callable, and returns an iterable whose len() is 1, then the server can automatically determine Content-Length by taking the length of the first string yielded by the iterable.
  3. And, if the server and client both support HTTP/1.1 "chunked encoding", then the server may use chunked encoding to send a chunk for each write() call or string yielded by the iterable, thus generating a Content-Length header for each chunk.

I'd prefer to continue NOT specifying Content-Length manually.