Issue #677 resolved

_cpwsgi requestLine: PATH_INFO SCRIPT_NAME

Anonymous created an issue

When running the wsgiApp out of twisted.wsgi, twisted will set PATH_INFO and SCRIPT_NAME with leading '/'

This causes an infinite redirect loop when accessing "http://localhost"

This also causes the root directory to be placed one level deep. So I can access my root resource only by using "http://localhost/bla/"

when I want to see it at "http://localhost"

This problem can be corrected by adding a line into the requestLine function

resource = resource.replace('//', '/')

I think this is a cherrypy problem because an empty string is equivalant to "/", and because the behavior of cherrypy seems too fragile.

Reported by jrboverhof@lbl.gov

Comments (3)

  1. Robert Brewer

    Yes, it is too fragile, because it's not following the spec which says:

    [script_name] MUST NOT end in a slash. If the script_name refers
    to the root of the URI, it MUST be an empty string (not "/").
    

    I've modified trunk to correctly require/coerce this where needed (see [1671]). This should be backported to 3.0.x, but needs some discussion before backporting to 2.x.

  2. Log in to comment