Moved http2.parser.ErrorCode to http2.ErrorCodes.

This commit is contained in:
Simone Bordet 2014-08-01 15:03:49 +02:00
parent 168a8f7dbf
commit 67fd213263
22 changed files with 71 additions and 61 deletions

View File

@ -27,13 +27,13 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.HTTP2Connection;
import org.eclipse.jetty.http2.HTTP2FlowControl;
import org.eclipse.jetty.http2.HTTP2Session;
import org.eclipse.jetty.http2.ISession;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.generator.Generator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.http2.parser.PrefaceParser;
import org.eclipse.jetty.io.ByteBufferPool;
@ -98,7 +98,7 @@ public class HTTP2Client extends ContainerLifeCycle
private void closeConnections()
{
for (ISession session : sessions)
session.close(ErrorCode.NO_ERROR, null, Callback.Adapter.INSTANCE);
session.close(ErrorCodes.NO_ERROR, null, Callback.Adapter.INSTANCE);
sessions.clear();
}
@ -165,7 +165,7 @@ public class HTTP2Client extends ContainerLifeCycle
{
if (LOG.isDebugEnabled())
LOG.debug("Idle timeout {}ms expired on {}", getEndPoint().getIdleTimeout(), this);
getSession().close(ErrorCode.NO_ERROR, "idle_timeout", closeCallback);
getSession().close(ErrorCodes.NO_ERROR, "idle_timeout", closeCallback);
return false;
}

View File

@ -18,6 +18,7 @@
package org.eclipse.jetty.http2.client;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.FlowControl;
import org.eclipse.jetty.http2.HTTP2Session;
import org.eclipse.jetty.http2.IStream;
@ -25,7 +26,6 @@ import org.eclipse.jetty.http2.api.Stream;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.ResetFrame;
import org.eclipse.jetty.http2.generator.Generator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.Log;
@ -48,7 +48,7 @@ public class HTTP2ClientSession extends HTTP2Session
IStream stream = getStream(streamId);
if (stream == null)
{
ResetFrame reset = new ResetFrame(streamId, ErrorCode.STREAM_CLOSED_ERROR);
ResetFrame reset = new ResetFrame(streamId, ErrorCodes.STREAM_CLOSED_ERROR);
reset(reset, disconnectOnFailure());
}
else

View File

@ -26,13 +26,13 @@ import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.api.Stream;
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.ResetFrame;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FuturePromise;
import org.junit.Assert;
@ -51,7 +51,7 @@ public class StreamResetTest extends AbstractTest
FuturePromise<Stream> promise = new FuturePromise<>();
client.newStream(requestFrame, promise, new Stream.Listener.Adapter());
Stream stream = promise.get(5, TimeUnit.SECONDS);
ResetFrame resetFrame = new ResetFrame(stream.getId(), ErrorCode.CANCEL_STREAM_ERROR);
ResetFrame resetFrame = new ResetFrame(stream.getId(), ErrorCodes.CANCEL_STREAM_ERROR);
stream.getSession().reset(resetFrame, Callback.Adapter.INSTANCE);
// After reset the stream should be gone.
Assert.assertEquals(0, client.getStreams().size());
@ -81,7 +81,7 @@ public class StreamResetTest extends AbstractTest
FuturePromise<Stream> promise = new FuturePromise<>();
client.newStream(requestFrame, promise, new Stream.Listener.Adapter());
Stream stream = promise.get(5, TimeUnit.SECONDS);
ResetFrame resetFrame = new ResetFrame(stream.getId(), ErrorCode.CANCEL_STREAM_ERROR);
ResetFrame resetFrame = new ResetFrame(stream.getId(), ErrorCodes.CANCEL_STREAM_ERROR);
stream.getSession().reset(resetFrame, Callback.Adapter.INSTANCE);
Assert.assertTrue(resetLatch.await(5, TimeUnit.SECONDS));
@ -167,7 +167,7 @@ public class StreamResetTest extends AbstractTest
});
Stream stream2 = promise2.get(5, TimeUnit.SECONDS);
ResetFrame resetFrame = new ResetFrame(stream1.getId(), ErrorCode.CANCEL_STREAM_ERROR);
ResetFrame resetFrame = new ResetFrame(stream1.getId(), ErrorCodes.CANCEL_STREAM_ERROR);
stream1.getSession().reset(resetFrame, Callback.Adapter.INSTANCE);
Assert.assertTrue(serverResetLatch.await(5, TimeUnit.SECONDS));

View File

@ -16,9 +16,9 @@
// ========================================================================
//
package org.eclipse.jetty.http2.parser;
package org.eclipse.jetty.http2;
public interface ErrorCode
public interface ErrorCodes
{
public static final int NO_ERROR = 0;
public static final int PROTOCOL_ERROR = 1;

View File

@ -49,7 +49,6 @@ import org.eclipse.jetty.http2.frames.ResetFrame;
import org.eclipse.jetty.http2.frames.SettingsFrame;
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
import org.eclipse.jetty.http2.generator.Generator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EndPoint;
@ -133,7 +132,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
}
else
{
ResetFrame resetFrame = new ResetFrame(streamId, ErrorCode.STREAM_CLOSED_ERROR);
ResetFrame resetFrame = new ResetFrame(streamId, ErrorCodes.STREAM_CLOSED_ERROR);
reset(resetFrame, disconnectOnFailure());
return false;
}
@ -194,7 +193,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
// Spec: check the max frame size is sane.
if (maxFrameSize < Frame.DEFAULT_MAX_LENGTH || maxFrameSize > Frame.MAX_MAX_LENGTH)
{
onConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_max_frame_size");
onConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_settings_max_frame_size");
return false;
}
generator.setMaxFrameSize(maxFrameSize);
@ -406,7 +405,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
int maxStreams = maxStreamCount;
if (maxStreams >= 0 && currentStreams >= maxStreams)
{
reset(new ResetFrame(streamId, ErrorCode.PROTOCOL_ERROR), disconnectOnFailure());
reset(new ResetFrame(streamId, ErrorCodes.PROTOCOL_ERROR), disconnectOnFailure());
return null;
}
if (streamCount.compareAndSet(currentStreams, currentStreams + 1))
@ -427,7 +426,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
}
else
{
close(ErrorCode.PROTOCOL_ERROR, "duplicate_stream", disconnectOnFailure());
close(ErrorCodes.PROTOCOL_ERROR, "duplicate_stream", disconnectOnFailure());
return null;
}
}
@ -836,7 +835,7 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
{
if (stream != null)
stream.close();
close(ErrorCode.INTERNAL_ERROR, "generator_error", Adapter.INSTANCE);
close(ErrorCodes.INTERNAL_ERROR, "generator_error", Adapter.INSTANCE);
callback.failed(x);
}

View File

@ -29,7 +29,6 @@ import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.ResetFrame;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.io.IdleTimeout;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.Log;
@ -133,7 +132,7 @@ public class HTTP2Stream extends IdleTimeout implements IStream
// avoid that its idle timeout is rescheduled.
close();
session.reset(new ResetFrame(getId(), ErrorCode.CANCEL_STREAM_ERROR), disconnectOnFailure);
session.reset(new ResetFrame(getId(), ErrorCodes.CANCEL_STREAM_ERROR), disconnectOnFailure);
notifyFailure(this, timeout);
}

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
@ -50,7 +51,7 @@ public abstract class BodyParser
protected boolean emptyBody()
{
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_frame");
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_frame");
return false;
}

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.util.BufferUtil;
@ -46,7 +47,7 @@ public class DataBodyParser extends BodyParser
{
if (isPadding())
{
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_data_frame");
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_data_frame");
return false;
}
return onData(BufferUtil.EMPTY_BUFFER, false);
@ -65,7 +66,7 @@ public class DataBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_data_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_data_frame");
}
length = getBodyLength();
if (isPadding())
@ -87,7 +88,7 @@ public class DataBodyParser extends BodyParser
loop = length == 0;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_data_frame_padding");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_data_frame_padding");
}
break;
}

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
public class GoAwayBodyParser extends BodyParser
@ -69,7 +70,7 @@ public class GoAwayBodyParser extends BodyParser
length -= 4;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
}
else
@ -87,7 +88,7 @@ public class GoAwayBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (cursor == 0)
{
@ -95,7 +96,7 @@ public class GoAwayBodyParser extends BodyParser
state = State.ERROR;
if (length == 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
}
break;
@ -109,7 +110,7 @@ public class GoAwayBodyParser extends BodyParser
length -= 4;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (length == 0)
{
@ -131,7 +132,7 @@ public class GoAwayBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (cursor == 0)
{

View File

@ -21,6 +21,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.PriorityFrame;
@ -76,13 +77,13 @@ public class HeadersBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_headers_frame");
}
// For now we don't support HEADERS frames that don't have END_HEADERS.
if (!hasFlag(Flag.END_HEADERS))
{
return notifyConnectionFailure(ErrorCode.INTERNAL_ERROR, "unsupported_headers_frame");
return notifyConnectionFailure(ErrorCodes.INTERNAL_ERROR, "unsupported_headers_frame");
}
length = getBodyLength();
@ -110,7 +111,7 @@ public class HeadersBodyParser extends BodyParser
loop = length == 0;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame_padding");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_headers_frame_padding");
}
break;
}
@ -133,7 +134,7 @@ public class HeadersBodyParser extends BodyParser
state = State.WEIGHT;
if (length < 1)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
}
else
@ -151,7 +152,7 @@ public class HeadersBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
if (cursor == 0)
{
@ -159,7 +160,7 @@ public class HeadersBodyParser extends BodyParser
state = State.WEIGHT;
if (length < 1)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
}
break;

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
@ -95,7 +96,7 @@ public class Parser
LOG.debug("Parsing {} frame", FrameType.from(type));
if (type < 0 || type >= bodyParsers.length)
{
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "unknown_frame_type_" + type);
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "unknown_frame_type_" + type);
return false;
}
BodyParser bodyParser = bodyParsers[type];
@ -151,7 +152,7 @@ public class Parser
catch (Throwable x)
{
LOG.debug(x);
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "parser_error: "+x);
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "parser_error: "+x);
return false;
}
}

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.PingFrame;
@ -53,12 +54,12 @@ public class PingBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() != 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_ping_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_ping_frame");
}
// SPEC: wrong body length is treated as connection error.
if (getBodyLength() != 8)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_ping_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_ping_frame");
}
state = State.PAYLOAD;
break;

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -48,7 +49,7 @@ public class PrefaceParser
int currByte = buffer.get();
if (currByte != PREFACE_BYTES[cursor])
{
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_preface");
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_preface");
return false;
}
++cursor;

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.PriorityFrame;
public class PriorityBodyParser extends BodyParser
@ -54,12 +55,12 @@ public class PriorityBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_priority_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_priority_frame");
}
int length = getBodyLength();
if (length != 5)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_priority_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_priority_frame");
}
state = State.EXCLUSIVE;
break;

View File

@ -21,6 +21,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
@ -61,13 +62,13 @@ public class PushPromiseBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_push_promise_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_push_promise_frame");
}
// For now we don't support PUSH_PROMISE frames that don't have END_HEADERS.
if (!hasFlag(Flag.END_HEADERS))
{
return notifyConnectionFailure(ErrorCode.INTERNAL_ERROR, "unsupported_push_promise_frame");
return notifyConnectionFailure(ErrorCodes.INTERNAL_ERROR, "unsupported_push_promise_frame");
}
length = getBodyLength();
@ -90,7 +91,7 @@ public class PushPromiseBodyParser extends BodyParser
state = State.STREAM_ID;
if (length < 4)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
}
break;
}
@ -119,7 +120,7 @@ public class PushPromiseBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
}
if (cursor == 0)
{

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.ResetFrame;
public class ResetBodyParser extends BodyParser
@ -52,12 +53,12 @@ public class ResetBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_rst_stream_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_rst_stream_frame");
}
int length = getBodyLength();
if (length != 4)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_rst_stream_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_rst_stream_frame");
}
state = State.ERROR;
break;

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -75,7 +76,7 @@ public class ServerParser extends Parser
catch (Throwable x)
{
LOG.debug(x);
notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "parser_error");
notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "parser_error");
return false;
}
}

View File

@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.SettingsFrame;
@ -67,7 +68,7 @@ public class SettingsBodyParser extends BodyParser
// SPEC: wrong streamId is treated as connection error.
if (getStreamId() != 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCodes.PROTOCOL_ERROR, "invalid_settings_frame");
}
length = getBodyLength();
settings = new HashMap<>();
@ -83,7 +84,7 @@ public class SettingsBodyParser extends BodyParser
length -= 2;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
}
else
@ -102,7 +103,7 @@ public class SettingsBodyParser extends BodyParser
--length;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
if (cursor == 0)
{
@ -139,7 +140,7 @@ public class SettingsBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
if (cursor == 0)
{

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
public class WindowUpdateBodyParser extends BodyParser
@ -52,7 +53,7 @@ public class WindowUpdateBodyParser extends BodyParser
int length = getBodyLength();
if (length != 4)
{
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_window_update_frame");
return notifyConnectionFailure(ErrorCodes.FRAME_SIZE_ERROR, "invalid_window_update_frame");
}
state = State.WINDOW_DELTA;
break;

View File

@ -26,9 +26,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.generator.HeaderGenerator;
import org.eclipse.jetty.http2.generator.SettingsGenerator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.MappedByteBufferPool;
@ -133,7 +133,7 @@ public class SettingsGenerateParseTest
}
}
Assert.assertEquals(ErrorCode.PROTOCOL_ERROR, errorRef.get());
Assert.assertEquals(ErrorCodes.PROTOCOL_ERROR, errorRef.get());
}
@Test

View File

@ -20,12 +20,12 @@ package org.eclipse.jetty.http2.server;
import java.util.concurrent.Executor;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.HTTP2Connection;
import org.eclipse.jetty.http2.HTTP2FlowControl;
import org.eclipse.jetty.http2.ISession;
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
import org.eclipse.jetty.http2.generator.Generator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.http2.parser.ServerParser;
import org.eclipse.jetty.io.ByteBufferPool;
@ -117,7 +117,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
{
if (LOG.isDebugEnabled())
LOG.debug("Idle timeout {}ms expired on {}", getEndPoint().getIdleTimeout(), this);
getSession().close(ErrorCode.NO_ERROR, "idle_timeout", closeCallback);
getSession().close(ErrorCodes.NO_ERROR, "idle_timeout", closeCallback);
return false;
}

View File

@ -28,7 +28,6 @@ import java.nio.charset.StandardCharsets;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@ -40,13 +39,13 @@ import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.PingFrame;
import org.eclipse.jetty.http2.frames.SettingsFrame;
import org.eclipse.jetty.http2.generator.Generator;
import org.eclipse.jetty.http2.parser.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.http2.parser.PrefaceParser;
import org.eclipse.jetty.io.ByteBufferPool;
@ -297,7 +296,7 @@ public class HTTP2ServerTest
@Override
public boolean onGoAway(GoAwayFrame frame)
{
Assert.assertEquals(ErrorCode.FRAME_SIZE_ERROR, frame.getError());
Assert.assertEquals(ErrorCodes.FRAME_SIZE_ERROR, frame.getError());
latch.countDown();
return false;
}
@ -337,7 +336,7 @@ public class HTTP2ServerTest
@Override
public boolean onGoAway(GoAwayFrame frame)
{
Assert.assertEquals(ErrorCode.PROTOCOL_ERROR, frame.getError());
Assert.assertEquals(ErrorCodes.PROTOCOL_ERROR, frame.getError());
latch.countDown();
return false;
}