Skip to content
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
Closed

Request to url_prefix yields wrong PATH_INFO #46

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

Comments

@t-8ch
Copy link

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 as completed in 735adb0 Nov 21, 2013
@mcdonc
Copy link
Member

mcdonc commented Nov 21, 2013

Thank you! I've fixed this in master.

@mcdonc
Copy link
Member

mcdonc commented Nov 30, 2013

Waitress 0.8.8 is out with this fix.

@t-8ch
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants