(subprotos []string, resp *http.Response)
| 268 | } |
| 269 | |
| 270 | func 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 | |
| 285 | func verifyServerExtensions(copts *compressionOptions, h http.Header) (*compressionOptions, error) { |
| 286 | exts := websocketExtensions(h) |
no outgoing calls
no test coverage detected
searching dependent graphs…