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

Clarify raw_path Definition for WebSockets Protocol in the Specification #468

Open
raptium opened this issue Sep 17, 2024 · 3 comments
Open

Comments

@raptium
Copy link
Contributor

raptium commented Sep 17, 2024

The definition of raw_path in the ASGI specification differs slightly between HTTP and WebSockets protocols.

  • HTTP: The specification explicitly states that the query string is excluded from raw_path.

asgiref/specs/www.rst

Lines 107 to 110 in b7aaa79

* ``raw_path`` (*byte string*) -- The original HTTP path component,
excluding any query string, unmodified from the bytes that were
received by the web server. Some web server implementations may
be unable to provide this. Optional; if missing defaults to ``None``.

  • WebSockets: The specification does not mention whether the query string should be included or excluded from raw_path.

asgiref/specs/www.rst

Lines 318 to 321 in b7aaa79

* ``raw_path`` (*byte string*) -- The original HTTP path component
unmodified from the bytes that were received by the web server. Some
web server implementations may be unable to provide this. Optional;
if missing defaults to ``None``.

To ensure clarity and consistency, it would be beneficial to explicitly define the behavior of raw_path for WebSockets:

  1. If the query string should be excluded: The specification should use the same wording as in the HTTP section to avoid ambiguity.
  2. If the query string should be included: This should be explicitly stated, along with any rationale for the differing behavior.

Given the potential for confusion, it would be helpful to clarify this in the specification.

@Kludex
Copy link
Contributor

Kludex commented Sep 23, 2024

Yeah, having this difference looks a bit weird. Do you remember if it was intentional? @andrewgodwin

@andrewgodwin
Copy link
Member

I do not believe that was intentional - my guess is that we specifically clarified it for standard HTTP but not for WebSocket. I would say we should update the WebSocket side to say that it also excludes the query string.

@Kludex
Copy link
Contributor

Kludex commented Sep 29, 2024

@raptium Would you like to send a PR here?

andrewgodwin pushed a commit that referenced this issue Oct 18, 2024
Discussed in #468, `raw_path` of WebSocket is updated for clarification.
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

3 participants