Write it to a file on the file system, don't use print() to verify the value.

When you use print() the Apache logging system which is processing it will do 
escaping of stuff.

If after writing a to a file you still see an issue, then provide updated 
results.

Graham

> On 23 Dec 2017, at 12:18 am, Sebastian Rittau <[email protected]> wrote:
> 
> Hello,
> 
> I have an issue with a strange, double-encoded PATH_INFO. I use Debian's 
> Apache 2.4.10, mod_wsgi 4.5.24 (pip installed), and Python 2.6.4 (all from my 
> srittau/wsgi-base Docker container) and the following test script:
> 
> def application(env, sr):
>     print(env)
>     sr("200 OK", [])
>     return []
> 
> I get the following (partial) CGI environment when accessing 
> /test.wsgi/foo/bär:
> 
> {
>     'REQUEST_URI': '/test.wsgi/foo/b%C3%A4r',
>     'PATH_INFO': '/foo/b\xc3\x83\xc2\xa4r',
>     'PATH_TRANSLATED': '/app/www-data/foo/b\xc3\x83\xc2\xa4r',
>     'SERVER_SIGNATURE': '<address>Apache/2.4.10 (Debian) Server at localhost 
> Port 8888</address>\\n',
>     'SERVER_SOFTWARE': 'Apache/2.4.10 (Debian)',
>     'mod_wsgi.path_info': '/foo/b\xc3\x83\xc2\xa4r',
>     'apache.version': (2, 4, 10),
>     'mod_wsgi.version': (4, 5, 24),
>     ...
> }
> 
> Here is the apache.conf I am using:
> 
> ServerName localhost  
> AddHandler wsgi-script .wsgi
> 
> <VirtualHost *:80>
>     ServerName test.local
>     DocumentRoot /app/www-data
>     <Directory /app/www-data>
>         Options ExecCGI
>         Require all granted
>     </Directory>
> 
>     ErrorLog ${APACHE_LOG_DIR}/error.log
>     CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
>     WSGIDaemonProcess test.local python-home=/app/virtualenv 
> python-path=/app/pylibs
>     WSGIProcessGroup test.local
> </VirtualHost>
> 
> According to PEP 3333, I'd expect PATH_INFO to equal '/foo/b\xc3\xa4r'. This 
> is also what gunicorn does and werkzeug expects to correctly decode the path.
> 
> Can anyone shed light on this issue?
> 
>  - Sebastian
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to