mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 01:06:50 +00:00
Make per-message deflate extension for websockets configurable
This commit is contained in:
1 parent
827d8388d0
commit
1bba30a81e
2 files changed
+17
-1
No files matched your search
@@ -63,6 +63,8 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
|
||||
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
|
||||
import org.glassfish.jersey.server.ServerProperties;
|
||||
import org.signal.i18n.HeaderControlledResourceBundleLookup;
|
||||
@@ -1165,7 +1167,13 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
webSocketEnvironment.jersey().property(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE);
|
||||
provisioningEnvironment.jersey().property(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE);
|
||||
|
||||
JettyWebSocketServletContainerInitializer.configure(environment.getApplicationContext(), null);
|
||||
JettyWebSocketServletContainerInitializer.configure(environment.getApplicationContext(), (context, container) -> {
|
||||
if (config.getWebSocketConfiguration().isDisablePerMessageDeflate()) {
|
||||
WebSocketComponents components =
|
||||
WebSocketServerComponents.getWebSocketComponents(environment.getApplicationContext().getServletContext());
|
||||
components.getExtensionRegistry().unregister("permessage-deflate");
|
||||
}
|
||||
});
|
||||
|
||||
WebSocketResourceProviderFactory<AuthenticatedDevice> webSocketServlet = new WebSocketResourceProviderFactory<>(
|
||||
webSocketEnvironment, AuthenticatedDevice.class, config.getWebSocketConfiguration(),
|
||||
|
||||
+8
@@ -28,6 +28,10 @@ public class WebSocketConfiguration {
|
||||
@JsonProperty
|
||||
private int maxTextMessageSize = 512 * 1024;
|
||||
|
||||
@Valid
|
||||
@JsonProperty
|
||||
private boolean disablePerMessageDeflate = false;
|
||||
|
||||
public WebsocketRequestLoggerFactory getRequestLog() {
|
||||
return requestLog;
|
||||
}
|
||||
@@ -39,4 +43,8 @@ public class WebSocketConfiguration {
|
||||
public int getMaxTextMessageSize() {
|
||||
return maxTextMessageSize;
|
||||
}
|
||||
|
||||
public boolean isDisablePerMessageDeflate() {
|
||||
return disablePerMessageDeflate;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user