Fixes #3212 - java.io.IOException: 1/unexpected_rst_stream_frame.
Client and server need to to treat an incoming RST_STREAM frame differently, testing whether the stream is closed for respectively local and remote streams. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
63820e5405
commit
9aeebb1368
|
@ -29,6 +29,7 @@ import org.eclipse.jetty.http2.api.Session;
|
||||||
import org.eclipse.jetty.http2.api.Stream;
|
import org.eclipse.jetty.http2.api.Stream;
|
||||||
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
||||||
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
|
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
|
||||||
|
import org.eclipse.jetty.http2.frames.ResetFrame;
|
||||||
import org.eclipse.jetty.http2.generator.Generator;
|
import org.eclipse.jetty.http2.generator.Generator;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
|
@ -117,6 +118,17 @@ public class HTTP2ClientSession extends HTTP2Session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResetForUnknownStream(ResetFrame frame)
|
||||||
|
{
|
||||||
|
int streamId = frame.getStreamId();
|
||||||
|
boolean closed = isClientStream(streamId) ? isLocalStreamClosed(streamId) : isRemoteStreamClosed(streamId);
|
||||||
|
if (closed)
|
||||||
|
notifyReset(this, frame);
|
||||||
|
else
|
||||||
|
onConnectionFailure(ErrorCode.PROTOCOL_ERROR.code, "unexpected_rst_stream_frame");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPushPromise(PushPromiseFrame frame)
|
public void onPushPromise(PushPromiseFrame frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,13 +295,12 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isRemoteStreamClosed(streamId))
|
onResetForUnknownStream(frame);
|
||||||
notifyReset(this, frame);
|
|
||||||
else
|
|
||||||
onConnectionFailure(ErrorCode.PROTOCOL_ERROR.code, "unexpected_rst_stream_frame");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void onResetForUnknownStream(ResetFrame frame);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSettings(SettingsFrame frame)
|
public void onSettings(SettingsFrame frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.jetty.http2.api.server.ServerSessionListener;
|
||||||
import org.eclipse.jetty.http2.frames.Frame;
|
import org.eclipse.jetty.http2.frames.Frame;
|
||||||
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
||||||
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
|
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
|
||||||
|
import org.eclipse.jetty.http2.frames.ResetFrame;
|
||||||
import org.eclipse.jetty.http2.frames.SettingsFrame;
|
import org.eclipse.jetty.http2.frames.SettingsFrame;
|
||||||
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
|
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
|
||||||
import org.eclipse.jetty.http2.generator.Generator;
|
import org.eclipse.jetty.http2.generator.Generator;
|
||||||
|
@ -139,6 +140,17 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResetForUnknownStream(ResetFrame frame)
|
||||||
|
{
|
||||||
|
int streamId = frame.getStreamId();
|
||||||
|
boolean closed = isClientStream(streamId) ? isRemoteStreamClosed(streamId) : isLocalStreamClosed(streamId);
|
||||||
|
if (closed)
|
||||||
|
notifyReset(this, frame);
|
||||||
|
else
|
||||||
|
onConnectionFailure(ErrorCode.PROTOCOL_ERROR.code, "unexpected_rst_stream_frame");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPushPromise(PushPromiseFrame frame)
|
public void onPushPromise(PushPromiseFrame frame)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue