-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
If an URL path element contains %2F (an escaped "/") Flask.route considers it as an unescaped slash. #900
Comments
Ehm. I just realised that using the |
You can try: |
I have just come across another weird thing: When I use
But this does not:
Note, it's a simple REST service, retrieving information about IP routes. They are written in CIDR notation, which contains a slash. The client sends requests which are properly encoded (with |
I tracked this down to the apache directive AllowEncodedSlashes. Setting it to So, in the end, this problem seems to be twofold... On the one hand, Flask/Wekzeug handles On the other hand, apache httpd refuses encoded slashes by default returning a For now, I have solved my problem with the |
@exhuma The WSGI layer is on the Apache side, so the problem is caused by Apache. |
@Giio, i just tried uwsgi + nginx, from uwsgi's log i can see the path passed from nginx to uwsgi is is |
I opened a pull request to werkzeug that addresses this issue. |
This is a limitation in WSGI and there is nothing I can do about that. |
To get past this for now, I double URL encoded the URL. There's a guide with a few hacks here: http://www.leakon.com/archives/865 |
Not to add more to a long-closed issue, but for what it's worth, Passenger's WSGI implementation does not unescape URL-encoded characters before forwarding it along in |
If you encode once / will be %2F, then the parameter you get in flask is decoded and appears as a / so it look you have an extra parameter in the url. But if you encode three times in javascript and decoding twice in python it will work (it is a workaround but it will fix this issue): in javascript in python |
Here's an example:
When running:
I would expect to see:
Instead I get:
I tested this against Flask 0.9 and Flask 0.10.1. Both had the same error.
While searching for existing bug reports, I came across this: pallets/werkzeug#21
Is this related? If yes, what's the status?
In any case, being a WSGI spec problem or not, this is behaviour is incorrect!
The text was updated successfully, but these errors were encountered: