From 2c5c3f7db8d0ef4f5bb2696aa33646887dd4dc19 Mon Sep 17 00:00:00 2001 From: UnfamiliarLegacy <74633542+UnfamiliarLegacy@users.noreply.github.com> Date: Wed, 28 Jun 2023 22:59:28 +0200 Subject: [PATCH] Set correct maximum on websocket policy --- .../proxy/nitro/websocket/NitroWebsocketClient.java | 4 ++-- .../proxy/nitro/websocket/NitroWebsocketServer.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketClient.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketClient.java index 8740fd9..190a057 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketClient.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketClient.java @@ -72,8 +72,8 @@ public class NitroWebsocketClient implements NitroSession { }); activeSession = (JsrSession) session; - activeSession.setMaxBinaryMessageBufferSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); - activeSession.setMaxTextMessageBufferSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); + activeSession.getPolicy().setMaxBinaryMessageSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); + activeSession.getPolicy().setMaxTextMessageSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); // Set proper headers to spoof being a real client. final Map> headers = new HashMap<>(activeSession.getUpgradeRequest().getHeaders()); diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketServer.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketServer.java index 1177fa8..93305ae 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketServer.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/websocket/NitroWebsocketServer.java @@ -188,8 +188,8 @@ public class NitroWebsocketServer implements WebSocketListener, NitroSession { private WebSocketClient createWebSocketClient() { final WebSocketClient client = new WebSocketClient(createHttpClient()); - client.setMaxBinaryMessageBufferSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); - client.setMaxTextMessageBufferSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); + client.getPolicy().setMaxBinaryMessageSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); + client.getPolicy().setMaxTextMessageSize(NitroConstants.WEBSOCKET_BUFFER_SIZE); return client; }