Hello,

After installing a website running perfectly locally with the embedded http server I ran into problems when the server was running behind apache + scgi.

I've investigated the problem, and found that there was a problem in web.py at the place where the mod_scgi repair is done. The problem is caused when the request URI is quoted. If this is the case the "mod_scgi PATH_INFO repair code" will not work, because the SCRIPT_NAME and the REQUEST_URI are different because the REQUEST_URI is quoted and SCRIPT_NAME is not. I fixed the problem by unquoting the REQUEST_URI before comparing it with the SCRIPT_NAME like this:

from qp.hub.web, SCGIHandler.handle_connection

request_uri = unquote(env.get('REQUEST_URI'))
if (env.get('SCRIPT_NAME') and
    env.get('SCRIPT_NAME') == request_uri and
    env.get('SCRIPT_NAME').startswith(self.script_name) and
    env.get('PATH_INFO') is None):
    # This looks like it is coming through mod_scgi and
    # needs repair.
    env['PATH_INFO'] = env['SCRIPT_NAME'][len(self.script_name):]
    env['SCRIPT_NAME'] = self.script_name
    assert env['SCRIPT_NAME'] + env['PATH_INFO'] == request_uri


I was surprised by this because quixote + apache + scgi works with quoted urls. After checking the quixote's mod_scgi path info repair code I realized the check was much less strict.

Anyhow, I hope this fix will reach the qp package some day.

Regards,

Maas-Maarten Zeeman

_______________________________________________
QP mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/qp

Reply via email to