Trying to fix AB2.5
This commit is contained in:
parent
48a8077723
commit
e29b372604
|
@ -5,9 +5,8 @@ import java.nio.ByteBuffer;
|
|||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.websocket.api.CloseException;
|
||||
import org.eclipse.jetty.websocket.api.MessageTooLargeException;
|
||||
import org.eclipse.jetty.websocket.api.ProtocolException;
|
||||
import org.eclipse.jetty.websocket.api.StatusCode;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketException;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||
import org.eclipse.jetty.websocket.protocol.CloseInfo;
|
||||
|
@ -73,9 +72,18 @@ public class FrameParser
|
|||
if (len > Integer.MAX_VALUE)
|
||||
{
|
||||
// OMG! Sanity Check! DO NOT WANT! Won't anyone think of the memory!
|
||||
throw new CloseException(StatusCode.MESSAGE_TOO_LARGE,"[int-sane!] cannot handle payload lengths larger than " + Integer.MAX_VALUE);
|
||||
throw new MessageTooLargeException("[int-sane!] cannot handle payload lengths larger than " + Integer.MAX_VALUE);
|
||||
}
|
||||
policy.assertValidPayloadLength((int)len);
|
||||
|
||||
if (frame.getOpCode().isControlFrame())
|
||||
{
|
||||
if (payloadLength > WebSocketFrame.MAX_CONTROL_PAYLOAD)
|
||||
{
|
||||
throw new ProtocolException("Invalid Control Frame payload length, [" + payloadLength + "] cannot exceed ["
|
||||
+ WebSocketFrame.MAX_CONTROL_PAYLOAD + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package org.eclipse.jetty.websocket.ab;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jetty.websocket.ByteBufferAssert;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketException;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
||||
import org.eclipse.jetty.websocket.generator.FrameGenerator;
|
||||
import org.eclipse.jetty.websocket.generator.Generator;
|
||||
import org.eclipse.jetty.websocket.parser.FrameParseCapture;
|
||||
import org.eclipse.jetty.websocket.parser.Parser;
|
||||
|
@ -287,13 +289,9 @@ public class TestABCase2
|
|||
public void testParseOversizedBinaryPingCase2_5()
|
||||
{
|
||||
byte[] bytes = new byte[126];
|
||||
Arrays.fill(bytes,(byte)0x00);
|
||||
|
||||
for ( int i = 0 ; i < bytes.length ; ++i )
|
||||
{
|
||||
bytes[i] = 0x00;
|
||||
}
|
||||
|
||||
ByteBuffer expected = ByteBuffer.allocate(bytes.length + 32);
|
||||
ByteBuffer expected = ByteBuffer.allocate(bytes.length + FrameGenerator.OVERHEAD);
|
||||
|
||||
expected.put(new byte[]
|
||||
{ (byte)0x89 });
|
||||
|
|
Loading…
Reference in New Issue