Unverified Commit 22e0fd0a authored by Dave Cridland's avatar Dave Cridland Committed by GitHub

Merge pull request #911 from surevine/of1423

OF-1423 Honour configuration for message size
parents 4cdab6a2 1b459b50
...@@ -27,6 +27,7 @@ import org.jivesoftware.openfire.SessionManager; ...@@ -27,6 +27,7 @@ import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.session.ClientSession; import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.session.LocalSession; import org.jivesoftware.openfire.session.LocalSession;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -66,6 +67,9 @@ public class OpenfireWebSocketServlet extends WebSocketServlet { ...@@ -66,6 +67,9 @@ public class OpenfireWebSocketServlet extends WebSocketServlet {
if (XmppWebSocket.isCompressionEnabled()) { if (XmppWebSocket.isCompressionEnabled()) {
factory.getExtensionFactory().register("permessage-deflate", PerMessageDeflateExtension.class); factory.getExtensionFactory().register("permessage-deflate", PerMessageDeflateExtension.class);
} }
final int messageSize = JiveGlobals.getIntProperty("xmpp.parser.buffer.size", 1048576);
factory.getPolicy().setMaxTextMessageBufferSize(messageSize * 5);
factory.getPolicy().setMaxTextMessageSize(messageSize);
factory.setCreator(new WebSocketCreator() { factory.setCreator(new WebSocketCreator() {
@Override @Override
public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment