On Aug 9, 2007, at 1:31 PM, Mario Ruggier wrote:

Quoting David Binger <[EMAIL PROTECTED]>:

Perhaps your web server is providing the correct SCRIPT_NAME,
and the problem is introduced in Publisher.process(), which attempts
to work around a common, similar SCRIPT_NAME/PATH_INFO problem in
a way that would make matters worse for your setup.

This one is Apache/2.0.49 on a Suze linux box. Thanks for pointing me to Publisher.process() (should have read the source code better ;-). Interestingly though, it seems to get it all wrong for the special case here, as when the cgi script is requested without any trailing slash, the incoming env to process
gives:

    # location: '/app.cgi'
    SCRIPT_NAME: ''
    PATH_INFO: '/app.cgi'

Ugh.  I want Apache + app.cgi to provide
SCRIPT_NAME: '/app.cgi'
and
PATH_INFO: ''
In this case.

If you use:
   ScriptAlias /foo <path-to-app.cgi>
do you get the same results?


    # location: '/app.cgi/'
    SCRIPT_NAME: '/app.cgi'
    PATH_INFO: '/'

In your case, I think you could try overriding this method and
changing any empty PATH_INFO to "/" and removing the "if" statement that
appears above.

OK, i tried this instead of what I had on _q_traverse() before:

    def process (self, stdin, env):
        print env.get('SCRIPT_NAME'), ':', env.get('PATH_INFO')
        if env.get('SCRIPT_FILENAME'):
            if not env.get('SCRIPT_NAME'):
if env.get('SCRIPT_FILENAME').endswith(env.get ('PATH_INFO')):
                  # self.redirect(env.get('PATH_INFO') + '/')
                  env['SCRIPT_NAME'] = env.get('PATH_INFO')
                  env['PATH_INFO'] = '/'
        return super(Publisher, self).process(stdin, env)

I think you should not be using SCRIPT_FILENAME at all, since it is not
part of the CGI 1.1 specification.
In your case, it looks like this method could be:

    def process (self, stdin, env):
        if env.get('PATH_INFO') == '':
            env['PATH_INFO'] = env.get('SCRIPT_NAME')
            env['SCRIPT_NAME'] = ''
        hit = Hit(stdin, env)
        self.process_hit(hit)
        return hit

This hack also frustrates me though. The cgi-caller really should provide
a SCRIPT_NAME that makes sense.


Another idea:

Add this to your root directory:
        
        def _q_lookup(self, component):
            redirect('')

Wouldn't this redirect all unknown paths, like '/app.cgi', to '/'?


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

Reply via email to