MCPcopy Index your code
hub / github.com/coder/websocket / selectSubprotocol

Function selectSubprotocol

accept.go:266–276  ·  view source on GitHub ↗
(r *http.Request, subprotocols []string)

Source from the content-addressed store, hash-verified

264}
265
266func selectSubprotocol(r *http.Request, subprotocols []string) string {
267 cps := headerTokens(r.Header, "Sec-WebSocket-Protocol")
268 for _, sp := range subprotocols {
269 for _, cp := range cps {
270 if strings.EqualFold(sp, cp) {
271 return cp
272 }
273 }
274 }
275 return ""
276}
277
278func selectDeflate(extensions []websocketExtension, mode CompressionMode) (*compressionOptions, bool) {
279 if mode == CompressionDisabled {

Callers 2

acceptFunction · 0.85
Test_selectSubprotocolFunction · 0.85

Calls 1

headerTokensFunction · 0.85

Tested by 1

Test_selectSubprotocolFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…