[issue16679] Add advice about non-ASCII wsgiref PATH_INFO
Graham Dumpleton
report at bugs.python.org
Thu Apr 21 01:16:09 EDT 2016
Graham Dumpleton added the comment:
What I get in Apache for:
http://127.0.0.1:8000/a=тест
in Safari browser is:
'REQUEST_URI': '/a=%D1%82%D0%B5%D1%81%D1%82',
'PATH_INFO': '/a=\xc3\x91\\x82\xc3\x90\xc2\xb5\xc3\x91\\x81\xc3\x91\\x82',
Where as for curl see:
'REQUEST_URI': '/a=\xc3\x91\\x82\xc3\x90\xc2\xb5\xc3\x91\\x81\xc3\x91\\x82',
'PATH_INFO': '/a=\xc3\x91\\x82\xc3\x90\xc2\xb5\xc3\x91\\x81\xc3\x91\\x82',
For:
http://127.0.0.1:8000/?a=тест
in Safari get:
'REQUEST_URI': '/?a=%D1%82%D0%B5%D1%81%D1%82',
'PATH_INFO': '/'
'QUERY_STRING': 'a=%D1%82%D0%B5%D1%81%D1%82',
and curl:
'REQUEST_URI': '/?a=\xc3\x91\\x82\xc3\x90\xc2\xb5\xc3\x91\\x81\xc3\x91\\x82',
'PATH_INFO': '/',
'QUERY_STRING': 'a=\xc3\x91\\x82\xc3\x90\xc2\xb5\xc3\x91\\x81\xc3\x91\\x82',
So yes curl sends as bytes rather than encoded, expected that.
Gunicorn on:
http://127.0.0.1:8000/a=тест
sees for Safari:
'PATH_INFO': '/a=Ñ\x82еÑ\x81Ñ\x82',
'QUERY_STRING': '',
'RAW_URI': '/a=%D1%82%D0%B5%D1%81%D1%82',
and curl:
'PATH_INFO': '/a=Ã\x91Â\x82Ã\x90µÃ\x91Â\x81Ã\x91Â\x82',
'QUERY_STRING': '',
'RAW_URI': '/a=Ñ\x82еÑ\x81Ñ\x82',
Gunicorn on:
http://127.0.0.1:8000/?a=тест
sees for Safari:
'PATH_INFO': '/',
'QUERY_STRING': 'a=%D1%82%D0%B5%D1%81%D1%82',
'RAW_URI': '/?a=%D1%82%D0%B5%D1%81%D1%82',
and curl:
'PATH_INFO': '/',
'QUERY_STRING': 'a=Ñ\x82еÑ\x81Ñ\x82',
'RAW_URI': '/?a=Ñ\x82еÑ\x81Ñ\x82',
So in Apache I get through UTF-8 byte string as Latin-1. So can see multi byte characters. Gunicorn is doing something different when gets raw bytes from curl. As does wsgiref. Showed Gunicorn as it has RAW_URI which is supposed to be the same as REQUEST_URI in Apache, but actually isn't showing the same there either.
Whatever is happening, mod_wsgi still gives a good outcome.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16679>
_______________________________________
More information about the Python-bugs-list
mailing list