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

Changeset 1836

Show
Ignore:
Timestamp:
01/12/08 17:13:17
Author:
fumanchu
Message:

Fix for #763 (Exception when parsing Content-Type).

Files:

Legend:

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

    r1786 r1836  
    5050    function will return the list [(3, 7)]. 
    5151     
    52     If this function return an empty list, you should return HTTP 416. 
     52    If this function returns an empty list, you should return HTTP 416. 
    5353    """ 
    5454     
     
    113113        # Split the element into a value and parameters. The 'value' may 
    114114        # be of the form, "token=token", but we don't split that here. 
    115         atoms = [x.strip() for x in elementstr.split(";")
     115        atoms = [x.strip() for x in elementstr.split(";") if x.strip()
    116116        initial_value = atoms.pop(0).strip() 
    117117        params = {} 
  • trunk/cherrypy/test/test_core.py

    r1789 r1836  
    846846                        "en-gb;q=0.8\n" 
    847847                        "en;q=0.7") 
     848         
     849        # Test malformed header parsing. See http://www.cherrypy.org/ticket/763. 
     850        self.getPage("/headerelements/get_elements?headername=Content-Type", 
     851                     # Note the illegal trailing ";" 
     852                     headers=[('Content-Type', 'text/html; charset=utf-8;')]) 
     853        self.assertStatus(200) 
     854        self.assertBody("text/html;charset=utf-8") 
    848855     
    849856    def testHeaders(self): 
     
    890897                     headers=[("Content-type", "application/json")]) 
    891898        self.assertBody("application/json") 
    892          
     899     
    893900    def testHTTPMethods(self): 
    894901        helper.webtest.methods_with_bodies = ("POST", "PUT", "PROPFIND") 

Hosted by WebFaction

Log in as guest/cpguest to create tickets