Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1521

Show
Ignore:
Timestamp:
12/11/06 15:22:15
Author:
fumanchu
Message:

2.x partial backport of [1406] (Fix for #588 (CherryPyWSGIServer sends Connection: close during 204 and 304 responses)).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-2.x/cherrypy/_cphttptools.py

    r1516 r1521  
    413413            except KeyError: 
    414414                pass 
     415        elif code < 200 or code in (204, 304): 
     416            # "All 1xx (informational), 204 (no content), 
     417            # and 304 (not modified) responses MUST NOT 
     418            # include a message-body." 
     419            self.headers.pop('Content-Length', None) 
     420            self.body = "" 
    415421        else: 
    416422            # Responses which are not streamed should have a Content-Length, 
    417423            # but allow user code to set Content-Length if desired. 
    418             if (self.headers.get('Content-Length') is None 
    419                 and code not in (304,)): 
     424            if self.headers.get('Content-Length') is None: 
    420425                content = self.collapse_body() 
    421426                self.headers['Content-Length'] = len(content) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets