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

Function selectDeflate

accept.go:278–294  ·  view source on GitHub ↗
(extensions []websocketExtension, mode CompressionMode)

Source from the content-addressed store, hash-verified

276}
277
278func selectDeflate(extensions []websocketExtension, mode CompressionMode) (*compressionOptions, bool) {
279 if mode == CompressionDisabled {
280 return nil, false
281 }
282 for _, ext := range extensions {
283 switch ext.name {
284 // We used to implement x-webkit-deflate-frame too for Safari but Safari has bugs...
285 // See https://github.com/nhooyr/websocket/issues/218
286 case "permessage-deflate":
287 copts, ok := acceptDeflate(ext, mode)
288 if ok {
289 return copts, true
290 }
291 }
292 }
293 return nil, false
294}
295
296func acceptDeflate(ext websocketExtension, mode CompressionMode) (*compressionOptions, bool) {
297 copts := mode.opts()

Callers 2

acceptFunction · 0.85
Test_selectDeflateFunction · 0.85

Calls 1

acceptDeflateFunction · 0.85

Tested by 1

Test_selectDeflateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…