﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17187	Incompatibility with Cherokee webserver's FastCGI handling	Samuel Cormier-Iijima	sam@…	"This issue is causing any POST request with zero content-length to throw an error (in flup of all places) when set up as a FastCGI backend to Cherokee.

{{{
Traceback:
File ""/home/sciyoshi/django/django/core/handlers/wsgi.py"" in _get_request
  196.             self._request = datastructures.MergeDict(self.POST, self.GET)
File ""/home/sciyoshi/django/django/core/handlers/wsgi.py"" in _get_post
  210.             self._load_post_and_files()
File ""/home/sciyoshi/django/django/http/__init__.py"" in _load_post_and_files
  289.             self._post, self._files = QueryDict(self.raw_post_data, encoding=self._encoding), MultiValueDict()
File ""/home/sciyoshi/django/django/http/__init__.py"" in _get_raw_post_data
  251.                 self._raw_post_data = self.read()
File ""/home/sciyoshi/django/django/http/__init__.py"" in read
  301.         return self._stream.read(*args, **kwargs)
File ""/home/sciyoshi/env2/local/lib/python2.7/site-packages/flup/server/fcgi_base.py"" in read
  161.                     self._waitForData()
File ""/home/sciyoshi/env2/local/lib/python2.7/site-packages/flup/server/fcgi_base.py"" in _waitForData
  147.         self._conn.process_input()
File ""/home/sciyoshi/env2/local/lib/python2.7/site-packages/flup/server/fcgi_base.py"" in process_input
  711.             self._do_unknown_type(rec)
File ""/home/sciyoshi/env2/local/lib/python2.7/site-packages/flup/server/fcgi_base.py"" in _do_unknown_type
  824.         self.writeRecord(rec)

Exception Type: NameError at /account/
Exception Value: global name 'rec' is not defined
}}}

This issue happens with the combination of flup==1.0.2, cherokee==1.2.101, and django==1.3. I've already submitted a patch to Cherokee which fixes this on their end, but the edge case may still happen with other servers (an extra FCGI record being sent after the PARAMs). There is a simple fix for this in Django as well, so I'm submitting it here for consideration.
"	Bug	closed	HTTP handling	1.3	Normal	needsinfo	cherokee flup fastcgi fcgi content-length uwsgi	sam@… leos@…	Unreviewed	1	0	0	0	0	0
