New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to url_prefix yields wrong PATH_INFO #46

Closed
t-8ch opened this Issue Nov 14, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@t-8ch

t-8ch commented Nov 14, 2013

If the origin request path is exactly the same as the url_prefix the
resulting PATH_INFO equals the SCRIPT_NAME whereas it should be the empty string.

Example:

$ URL_PREFIX=/foo # imagine, waitress using this
$ curl localhost/foo
SCRIPT_NAME=/foo
PATH_INFO=/foo

PEP-333, the WSGI-specification says this:

PATH_INFO
    The remainder of the request URL's "path", designating the virtual "location" of the request's target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash.

Testcase:

def test_get_environ_with_url_prefix_empty_path(self):
    inst = self._makeOne()
    inst.channel.server.adj.url_prefix = '/foo'
    request = DummyParser()
    request.path = '/foo'
    inst.request = request
    environ = inst.get_environment()
    self.assertEqual(environ['PATH_INFO'], '')
    self.assertEqual(environ['SCRIPT_NAME'], '/foo')

I think the testcase collides with test_get_environment_path_empty.
But I think this test case is invalid, as a request with an empty path would
not be valid HTTP.

@mcdonc mcdonc closed this in 735adb0 Nov 21, 2013

@mcdonc

This comment has been minimized.

Show comment
Hide comment
@mcdonc

mcdonc Nov 21, 2013

Member

Thank you! I've fixed this in master.

Member

mcdonc commented Nov 21, 2013

Thank you! I've fixed this in master.

@mcdonc

This comment has been minimized.

Show comment
Hide comment
@mcdonc

mcdonc Nov 30, 2013

Member

Waitress 0.8.8 is out with this fix.

Member

mcdonc commented Nov 30, 2013

Waitress 0.8.8 is out with this fix.

@t-8ch

This comment has been minimized.

Show comment
Hide comment
@t-8ch

t-8ch Nov 30, 2013

Many thanks for the fast fix and also waitress in general!

t-8ch commented Nov 30, 2013

Many thanks for the fast fix and also waitress in general!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment