-
Notifications
You must be signed in to change notification settings - Fork 1k
FIX: Stream Auth through protocol bug fixed #1463
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
Open
Atlas1225
wants to merge
1
commit into
iii-hq:main
Choose a base branch
from
Atlas1225:slu/streamAuth
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 1505
🏁 Script executed:
# Check the full imports to understand what HeaderMap is being used head -n 30 engine/src/workers/stream/stream.rsRepository: iii-hq/iii
Length of output: 949
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 890
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 559
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 1106
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 147
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 147
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 109
🌐 Web query:
axum 0.8 HeaderMap get_all method documentation💡 Result:
In axum 0.8, HeaderMap is re-exported from the http crate (version 1.0+). The get_all method returns a view over all values associated with a given header key without allocations. Signature: pub fn get_all(&self, key: K) -> GetAll<'_, T> where K: AsHeaderName Description: Returns a view of all values associated with a key. The returned GetAll allows iterating the values in insertion order. Returns None if no values are associated with the key. Example: let mut map = HeaderMap::new; map.insert(HOST, "hello".parse.unwrap); map.append(HOST, "goodbye".parse.unwrap); let view = map.get_all("host"); let mut iter = view.iter; assert_eq!(&"hello", iter.next.unwrap); assert_eq!(&"goodbye", iter.next.unwrap); assert!(iter.next.is_none); GetAll provides iter which returns ValueIter<'a, T>, an iterator over &'a T in insertion order. This API is unchanged from previous versions and matches the standard http::header::HeaderMap documentation.
Citations:
🌐 Web query:
HTTP RFC 6455 Sec-WebSocket-Protocol header multiple values repeated header💡 Result:
In RFC 6455 (The WebSocket Protocol), the Sec-WebSocket-Protocol header handles multiple subprotocol values differently for client requests and server responses. For client requests (Sec-WebSocket-Protocol-Client): The ABNF is 1#token, allowing multiple values either as a comma-separated list in a single header (e.g., Sec-WebSocket-Protocol: chat, superchat) or as repeated headers (e.g., Sec-WebSocket-Protocol: chat Sec-WebSocket-Protocol: superchat). This lists subprotocols in order of preference. The server selects at most one from this list. For server responses (Sec-WebSocket-Protocol-Server): The ABNF is token (a single token), so only one value is permitted—exactly one subprotocol selected from the client's list, sent in a single header instance (e.g., Sec-WebSocket-Protocol: chat). Sending multiple values or repeated headers is invalid and causes handshake failure, as confirmed by implementations and docs stating "the server can't send more than one Sec-WebSocket-Protocol header" and "server must return exactly one value". This contrasts with Sec-WebSocket-Extensions, which explicitly allows multiple instances or comma lists for extensions. HTTP/1.1 semantics support repeated headers for list-valued fields, but WebSocket restricts the server response to a single token. No updates in later RFCs (e.g., 7936, 8441) change this behavior.
Citations:
Sec-WebSocket-Protocolheaders h3js/crossws#141🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 642
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 300
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
🏁 Script executed:
Repository: iii-hq/iii
Length of output: 36
Handle all
Sec-WebSocket-Protocolheader instances, not just one.RFC 6455 allows clients to send
Sec-WebSocket-Protocolas either comma-separated values or repeated header instances. The current code usingheaders.get()retrieves only the first header value and will miss theAuthorizationprotocol if it appears in a subsequent repeated header, causing protocol negotiation to fail.Use
headers.get_all()to iterate over all header instances:Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents