django / asgiref

ASGI specification and utilities
https://asgi.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1.47k stars 208 forks source link

Clarify `raw_path` Definition for WebSockets Protocol in the Specification #468

Open raptium opened 1 week ago

raptium commented 1 week ago

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

https://github.com/django/asgiref/blob/b7aaa795fbbea7ca88458279cf8302533d249101/specs/www.rst?#L107-L110

https://github.com/django/asgiref/blob/b7aaa795fbbea7ca88458279cf8302533d249101/specs/www.rst?#L318-L321

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 commented 2 days ago

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

andrewgodwin commented 1 day ago

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.