Issue #1284 new

wsgiserver2.py breaks on URI paths which contain ://

Eric Higgins
created an issue

I have a web application that acts as a proxy to fetch remote resources. To keep things lightweight, the remote URL is sent as the path of my web application. Example (not actually my domain):

http://some-proxy-thing.com/http://www.google.com/

There appears to be a bug in CherryPy's wsgiserver2.py (around here) that causes paths like this to blow up. This block of code looks like a good use case for urlparse.

Note: I don't use CherryPy directly, but it's been added to the Google App Engine SDK as part of dev_appserver2. As such, we have no real way to fix or patch this bug. We are able to use the old dev_appserver.py for now, though.

Comments (4)

  1. Eric Higgins reporter

    Certainly. Here's the traceback (with our local usernames/paths altered):

    ValueError('need more than 1 value to unpack',)
    Traceback (most recent call last):
      File "/src/gae-1.8.8/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1292, in communicate
    req.parse_request()
      File "/src/gae-1.8.8/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 580, in parse_request
        success = self.read_request_line()
      File "/src/gae-1.8.8/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 643, in read_request_line
        scheme, authority, path = self.parse_request_uri(uri)
      File "/src/gae-1.8.8/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 805, in parse_request_uri
        authority, path = remainder.split(FORWARD_SLASH, 1)
    ValueError: need more than 1 value to unpack
    

    To debug this, I had to modify wsgiserver2.py and and use PDB. on the line I linked you to, the value of the uri variable was /http://www.google.com/, which leads me to believe that it's just being given the path instead of the full URL.

  2. Log in to comment