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 Upgrader.NegotiateSubprotocol #606

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AllenX2018
Copy link

Fixes #480 #404

Summary of Changes

1.Add the method NegotiateSubprotocol func (r * http.Request) (string, error) in the upgrade, the user can customize the negotiation sub-protocol.
2. NegotiateSubprotocol has higher priority than Subprotocols.
3.The responseHeader does not support negotiated sub-protocol (Sec-WebSocket-Protocol),If necessary, please use Upgrader.NegotiateSubprotocol and Upgrader.Subprotocols,use the method to view the Upgrader struct.

@IngCr3at1on
Copy link

LGTM; please address conflicts for a final review.

@IngCr3at1on
Copy link

LGTM, someone else must approve/merge.

@garyburd
Copy link
Contributor

This PR breaks applications that specify the negotiated subprotocol using the response header.

@garyburd garyburd changed the title fix-issue-#480 Add Upgrader.NegotiateSubprotocol Dec 19, 2021
@jaitaiwan
Copy link
Member

Thanks for the heads up @garyburd, @IngCr3at1on sorry for the late reply on this PR. Would you be willing to update the PR with Gary's concerns in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Add Upgrader.NegotiateSubprotocols
5 participants