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

Changeset 1363

Show
Ignore:
Timestamp:
09/14/06 12:23:28
Author:
dowski
Message:

Buglet fix in _cpwsgiserver.py.

Content-Type and Content-Length headers and values are only inserted into the wsgi.environ if they are present in the actual request. That way, if those headers were not passed by the UA, then they will not be present in cherrypy.request.headers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpwsgiserver.py

    r1357 r1363  
    217217    def parse_headers(self, headers): 
    218218        environ = {} 
    219         environ["CONTENT_TYPE"] = headers.getheader("Content-type", "") 
    220         environ["CONTENT_LENGTH"] = headers.getheader("Content-length") or "" 
     219        ct = headers.getheader("Content-type", "") 
     220        if ct: 
     221            environ["CONTENT_TYPE"] = ct 
     222        cl = headers.getheader("Content-length") or "" 
     223        if cl: 
     224            environ["CONTENT_LENGTH"] = cl 
    221225         
    222226        # Must use keys() here for Python 2.3 (rfc822.Message had no __iter__). 

Hosted by WebFaction

Log in as guest/cpguest to create tickets