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

Function acceptDeflate

accept.go:296–318  ·  view source on GitHub ↗
(ext websocketExtension, mode CompressionMode)

Source from the content-addressed store, hash-verified

294}
295
296func acceptDeflate(ext websocketExtension, mode CompressionMode) (*compressionOptions, bool) {
297 copts := mode.opts()
298 for _, p := range ext.params {
299 switch p {
300 case "client_no_context_takeover":
301 copts.clientNoContextTakeover = true
302 continue
303 case "server_no_context_takeover":
304 copts.serverNoContextTakeover = true
305 continue
306 case "client_max_window_bits",
307 "server_max_window_bits=15":
308 continue
309 }
310
311 if strings.HasPrefix(p, "client_max_window_bits=") {
312 // We can't adjust the deflate window, but decoding with a larger window is acceptable.
313 continue
314 }
315 return nil, false
316 }
317 return copts, true
318}
319
320func headerContainsTokenIgnoreCase(h http.Header, key, token string) bool {
321 for _, t := range headerTokens(h, key) {

Callers 1

selectDeflateFunction · 0.85

Calls 1

optsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…