@@ -240,9 +240,6 @@ func selectDeflate(extensions []websocketExtension, mode CompressionMode) (*comp
240
240
if copts , ok := acceptDeflate (ext , mode ); ok {
241
241
return copts , true
242
242
}
243
- // Disabled for now, see https://github.com/nhooyr/websocket/issues/218
244
- // case "x-webkit-deflate-frame":
245
- // return acceptWebkitDeflate(w, ext, mode)
246
243
}
247
244
}
248
245
return nil , false
@@ -271,40 +268,6 @@ func acceptDeflate(ext websocketExtension, mode CompressionMode) (*compressionOp
271
268
return copts , true
272
269
}
273
270
274
- func acceptWebkitDeflate (w http.ResponseWriter , ext websocketExtension , mode CompressionMode ) (* compressionOptions , error ) {
275
- copts := mode .opts ()
276
- // The peer must explicitly request it.
277
- copts .serverNoContextTakeover = false
278
-
279
- for _ , p := range ext .params {
280
- if p == "no_context_takeover" {
281
- copts .serverNoContextTakeover = true
282
- continue
283
- }
284
-
285
- // We explicitly fail on x-webkit-deflate-frame's max_window_bits parameter instead
286
- // of ignoring it as the draft spec is unclear. It says the server can ignore it
287
- // but the server has no way of signalling to the client it was ignored as the parameters
288
- // are set one way.
289
- // Thus us ignoring it would make the client think we understood it which would cause issues.
290
- // See https://tools.ietf.org/html/draft-tyoshino-hybi-websocket-perframe-deflate-06#section-4.1
291
- //
292
- // Either way, we're only implementing this for webkit which never sends the max_window_bits
293
- // parameter so we don't need to worry about it.
294
- err := fmt .Errorf ("unsupported x-webkit-deflate-frame parameter: %q" , p )
295
- http .Error (w , err .Error (), http .StatusBadRequest )
296
- return nil , err
297
- }
298
-
299
- s := "x-webkit-deflate-frame"
300
- if copts .clientNoContextTakeover {
301
- s += "; no_context_takeover"
302
- }
303
- w .Header ().Set ("Sec-WebSocket-Extensions" , s )
304
-
305
- return copts , nil
306
- }
307
-
308
271
func headerContainsToken (h http.Header , key , token string ) bool {
309
272
token = strings .ToLower (token )
310
273
0 commit comments