Pylons/webob — Issue #30: webob removes CONTENT_LENGTH when setting body_file, which some middleware treats as 0
Author: xavidotron
Created: 2012-02-19 20:30:02+00:00
State: open

I recently ran into an issue using a modified Turbogears 2 setup. BaseRequest.POST sets body_file to a FakeCGIBody, which has the side effect of setting content_length to None, which removes CONTENT_LENGTH from the wsgi environment. The FriendlyFormPlugin uses paste.request's parse_formvars to get POST data, which assumes a missing CONTENT_LENGTH means a CONTENT_LENGTH of 0, and thus never sees any post data.

My quick fix was to set content_length to -1 instead of None, but presumably setting it to the actual length would be better.

Thanks!