bug in line ~ 669

Andreas Briese avatarAndreas Briese created an issue

Error TypeError('expected string or buffer',)

Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/cherrypy/wsgiserver/", line 1297, in communicate


File "/usr/local/lib/python2.7/dist-packages/cherrypy/wsgiserver/", line 585, in parse_request

success = self.read_request_line()

File "/usr/local/lib/python2.7/dist-packages/cherrypy/wsgiserver/", line 669, in read_request_line

atoms = [unquote(x) for x in quoted_slash.split(path)]

TypeError: expected string or buffer

Request: get:/:b",m\x04s\x99\xd9@8_\x9f":i4,"_":h"Content-Length"="10":h"Date"="Sat, 09 Nov 2013 17:32:07 GMT"

line ~ 145
--> #quoted_slash = re.compile(ntob("(?i)%2F"))
quoted_slash = ntob("%2F")

line ~ 669
        # Unquote the path+params (e.g. "/this%20path" -> "/this path").
        # But note that "...a URI must be separated into its components
        # before the escaped characters within those components can be
        # safely decoded.", sec 2.4.2
        # Therefore, "/this%2Fpath" becomes "/this%2Fpath", not "/this/path".
-->            #atoms = [unquote(x) for x in quoted_slash.split(path)]
corr:   atoms = [unquote(x) for x in path.split(quoted_slash)]
        except ValueError:
            ex = sys.exc_info()[1]
            self.simple_response("400 Bad Request", ex.args[0])
            return False
-->  #path = "%2F".join(atoms)
        path = quoted_slash.join(atoms) # <-- corrected
        self.path = path

see difffile upload for Issue 1271 & 1272

Comments (2)

  1. Log in to comment
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
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.