MCPcopy
hub / github.com/coder/websocket / verifySubprotocol

Function verifySubprotocol

dial.go:270–283  ·  view source on GitHub ↗
(subprotos []string, resp *http.Response)

Source from the content-addressed store, hash-verified

268}
269
270func verifySubprotocol(subprotos []string, resp *http.Response) error {
271 proto := resp.Header.Get("Sec-WebSocket-Protocol")
272 if proto == "" {
273 return nil
274 }
275
276 for _, sp2 := range subprotos {
277 if strings.EqualFold(sp2, proto) {
278 return nil
279 }
280 }
281
282 return fmt.Errorf("WebSocket protocol violation: unexpected Sec-WebSocket-Protocol from server: %q", proto)
283}
284
285func verifyServerExtensions(copts *compressionOptions, h http.Header) (*compressionOptions, error) {
286 exts := websocketExtensions(h)

Callers 1

verifyServerResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…