-
-
Notifications
You must be signed in to change notification settings - Fork 368
Path is always set to "/" using unicode wsgi protocol under Python 3 #1350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Original comment by David Eriksson (Bitbucket: softhousedae, GitHub: Unknown): Not fixed in over a year even when there is a patch? :-( Runtime workaround:
|
@gustaebel @twogood could you please confirm that the issue still exists for the latest version of CherryPy? |
@webknjaz For various reasons I'm still stuck on an old version of CherryPy, thanks for reminding me of upgrading. I did try a newer version at some point, but my application broke down, so there will be Work involved... :-) |
I tried the version 8.1.0 of cherrypy but got the following traceback:
With the following patch applied, all seems to work well :-)
|
@gustaebel feel free to send a PR along with tests |
It seems like the use of |
Meant to mention this ticket in 481b6f9, but mistakenly mentioned another. |
Originally reported by: Lars Gustäbel (Bitbucket: gustaebel, GitHub: gustaebel)
I am using a cherrypy server with wsgi_version = ("u", 0) under Python 3, and found a bug in _cherrypy.cptree.Tree.call().
The problematic code is the following:
The unicode environment is converted to bytes (in Python 3) in order to assemble the path from SCRIPT_NAME and PATH_INFO. The problem is that after this conversion all keys are bytes objects, so both env1x.get() calls fail and return the empty string. This in turn leads to httputil.urljoin() returning the empty string which is then replaced by "/" in the script_name() call.
So, whatever url you pass to Tree.call() they all get converted to "/". My solution to this problem is to test for py3k before downgrade_wsgi_ux_to_1x(). A patch is attached.
The text was updated successfully, but these errors were encountered: