-
-
Notifications
You must be signed in to change notification settings - Fork 367
parse_request_uri() incorrectly parses URI which contains :// (patch included) #1386
Copy link
Copy link
Closed
Labels
Description
Originally reported by: yitezhan (Bitbucket: yitezhan, GitHub: yitezhan)
wsgiserver2.py HTTPRequest's parse_request_uri() method has a bug:
If the incoming uri has the "://" mark inside but is not a valid schema, such as "/operation/sch://foo/bar", parse_request_uri() will return scheme, authority, path = ('/operation/sch', 'foo', '/bar'), which is incorrect, and so then the dispatcher fails to find the correct handler. For this case, parse_request_uri() should return (None, None, '/operation/sch://foo/bar')
The current way of deciding the scheme looks sketchy.
i = uri.find('://')It is probably better to use urlparse to parse the uri.
scheme, authority, path, params, query, fragment = urlparse.urlparse(uri)The attached fix solves the issue and does not bring regression. I also modified wsgiserver3.py.
Reactions are currently unavailable