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

Add a note on how root_path should be used #230

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions specs/www.rst
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@ with the close code passed in the message (or 1000 if none is specified).
spec. Optional; if missing defaults to ``1000``.


Path, raw_path and root_path
----------------------------

The ``raw_path`` is the path component of the request target, which is
then decoded and unquoted to form an initial path. The ``root_path``
(defaults to ``""``) prefix is removed from the initial path to create
the ``path``. If this isn't possible, or the ``path`` does not start
with a ``/`` the server must respond with a 404 response. For example,

Request target root_path 404? path
============== ========= ==== ========
/foo/bar "" No /foo/bar
/foo/bar /foo No /bar
/foo/bar /bar Yes
/foo/bar /foo/bar Yes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure this is the right logic...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/foo/bar should succeed and the path would be / (since it would be empty then have a leading slash prepended).

/foo/bar/ /foo/bar No /

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add an example of requesting /foobar with root_path="/foo" to show that it will 404.



WSGI Compatibility
------------------

Expand Down