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

Ticket #790: cp3_no_content_type.patch

  • cherrypy/test/test_core.py

    old new  
    885885                              ("Accept-Charset", "unicode-1-1;q=0.8")]) 
    886886        self.assertBody("iso-8859-5, unicode-1-1;q=0.8") 
    887887         
    888         # If we don't pass a Content-Type header, it should not be present 
    889         # in cherrypy.request.headers 
     888        # If we don't pass a Content-Type header, one will automatically 
     889        # be added, with an empty value (''). 
    890890        self.getPage("/headers/Content-Type", 
    891891                     headers=[]) 
    892         self.assertStatus(500) 
     892        self.assertStatus(200) 
     893        self.assertBody('') 
    893894         
    894895        # If Content-Type is present in the request, it should be present in 
    895896        # cherrypy.request.headers 
  • cherrypy/_cpwsgi.py

    old new  
    208208     
    209209    def get_response(self): 
    210210        """Run self.request and return its response.""" 
     211        # Make sure CONTENT_TYPE exists; give it an empty value 
     212        #   if none has already been defined.  Without this, 
     213        #   _cpcgifs.FieldStorage attempts to parse params out of the 
     214        #   request body when no Content-Type is defined, leading to 
     215        #   undesired behaviour. (This matches CP2 behaviour) 
     216        if not self.environ.has_key('CONTENT_TYPE'): 
     217            self.environ['CONTENT_TYPE'] = '' 
     218         
    211219        meth = self.environ['REQUEST_METHOD'] 
    212220        path = _http.urljoin(self.environ.get('SCRIPT_NAME', ''), 
    213221                             self.environ.get('PATH_INFO', '')) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets