mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 12:10:30 +00:00
Accept client_no_context_takeover in websockets
Doesn't fix #695, but Good Enough(TM).
This commit is contained in:
parent
d50db8a6f3
commit
227b444d81
@ -28,7 +28,6 @@ import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
|
||||
import io.netty.handler.codec.http.websocketx.WebSocketVersion;
|
||||
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketClientCompressionHandler;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -160,7 +159,7 @@ public class Websocket extends Resource<Websocket>
|
||||
p.addLast(
|
||||
new HttpClientCodec(),
|
||||
new HttpObjectAggregator( 8192 ),
|
||||
WebSocketClientCompressionHandler.INSTANCE,
|
||||
WebsocketCompressionHandler.INSTANCE,
|
||||
new WebsocketHandler( Websocket.this, handshaker, options )
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.core.apis.http.websocket;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.handler.codec.compression.ZlibCodecFactory;
|
||||
import io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler;
|
||||
import io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameClientExtensionHandshaker;
|
||||
import io.netty.handler.codec.http.websocketx.extensions.compression.PerMessageDeflateClientExtensionHandshaker;
|
||||
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketClientCompressionHandler;
|
||||
|
||||
import static io.netty.handler.codec.http.websocketx.extensions.compression.PerMessageDeflateServerExtensionHandshaker.MAX_WINDOW_SIZE;
|
||||
|
||||
/**
|
||||
* An alternative to {@link WebSocketClientCompressionHandler} which supports the {@literal client_no_context_takeover}
|
||||
* extension. Makes CC <em>slightly</em> more flexible.
|
||||
*/
|
||||
@ChannelHandler.Sharable
|
||||
final class WebsocketCompressionHandler extends WebSocketClientExtensionHandler
|
||||
{
|
||||
public static final WebsocketCompressionHandler INSTANCE = new WebsocketCompressionHandler();
|
||||
|
||||
private WebsocketCompressionHandler()
|
||||
{
|
||||
super(
|
||||
new PerMessageDeflateClientExtensionHandshaker(
|
||||
6, ZlibCodecFactory.isSupportingWindowSizeAndMemLevel(), MAX_WINDOW_SIZE,
|
||||
true, false
|
||||
),
|
||||
new DeflateFrameClientExtensionHandshaker( false ),
|
||||
new DeflateFrameClientExtensionHandshaker( true )
|
||||
);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user