def start_latin(status, response_headers, exc_info=None):
# Reset ok flag, in case this is a repeat call
for name, value in response_headers:
- if name.lower()=='content-type' and value=='text/plain':
+ if name.lower()=='content-type' and value=='text/plain':
# Strip content-length if present, else it'll be wrong
response_headers = [(name, value)
for name, value in response_headers
- if name.lower()!='content-length'
+ if name.lower()!='content-length'
attributes specified here, or accessed via e.g. the PEP 234 iteration
+Notes on ``start_response``
+Due to how ``start_response`` works in this specification it allows
+you to do various things with it that are not obvious. For instance
+the headers are "buffered" in the server until the first chunk of
+data is sent to it in which case it sends the headers to the client.
+This, the ``write`` function it returns and the exception information
+are things that will most likely disappar in future versions of WSGI
+because it complicates things for implementors without a real value.
+You **should** try to avoid depending on these features of the
+specification to simplify porting code in the future.
if hasattr(result, 'close'):
+For this to work the middleware may not consume the iterator from the
+application. Because of this middlewares **should not** process the
+return iterator form the application unless it is sure that the