Add RAW_URI to environ (as Gunicorn does)#1048
Add RAW_URI to environ (as Gunicorn does)#1048samuelfekete wants to merge 1 commit intopallets:masterfrom
Conversation
|
This seems like a no brainer to me. Otherwise there's simply no way to recover the client's original request URL. |
|
@davidism, consider for example the original url: Any distinction between URL-encoded slashes and actual slashes (or semicolons) are lost. However, these would still be recoverable from This issue has been raised before #797, but closed by @mitsuhiko as changing the behaviour would break backwards compatibility. The change I propose, adding |
|
The entire idea of being able to get a "raw URL" is flawed. If we provide the key developers get the idea that they can depend on that being there. So I prefer not having that. |
|
@mitsuhiko, the key is available in Gunicorn, which we use in production, and we have the requirement that the encoded characters must be allowed in the path, so it would be nice to have it in Werkzeug too, so that we can use it as a development server. |
And this is precisely why I will not add this to Werkzeug. Once that key is there developers start to think this is something they can depend on but you can't. Raw URLs cannot be preserved in many environments. You can monkey patch it in now that you already depend on it but to prevent others from making this mistake in the future I do not want to have this in as a general feature. |
Add the original raw URI to environ, as Gunicorn does.
This provides access to the original request URI, without breaking existing code or standards. Simply using something like request.url wouldn't work if the client included URL-encoded characters like slash, equals, semi-colon or question-mark, as these would be unquoted and then not requoted.
Having the same environ name as in Gunicorn means we can use Gunicorn in production and Werkzeug server for development, and they will both have the same environ variable.
See also:
benoitc/gunicorn#1211 (comment)
#477