Anonymous avatar Anonymous committed b0f04c2

Added notes on start response.

Comments (0)

Files changed (1)

             def start_latin(status, response_headers, exc_info=None):
 
                 # Reset ok flag, in case this is a repeat call
-                transform_ok[:]=[]  
+                transform_ok[:] = []  
 
                 for name, value in response_headers:
-                    if name.lower()=='content-type' and value=='text/plain':
+                    if name.lower() == 'content-type' and value == 'text/plain':
                         transform_ok.append(True)
                         # 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'
                         ]
                         break
                     
 attributes specified here, or accessed via e.g. the PEP 234 iteration
 APIs are acceptable.
 
+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.
+
 
 ``environ`` Variables
 ---------------------
             
     finally:
         if hasattr(result, 'close'):
-            result.close()    
+            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
+operatuib us beces
 
 
 Updates
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.