StreamID -> StreamId (#393 Ensure all fields follow naming convention)
This commit is contained in:
parent
9bf0ad8329
commit
a35aeb8cd9
@ -24,7 +24,7 @@ import io.netty.util.internal.StringUtil;
|
|||||||
*/
|
*/
|
||||||
public class DefaultSpdyDataFrame implements SpdyDataFrame {
|
public class DefaultSpdyDataFrame implements SpdyDataFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private boolean last;
|
private boolean last;
|
||||||
private boolean compressed;
|
private boolean compressed;
|
||||||
private ByteBuf data = Unpooled.EMPTY_BUFFER;
|
private ByteBuf data = Unpooled.EMPTY_BUFFER;
|
||||||
@ -32,24 +32,24 @@ public class DefaultSpdyDataFrame implements SpdyDataFrame {
|
|||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdyDataFrame(int streamID) {
|
public DefaultSpdyDataFrame(int streamId) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStreamID() {
|
public int getStreamId() {
|
||||||
return streamID;
|
return streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamID(int streamID) {
|
public void setStreamId(int streamId) {
|
||||||
if (streamID <= 0) {
|
if (streamId <= 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Stream-ID must be positive: " + streamID);
|
"Stream-ID must be positive: " + streamId);
|
||||||
}
|
}
|
||||||
this.streamID = streamID;
|
this.streamId = streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -102,7 +102,7 @@ public class DefaultSpdyDataFrame implements SpdyDataFrame {
|
|||||||
buf.append(')');
|
buf.append(')');
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Stream-ID = ");
|
buf.append("--> Stream-ID = ");
|
||||||
buf.append(streamID);
|
buf.append(streamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Size = ");
|
buf.append("--> Size = ");
|
||||||
buf.append(data.readableBytes());
|
buf.append(data.readableBytes());
|
||||||
|
@ -24,30 +24,30 @@ import io.netty.util.internal.StringUtil;
|
|||||||
public class DefaultSpdyHeadersFrame extends DefaultSpdyHeaderBlock
|
public class DefaultSpdyHeadersFrame extends DefaultSpdyHeaderBlock
|
||||||
implements SpdyHeadersFrame {
|
implements SpdyHeadersFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private boolean last;
|
private boolean last;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdyHeadersFrame(int streamID) {
|
public DefaultSpdyHeadersFrame(int streamId) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStreamID() {
|
public int getStreamId() {
|
||||||
return streamID;
|
return streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamID(int streamID) {
|
public void setStreamId(int streamId) {
|
||||||
if (streamID <= 0) {
|
if (streamId <= 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Stream-ID must be positive: " + streamID);
|
"Stream-ID must be positive: " + streamId);
|
||||||
}
|
}
|
||||||
this.streamID = streamID;
|
this.streamId = streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,7 +69,7 @@ public class DefaultSpdyHeadersFrame extends DefaultSpdyHeaderBlock
|
|||||||
buf.append(')');
|
buf.append(')');
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Stream-ID = ");
|
buf.append("--> Stream-ID = ");
|
||||||
buf.append(streamID);
|
buf.append(streamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Headers:");
|
buf.append("--> Headers:");
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
|
@ -22,42 +22,42 @@ import io.netty.util.internal.StringUtil;
|
|||||||
*/
|
*/
|
||||||
public class DefaultSpdyRstStreamFrame implements SpdyRstStreamFrame {
|
public class DefaultSpdyRstStreamFrame implements SpdyRstStreamFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private SpdyStreamStatus status;
|
private SpdyStreamStatus status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
* @param statusCode the Status code of this frame
|
* @param statusCode the Status code of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdyRstStreamFrame(int streamID, int statusCode) {
|
public DefaultSpdyRstStreamFrame(int streamId, int statusCode) {
|
||||||
this(streamID, SpdyStreamStatus.valueOf(statusCode));
|
this(streamId, SpdyStreamStatus.valueOf(statusCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
* @param status the status of this frame
|
* @param status the status of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdyRstStreamFrame(int streamID, SpdyStreamStatus status) {
|
public DefaultSpdyRstStreamFrame(int streamId, SpdyStreamStatus status) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
setStatus(status);
|
setStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStreamID() {
|
public int getStreamId() {
|
||||||
return streamID;
|
return streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamID(int streamID) {
|
public void setStreamId(int streamId) {
|
||||||
if (streamID <= 0) {
|
if (streamId <= 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Stream-ID must be positive: " + streamID);
|
"Stream-ID must be positive: " + streamId);
|
||||||
}
|
}
|
||||||
this.streamID = streamID;
|
this.streamId = streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,7 +76,7 @@ public class DefaultSpdyRstStreamFrame implements SpdyRstStreamFrame {
|
|||||||
buf.append(getClass().getSimpleName());
|
buf.append(getClass().getSimpleName());
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Stream-ID = ");
|
buf.append("--> Stream-ID = ");
|
||||||
buf.append(streamID);
|
buf.append(streamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Status: ");
|
buf.append("--> Status: ");
|
||||||
buf.append(status.toString());
|
buf.append(status.toString());
|
||||||
|
@ -23,30 +23,30 @@ import io.netty.util.internal.StringUtil;
|
|||||||
public class DefaultSpdySynReplyFrame extends DefaultSpdyHeaderBlock
|
public class DefaultSpdySynReplyFrame extends DefaultSpdyHeaderBlock
|
||||||
implements SpdySynReplyFrame {
|
implements SpdySynReplyFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private boolean last;
|
private boolean last;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdySynReplyFrame(int streamID) {
|
public DefaultSpdySynReplyFrame(int streamId) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStreamID() {
|
public int getStreamId() {
|
||||||
return streamID;
|
return streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamID(int streamID) {
|
public void setStreamId(int streamId) {
|
||||||
if (streamID <= 0) {
|
if (streamId <= 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Stream-ID must be positive: " + streamID);
|
"Stream-ID must be positive: " + streamId);
|
||||||
}
|
}
|
||||||
this.streamID = streamID;
|
this.streamId = streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +68,7 @@ public class DefaultSpdySynReplyFrame extends DefaultSpdyHeaderBlock
|
|||||||
buf.append(')');
|
buf.append(')');
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Stream-ID = ");
|
buf.append("--> Stream-ID = ");
|
||||||
buf.append(streamID);
|
buf.append(streamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Headers:");
|
buf.append("--> Headers:");
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
|
@ -22,32 +22,32 @@ import io.netty.util.internal.StringUtil;
|
|||||||
*/
|
*/
|
||||||
public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
|
public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private int deltaWindowSize;
|
private int deltaWindowSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
* @param streamID the Stream-ID of this frame
|
* @param streamId the Stream-ID of this frame
|
||||||
* @param deltaWindowSize the Delta-Window-Size of this frame
|
* @param deltaWindowSize the Delta-Window-Size of this frame
|
||||||
*/
|
*/
|
||||||
public DefaultSpdyWindowUpdateFrame(int streamID, int deltaWindowSize) {
|
public DefaultSpdyWindowUpdateFrame(int streamId, int deltaWindowSize) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
setDeltaWindowSize(deltaWindowSize);
|
setDeltaWindowSize(deltaWindowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStreamID() {
|
public int getStreamId() {
|
||||||
return streamID;
|
return streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStreamID(int streamID) {
|
public void setStreamId(int streamId) {
|
||||||
if (streamID <= 0) {
|
if (streamId <= 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Stream-ID must be positive: " + streamID);
|
"Stream-ID must be positive: " + streamId);
|
||||||
}
|
}
|
||||||
this.streamID = streamID;
|
this.streamId = streamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,7 +71,7 @@ public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
|
|||||||
buf.append(getClass().getSimpleName());
|
buf.append(getClass().getSimpleName());
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Stream-ID = ");
|
buf.append("--> Stream-ID = ");
|
||||||
buf.append(streamID);
|
buf.append(streamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
buf.append("--> Delta-Window-Size = ");
|
buf.append("--> Delta-Window-Size = ");
|
||||||
buf.append(deltaWindowSize);
|
buf.append(deltaWindowSize);
|
||||||
|
@ -26,12 +26,12 @@ public interface SpdyDataFrame {
|
|||||||
/**
|
/**
|
||||||
* Returns the Stream-ID of this frame.
|
* Returns the Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getStreamID();
|
int getStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
||||||
*/
|
*/
|
||||||
void setStreamID(int streamID);
|
void setStreamId(int streamID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if this frame is the last frame to be transmitted
|
* Returns {@code true} if this frame is the last frame to be transmitted
|
||||||
|
@ -407,17 +407,17 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastGoodStreamID = getUnsignedInt(buffer, buffer.readerIndex());
|
int lastGoodStreamId = getUnsignedInt(buffer, buffer.readerIndex());
|
||||||
buffer.skipBytes(4);
|
buffer.skipBytes(4);
|
||||||
|
|
||||||
if (version < 3) {
|
if (version < 3) {
|
||||||
return new DefaultSpdyGoAwayFrame(lastGoodStreamID);
|
return new DefaultSpdyGoAwayFrame(lastGoodStreamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
statusCode = getSignedInt(buffer, buffer.readerIndex());
|
statusCode = getSignedInt(buffer, buffer.readerIndex());
|
||||||
buffer.skipBytes(4);
|
buffer.skipBytes(4);
|
||||||
|
|
||||||
return new DefaultSpdyGoAwayFrame(lastGoodStreamID, statusCode);
|
return new DefaultSpdyGoAwayFrame(lastGoodStreamId, statusCode);
|
||||||
|
|
||||||
case SPDY_WINDOW_UPDATE_FRAME:
|
case SPDY_WINDOW_UPDATE_FRAME:
|
||||||
if (buffer.readableBytes() < 8) {
|
if (buffer.readableBytes() < 8) {
|
||||||
@ -447,7 +447,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
|
|||||||
|
|
||||||
int offset = buffer.readerIndex();
|
int offset = buffer.readerIndex();
|
||||||
streamID = getUnsignedInt(buffer, offset);
|
streamID = getUnsignedInt(buffer, offset);
|
||||||
int associatedToStreamID = getUnsignedInt(buffer, offset + 4);
|
int associatedToStreamId = getUnsignedInt(buffer, offset + 4);
|
||||||
byte priority = (byte) (buffer.getByte(offset + 8) >> 5 & 0x07);
|
byte priority = (byte) (buffer.getByte(offset + 8) >> 5 & 0x07);
|
||||||
if (version < 3) {
|
if (version < 3) {
|
||||||
priority >>= 1;
|
priority >>= 1;
|
||||||
@ -462,7 +462,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame =
|
SpdySynStreamFrame spdySynStreamFrame =
|
||||||
new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority);
|
new DefaultSpdySynStreamFrame(streamID, associatedToStreamId, priority);
|
||||||
spdySynStreamFrame.setLast((flags & SPDY_FLAG_FIN) != 0);
|
spdySynStreamFrame.setLast((flags & SPDY_FLAG_FIN) != 0);
|
||||||
spdySynStreamFrame.setUnidirectional((flags & SPDY_FLAG_UNIDIRECTIONAL) != 0);
|
spdySynStreamFrame.setUnidirectional((flags & SPDY_FLAG_UNIDIRECTIONAL) != 0);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
ByteBuf data = spdyDataFrame.getData();
|
ByteBuf data = spdyDataFrame.getData();
|
||||||
byte flags = spdyDataFrame.isLast() ? SPDY_DATA_FLAG_FIN : 0;
|
byte flags = spdyDataFrame.isLast() ? SPDY_DATA_FLAG_FIN : 0;
|
||||||
out.ensureWritableBytes(SPDY_HEADER_SIZE + data.readableBytes());
|
out.ensureWritableBytes(SPDY_HEADER_SIZE + data.readableBytes());
|
||||||
out.writeInt(spdyDataFrame.getStreamID() & 0x7FFFFFFF);
|
out.writeInt(spdyDataFrame.getStreamId() & 0x7FFFFFFF);
|
||||||
out.writeByte(flags);
|
out.writeByte(flags);
|
||||||
out.writeMedium(data.readableBytes());
|
out.writeMedium(data.readableBytes());
|
||||||
out.writeBytes(data, data.readerIndex(), data.readableBytes());
|
out.writeBytes(data, data.readerIndex(), data.readableBytes());
|
||||||
@ -157,7 +157,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
out.writeShort(SPDY_SYN_REPLY_FRAME);
|
out.writeShort(SPDY_SYN_REPLY_FRAME);
|
||||||
out.writeByte(flags);
|
out.writeByte(flags);
|
||||||
out.writeMedium(length);
|
out.writeMedium(length);
|
||||||
out.writeInt(spdySynReplyFrame.getStreamID());
|
out.writeInt(spdySynReplyFrame.getStreamId());
|
||||||
if (version < 3) {
|
if (version < 3) {
|
||||||
if (headerBlockLength == 0) {
|
if (headerBlockLength == 0) {
|
||||||
out.writeInt(0);
|
out.writeInt(0);
|
||||||
@ -174,7 +174,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
out.writeShort(version | 0x8000);
|
out.writeShort(version | 0x8000);
|
||||||
out.writeShort(SPDY_RST_STREAM_FRAME);
|
out.writeShort(SPDY_RST_STREAM_FRAME);
|
||||||
out.writeInt(8);
|
out.writeInt(8);
|
||||||
out.writeInt(spdyRstStreamFrame.getStreamID());
|
out.writeInt(spdyRstStreamFrame.getStreamId());
|
||||||
out.writeInt(spdyRstStreamFrame.getStatus().getCode());
|
out.writeInt(spdyRstStreamFrame.getStatus().getCode());
|
||||||
|
|
||||||
} else if (msg instanceof SpdySettingsFrame) {
|
} else if (msg instanceof SpdySettingsFrame) {
|
||||||
@ -262,7 +262,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
out.writeShort(SPDY_HEADERS_FRAME);
|
out.writeShort(SPDY_HEADERS_FRAME);
|
||||||
out.writeByte(flags);
|
out.writeByte(flags);
|
||||||
out.writeMedium(length);
|
out.writeMedium(length);
|
||||||
out.writeInt(spdyHeadersFrame.getStreamID());
|
out.writeInt(spdyHeadersFrame.getStreamId());
|
||||||
if (version < 3 && headerBlockLength != 0) {
|
if (version < 3 && headerBlockLength != 0) {
|
||||||
out.writeShort(0);
|
out.writeShort(0);
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
out.writeShort(version | 0x8000);
|
out.writeShort(version | 0x8000);
|
||||||
out.writeShort(SPDY_WINDOW_UPDATE_FRAME);
|
out.writeShort(SPDY_WINDOW_UPDATE_FRAME);
|
||||||
out.writeInt(8);
|
out.writeInt(8);
|
||||||
out.writeInt(spdyWindowUpdateFrame.getStreamID());
|
out.writeInt(spdyWindowUpdateFrame.getStreamId());
|
||||||
out.writeInt(spdyWindowUpdateFrame.getDeltaWindowSize());
|
out.writeInt(spdyWindowUpdateFrame.getDeltaWindowSize());
|
||||||
} else {
|
} else {
|
||||||
throw new UnsupportedMessageTypeException(msg);
|
throw new UnsupportedMessageTypeException(msg);
|
||||||
|
@ -23,12 +23,12 @@ public interface SpdyHeadersFrame extends SpdyHeaderBlock {
|
|||||||
/**
|
/**
|
||||||
* Returns the Stream-ID of this frame.
|
* Returns the Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getStreamID();
|
int getStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
||||||
*/
|
*/
|
||||||
void setStreamID(int streamID);
|
void setStreamId(int streamID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if this frame is the last frame to be transmitted
|
* Returns {@code true} if this frame is the last frame to be transmitted
|
||||||
|
@ -74,11 +74,11 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
|
|
||||||
if (SpdyCodecUtil.isServerID(streamID)) {
|
if (SpdyCodecUtil.isServerID(streamID)) {
|
||||||
// SYN_STREAM frames initiated by the server are pushed resources
|
// SYN_STREAM frames initiated by the server are pushed resources
|
||||||
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamId();
|
int associatedToStreamId = spdySynStreamFrame.getAssociatedToStreamId();
|
||||||
|
|
||||||
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
|
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
|
||||||
// it must reply with a RST_STREAM with error code INVALID_STREAM
|
// it must reply with a RST_STREAM with error code INVALID_STREAM
|
||||||
if (associatedToStreamID == 0) {
|
if (associatedToStreamId == 0) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamID, SpdyStreamStatus.INVALID_STREAM);
|
new DefaultSpdyRstStreamFrame(streamID, SpdyStreamStatus.INVALID_STREAM);
|
||||||
ctx.write(spdyRstStreamFrame);
|
ctx.write(spdyRstStreamFrame);
|
||||||
@ -98,8 +98,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynStreamFrame);
|
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynStreamFrame);
|
||||||
|
|
||||||
// Set the Stream-ID, Associated-To-Stream-ID, Priority, and URL as headers
|
// Set the Stream-ID, Associated-To-Stream-ID, Priority, and URL as headers
|
||||||
SpdyHttpHeaders.setStreamID(httpResponse, streamID);
|
SpdyHttpHeaders.setStreamId(httpResponse, streamID);
|
||||||
SpdyHttpHeaders.setAssociatedToStreamID(httpResponse, associatedToStreamID);
|
SpdyHttpHeaders.setAssociatedToStreamId(httpResponse, associatedToStreamId);
|
||||||
SpdyHttpHeaders.setPriority(httpResponse, spdySynStreamFrame.getPriority());
|
SpdyHttpHeaders.setPriority(httpResponse, spdySynStreamFrame.getPriority());
|
||||||
SpdyHttpHeaders.setUrl(httpResponse, URL);
|
SpdyHttpHeaders.setUrl(httpResponse, URL);
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
HttpRequest httpRequest = createHttpRequest(spdyVersion, spdySynStreamFrame);
|
HttpRequest httpRequest = createHttpRequest(spdyVersion, spdySynStreamFrame);
|
||||||
|
|
||||||
// Set the Stream-ID as a header
|
// Set the Stream-ID as a header
|
||||||
SpdyHttpHeaders.setStreamID(httpRequest, streamID);
|
SpdyHttpHeaders.setStreamId(httpRequest, streamID);
|
||||||
|
|
||||||
if (spdySynStreamFrame.isLast()) {
|
if (spdySynStreamFrame.isLast()) {
|
||||||
return httpRequest;
|
return httpRequest;
|
||||||
@ -145,13 +145,13 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
} else if (msg instanceof SpdySynReplyFrame) {
|
} else if (msg instanceof SpdySynReplyFrame) {
|
||||||
|
|
||||||
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
||||||
int streamID = spdySynReplyFrame.getStreamID();
|
int streamID = spdySynReplyFrame.getStreamId();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynReplyFrame);
|
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynReplyFrame);
|
||||||
|
|
||||||
// Set the Stream-ID as a header
|
// Set the Stream-ID as a header
|
||||||
SpdyHttpHeaders.setStreamID(httpResponse, streamID);
|
SpdyHttpHeaders.setStreamId(httpResponse, streamID);
|
||||||
|
|
||||||
if (spdySynReplyFrame.isLast()) {
|
if (spdySynReplyFrame.isLast()) {
|
||||||
HttpHeaders.setContentLength(httpResponse, 0);
|
HttpHeaders.setContentLength(httpResponse, 0);
|
||||||
@ -171,7 +171,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
} else if (msg instanceof SpdyHeadersFrame) {
|
} else if (msg instanceof SpdyHeadersFrame) {
|
||||||
|
|
||||||
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
||||||
Integer streamID = new Integer(spdyHeadersFrame.getStreamID());
|
Integer streamID = new Integer(spdyHeadersFrame.getStreamId());
|
||||||
HttpMessage httpMessage = messageMap.get(streamID);
|
HttpMessage httpMessage = messageMap.get(streamID);
|
||||||
|
|
||||||
// If message is not in map discard HEADERS frame.
|
// If message is not in map discard HEADERS frame.
|
||||||
@ -187,7 +187,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
} else if (msg instanceof SpdyDataFrame) {
|
} else if (msg instanceof SpdyDataFrame) {
|
||||||
|
|
||||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||||
Integer streamID = new Integer(spdyDataFrame.getStreamID());
|
Integer streamID = new Integer(spdyDataFrame.getStreamId());
|
||||||
HttpMessage httpMessage = messageMap.get(streamID);
|
HttpMessage httpMessage = messageMap.get(streamID);
|
||||||
|
|
||||||
// If message is not in map discard Data Frame.
|
// If message is not in map discard Data Frame.
|
||||||
@ -222,7 +222,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
} else if (msg instanceof SpdyRstStreamFrame) {
|
} else if (msg instanceof SpdyRstStreamFrame) {
|
||||||
|
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
||||||
Integer streamID = new Integer(spdyRstStreamFrame.getStreamID());
|
Integer streamID = new Integer(spdyRstStreamFrame.getStreamId());
|
||||||
messageMap.remove(streamID);
|
messageMap.remove(streamID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ import java.util.Map;
|
|||||||
public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
||||||
|
|
||||||
private final int spdyVersion;
|
private final int spdyVersion;
|
||||||
private volatile int currentStreamID;
|
private volatile int currentStreamId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
@ -165,7 +165,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
addContent(out, streamID, httpResponse);
|
addContent(out, streamID, httpResponse);
|
||||||
} else {
|
} else {
|
||||||
SpdySynReplyFrame spdySynReplyFrame = createSynReplyFrame(httpResponse);
|
SpdySynReplyFrame spdySynReplyFrame = createSynReplyFrame(httpResponse);
|
||||||
int streamID = spdySynReplyFrame.getStreamID();
|
int streamID = spdySynReplyFrame.getStreamId();
|
||||||
out.add(spdySynReplyFrame);
|
out.add(spdySynReplyFrame);
|
||||||
addContent(out, streamID, httpResponse);
|
addContent(out, streamID, httpResponse);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
} else if (msg instanceof HttpChunk) {
|
} else if (msg instanceof HttpChunk) {
|
||||||
|
|
||||||
HttpChunk chunk = (HttpChunk) msg;
|
HttpChunk chunk = (HttpChunk) msg;
|
||||||
SpdyDataFrame spdyDataFrame = new DefaultSpdyDataFrame(currentStreamID);
|
SpdyDataFrame spdyDataFrame = new DefaultSpdyDataFrame(currentStreamId);
|
||||||
spdyDataFrame.setData(chunk.getContent());
|
spdyDataFrame.setData(chunk.getContent());
|
||||||
spdyDataFrame.setLast(chunk.isLast());
|
spdyDataFrame.setLast(chunk.isLast());
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
out.add(spdyDataFrame);
|
out.add(spdyDataFrame);
|
||||||
} else {
|
} else {
|
||||||
// Create SPDY HEADERS frame out of trailers
|
// Create SPDY HEADERS frame out of trailers
|
||||||
SpdyHeadersFrame spdyHeadersFrame = new DefaultSpdyHeadersFrame(currentStreamID);
|
SpdyHeadersFrame spdyHeadersFrame = new DefaultSpdyHeadersFrame(currentStreamId);
|
||||||
for (Map.Entry<String, String> entry: trailers) {
|
for (Map.Entry<String, String> entry: trailers) {
|
||||||
spdyHeadersFrame.addHeader(entry.getKey(), entry.getValue());
|
spdyHeadersFrame.addHeader(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
@ -221,13 +221,13 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
boolean chunked = httpMessage.isChunked();
|
boolean chunked = httpMessage.isChunked();
|
||||||
|
|
||||||
// Get the Stream-ID, Associated-To-Stream-ID, Priority, URL, and scheme from the headers
|
// Get the Stream-ID, Associated-To-Stream-ID, Priority, URL, and scheme from the headers
|
||||||
int streamID = SpdyHttpHeaders.getStreamID(httpMessage);
|
int streamID = SpdyHttpHeaders.getStreamId(httpMessage);
|
||||||
int associatedToStreamID = SpdyHttpHeaders.getAssociatedToStreamID(httpMessage);
|
int associatedToStreamId = SpdyHttpHeaders.getAssociatedToStreamId(httpMessage);
|
||||||
byte priority = SpdyHttpHeaders.getPriority(httpMessage);
|
byte priority = SpdyHttpHeaders.getPriority(httpMessage);
|
||||||
String URL = SpdyHttpHeaders.getUrl(httpMessage);
|
String URL = SpdyHttpHeaders.getUrl(httpMessage);
|
||||||
String scheme = SpdyHttpHeaders.getScheme(httpMessage);
|
String scheme = SpdyHttpHeaders.getScheme(httpMessage);
|
||||||
SpdyHttpHeaders.removeStreamID(httpMessage);
|
SpdyHttpHeaders.removeStreamId(httpMessage);
|
||||||
SpdyHttpHeaders.removeAssociatedToStreamID(httpMessage);
|
SpdyHttpHeaders.removeAssociatedToStreamId(httpMessage);
|
||||||
SpdyHttpHeaders.removePriority(httpMessage);
|
SpdyHttpHeaders.removePriority(httpMessage);
|
||||||
SpdyHttpHeaders.removeUrl(httpMessage);
|
SpdyHttpHeaders.removeUrl(httpMessage);
|
||||||
SpdyHttpHeaders.removeScheme(httpMessage);
|
SpdyHttpHeaders.removeScheme(httpMessage);
|
||||||
@ -240,7 +240,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
httpMessage.removeHeader(HttpHeaders.Names.TRANSFER_ENCODING);
|
httpMessage.removeHeader(HttpHeaders.Names.TRANSFER_ENCODING);
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame =
|
SpdySynStreamFrame spdySynStreamFrame =
|
||||||
new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority);
|
new DefaultSpdySynStreamFrame(streamID, associatedToStreamId, priority);
|
||||||
|
|
||||||
// Unfold the first line of the message into name/value pairs
|
// Unfold the first line of the message into name/value pairs
|
||||||
if (httpMessage instanceof HttpRequest) {
|
if (httpMessage instanceof HttpRequest) {
|
||||||
@ -275,7 +275,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chunked) {
|
if (chunked) {
|
||||||
currentStreamID = streamID;
|
currentStreamId = streamID;
|
||||||
spdySynStreamFrame.setLast(false);
|
spdySynStreamFrame.setLast(false);
|
||||||
} else {
|
} else {
|
||||||
spdySynStreamFrame.setLast(httpMessage.getContent().readableBytes() == 0);
|
spdySynStreamFrame.setLast(httpMessage.getContent().readableBytes() == 0);
|
||||||
@ -289,8 +289,8 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
boolean chunked = httpResponse.isChunked();
|
boolean chunked = httpResponse.isChunked();
|
||||||
|
|
||||||
// Get the Stream-ID from the headers
|
// Get the Stream-ID from the headers
|
||||||
int streamID = SpdyHttpHeaders.getStreamID(httpResponse);
|
int streamID = SpdyHttpHeaders.getStreamId(httpResponse);
|
||||||
SpdyHttpHeaders.removeStreamID(httpResponse);
|
SpdyHttpHeaders.removeStreamId(httpResponse);
|
||||||
|
|
||||||
// The Connection, Keep-Alive, Proxy-Connection, and Transfer-ENcoding
|
// The Connection, Keep-Alive, Proxy-Connection, and Transfer-ENcoding
|
||||||
// headers are not valid and MUST not be sent.
|
// headers are not valid and MUST not be sent.
|
||||||
@ -311,7 +311,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chunked) {
|
if (chunked) {
|
||||||
currentStreamID = streamID;
|
currentStreamId = streamID;
|
||||||
spdySynReplyFrame.setLast(false);
|
spdySynReplyFrame.setLast(false);
|
||||||
} else {
|
} else {
|
||||||
spdySynReplyFrame.setLast(httpResponse.getContent().readableBytes() == 0);
|
spdySynReplyFrame.setLast(httpResponse.getContent().readableBytes() == 0);
|
||||||
|
@ -60,28 +60,28 @@ public final class SpdyHttpHeaders {
|
|||||||
/**
|
/**
|
||||||
* Removes the {@code "X-SPDY-Stream-ID"} header.
|
* Removes the {@code "X-SPDY-Stream-ID"} header.
|
||||||
*/
|
*/
|
||||||
public static void removeStreamID(HttpMessage message) {
|
public static void removeStreamId(HttpMessage message) {
|
||||||
message.removeHeader(Names.STREAM_ID);
|
message.removeHeader(Names.STREAM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the {@code "X-SPDY-Stream-ID"} header.
|
* Returns the value of the {@code "X-SPDY-Stream-ID"} header.
|
||||||
*/
|
*/
|
||||||
public static int getStreamID(HttpMessage message) {
|
public static int getStreamId(HttpMessage message) {
|
||||||
return HttpHeaders.getIntHeader(message, Names.STREAM_ID);
|
return HttpHeaders.getIntHeader(message, Names.STREAM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@code "X-SPDY-Stream-ID"} header.
|
* Sets the {@code "X-SPDY-Stream-ID"} header.
|
||||||
*/
|
*/
|
||||||
public static void setStreamID(HttpMessage message, int streamID) {
|
public static void setStreamId(HttpMessage message, int streamId) {
|
||||||
HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamID);
|
HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the {@code "X-SPDY-Associated-To-Stream-ID"} header.
|
* Removes the {@code "X-SPDY-Associated-To-Stream-ID"} header.
|
||||||
*/
|
*/
|
||||||
public static void removeAssociatedToStreamID(HttpMessage message) {
|
public static void removeAssociatedToStreamId(HttpMessage message) {
|
||||||
message.removeHeader(Names.ASSOCIATED_TO_STREAM_ID);
|
message.removeHeader(Names.ASSOCIATED_TO_STREAM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,15 +91,15 @@ public final class SpdyHttpHeaders {
|
|||||||
* @return the header value or {@code 0} if there is no such header or
|
* @return the header value or {@code 0} if there is no such header or
|
||||||
* if the header value is not a number
|
* if the header value is not a number
|
||||||
*/
|
*/
|
||||||
public static int getAssociatedToStreamID(HttpMessage message) {
|
public static int getAssociatedToStreamId(HttpMessage message) {
|
||||||
return HttpHeaders.getIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, 0);
|
return HttpHeaders.getIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@code "X-SPDY-Associated-To-Stream-ID"} header.
|
* Sets the {@code "X-SPDY-Associated-To-Stream-ID"} header.
|
||||||
*/
|
*/
|
||||||
public static void setAssociatedToStreamID(HttpMessage message, int associatedToStreamID) {
|
public static void setAssociatedToStreamId(HttpMessage message, int associatedToStreamId) {
|
||||||
HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamID);
|
HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,12 +23,12 @@ public interface SpdyRstStreamFrame {
|
|||||||
/**
|
/**
|
||||||
* Returns the Stream-ID of this frame.
|
* Returns the Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getStreamID();
|
int getStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
||||||
*/
|
*/
|
||||||
void setStreamID(int streamID);
|
void setStreamId(int streamID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the status of this frame.
|
* Returns the status of this frame.
|
||||||
|
@ -44,7 +44,7 @@ public class SpdySessionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final SpdySession spdySession = new SpdySession();
|
private final SpdySession spdySession = new SpdySession();
|
||||||
private volatile int lastGoodStreamID;
|
private volatile int lastGoodStreamId;
|
||||||
|
|
||||||
private volatile int remoteConcurrentStreams;
|
private volatile int remoteConcurrentStreams;
|
||||||
private volatile int localConcurrentStreams;
|
private volatile int localConcurrentStreams;
|
||||||
@ -148,11 +148,11 @@ public class SpdySessionHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||||
int streamID = spdyDataFrame.getStreamID();
|
int streamID = spdyDataFrame.getStreamId();
|
||||||
|
|
||||||
// Check if we received a data frame for a Stream-ID which is not open
|
// Check if we received a data frame for a Stream-ID which is not open
|
||||||
if (!spdySession.isActiveStream(streamID)) {
|
if (!spdySession.isActiveStream(streamID)) {
|
||||||
if (streamID <= lastGoodStreamID) {
|
if (streamID <= lastGoodStreamId) {
|
||||||
issueStreamError(ctx, streamID, SpdyStreamStatus.PROTOCOL_ERROR);
|
issueStreamError(ctx, streamID, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
} else if (!sentGoAwayFrame) {
|
} else if (!sentGoAwayFrame) {
|
||||||
issueStreamError(ctx, streamID, SpdyStreamStatus.INVALID_STREAM);
|
issueStreamError(ctx, streamID, SpdyStreamStatus.INVALID_STREAM);
|
||||||
@ -247,7 +247,7 @@ public class SpdySessionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stream-IDs must be monotonically increasing
|
// Stream-IDs must be monotonically increasing
|
||||||
if (streamID <= lastGoodStreamID) {
|
if (streamID <= lastGoodStreamId) {
|
||||||
issueSessionError(ctx, SpdySessionStatus.PROTOCOL_ERROR);
|
issueSessionError(ctx, SpdySessionStatus.PROTOCOL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ public class SpdySessionHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
||||||
int streamID = spdySynReplyFrame.getStreamID();
|
int streamID = spdySynReplyFrame.getStreamId();
|
||||||
|
|
||||||
// Check if we received a valid SYN_REPLY frame
|
// Check if we received a valid SYN_REPLY frame
|
||||||
if (spdySynReplyFrame.isInvalid() ||
|
if (spdySynReplyFrame.isInvalid() ||
|
||||||
@ -306,7 +306,7 @@ public class SpdySessionHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
||||||
removeStream(ctx, spdyRstStreamFrame.getStreamID());
|
removeStream(ctx, spdyRstStreamFrame.getStreamId());
|
||||||
|
|
||||||
} else if (msg instanceof SpdySettingsFrame) {
|
} else if (msg instanceof SpdySettingsFrame) {
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ public class SpdySessionHandler
|
|||||||
} else if (msg instanceof SpdyHeadersFrame) {
|
} else if (msg instanceof SpdyHeadersFrame) {
|
||||||
|
|
||||||
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
||||||
int streamID = spdyHeadersFrame.getStreamID();
|
int streamID = spdyHeadersFrame.getStreamId();
|
||||||
|
|
||||||
// Check if we received a valid HEADERS frame
|
// Check if we received a valid HEADERS frame
|
||||||
if (spdyHeadersFrame.isInvalid()) {
|
if (spdyHeadersFrame.isInvalid()) {
|
||||||
@ -397,7 +397,7 @@ public class SpdySessionHandler
|
|||||||
|
|
||||||
if (flowControl) {
|
if (flowControl) {
|
||||||
SpdyWindowUpdateFrame spdyWindowUpdateFrame = (SpdyWindowUpdateFrame) msg;
|
SpdyWindowUpdateFrame spdyWindowUpdateFrame = (SpdyWindowUpdateFrame) msg;
|
||||||
int streamID = spdyWindowUpdateFrame.getStreamID();
|
int streamID = spdyWindowUpdateFrame.getStreamId();
|
||||||
int deltaWindowSize = spdyWindowUpdateFrame.getDeltaWindowSize();
|
int deltaWindowSize = spdyWindowUpdateFrame.getDeltaWindowSize();
|
||||||
|
|
||||||
// Ignore frames for half-closed streams
|
// Ignore frames for half-closed streams
|
||||||
@ -471,7 +471,7 @@ public class SpdySessionHandler
|
|||||||
if (msg instanceof SpdyDataFrame) {
|
if (msg instanceof SpdyDataFrame) {
|
||||||
|
|
||||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||||
final int streamID = spdyDataFrame.getStreamID();
|
final int streamID = spdyDataFrame.getStreamId();
|
||||||
|
|
||||||
// Frames must not be sent on half-closed streams
|
// Frames must not be sent on half-closed streams
|
||||||
if (spdySession.isLocalSideClosed(streamID)) {
|
if (spdySession.isLocalSideClosed(streamID)) {
|
||||||
@ -582,7 +582,7 @@ public class SpdySessionHandler
|
|||||||
} else if (msg instanceof SpdySynReplyFrame) {
|
} else if (msg instanceof SpdySynReplyFrame) {
|
||||||
|
|
||||||
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
||||||
int streamID = spdySynReplyFrame.getStreamID();
|
int streamID = spdySynReplyFrame.getStreamId();
|
||||||
|
|
||||||
// Frames must not be sent on half-closed streams
|
// Frames must not be sent on half-closed streams
|
||||||
if (!isRemoteInitiatedID(streamID) || spdySession.isLocalSideClosed(streamID)) {
|
if (!isRemoteInitiatedID(streamID) || spdySession.isLocalSideClosed(streamID)) {
|
||||||
@ -598,7 +598,7 @@ public class SpdySessionHandler
|
|||||||
} else if (msg instanceof SpdyRstStreamFrame) {
|
} else if (msg instanceof SpdyRstStreamFrame) {
|
||||||
|
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
||||||
removeStream(ctx, spdyRstStreamFrame.getStreamID());
|
removeStream(ctx, spdyRstStreamFrame.getStreamId());
|
||||||
|
|
||||||
} else if (msg instanceof SpdySettingsFrame) {
|
} else if (msg instanceof SpdySettingsFrame) {
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ public class SpdySessionHandler
|
|||||||
} else if (msg instanceof SpdyHeadersFrame) {
|
} else if (msg instanceof SpdyHeadersFrame) {
|
||||||
|
|
||||||
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
||||||
int streamID = spdyHeadersFrame.getStreamID();
|
int streamID = spdyHeadersFrame.getStreamId();
|
||||||
|
|
||||||
// Frames must not be sent on half-closed streams
|
// Frames must not be sent on half-closed streams
|
||||||
if (spdySession.isLocalSideClosed(streamID)) {
|
if (spdySession.isLocalSideClosed(streamID)) {
|
||||||
@ -747,8 +747,8 @@ public class SpdySessionHandler
|
|||||||
private synchronized void updateInitialSendWindowSize(int newInitialWindowSize) {
|
private synchronized void updateInitialSendWindowSize(int newInitialWindowSize) {
|
||||||
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
|
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
|
||||||
initialSendWindowSize = newInitialWindowSize;
|
initialSendWindowSize = newInitialWindowSize;
|
||||||
for (Integer StreamID: spdySession.getActiveStreams()) {
|
for (Integer streamId: spdySession.getActiveStreams()) {
|
||||||
spdySession.updateSendWindowSize(StreamID.intValue(), deltaWindowSize);
|
spdySession.updateSendWindowSize(streamId.intValue(), deltaWindowSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,7 +759,7 @@ public class SpdySessionHandler
|
|||||||
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
|
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to synchronize accesses to sentGoAwayFrame, lastGoodStreamID, and initial window sizes
|
// need to synchronize accesses to sentGoAwayFrame, lastGoodStreamId, and initial window sizes
|
||||||
private synchronized boolean acceptStream(
|
private synchronized boolean acceptStream(
|
||||||
int streamID, byte priority, boolean remoteSideClosed, boolean localSideClosed) {
|
int streamID, byte priority, boolean remoteSideClosed, boolean localSideClosed) {
|
||||||
// Cannot initiate any new streams after receiving or sending GOAWAY
|
// Cannot initiate any new streams after receiving or sending GOAWAY
|
||||||
@ -776,7 +776,7 @@ public class SpdySessionHandler
|
|||||||
streamID, priority, remoteSideClosed, localSideClosed,
|
streamID, priority, remoteSideClosed, localSideClosed,
|
||||||
initialSendWindowSize, initialReceiveWindowSize);
|
initialSendWindowSize, initialReceiveWindowSize);
|
||||||
if (isRemoteInitiatedID(streamID)) {
|
if (isRemoteInitiatedID(streamID)) {
|
||||||
lastGoodStreamID = streamID;
|
lastGoodStreamId = streamID;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -896,7 +896,7 @@ public class SpdySessionHandler
|
|||||||
ChannelHandlerContext ctx, SpdySessionStatus status) {
|
ChannelHandlerContext ctx, SpdySessionStatus status) {
|
||||||
if (!sentGoAwayFrame) {
|
if (!sentGoAwayFrame) {
|
||||||
sentGoAwayFrame = true;
|
sentGoAwayFrame = true;
|
||||||
SpdyGoAwayFrame spdyGoAwayFrame = new DefaultSpdyGoAwayFrame(lastGoodStreamID, status);
|
SpdyGoAwayFrame spdyGoAwayFrame = new DefaultSpdyGoAwayFrame(lastGoodStreamId, status);
|
||||||
ctx.nextOutboundMessageBuffer().add(spdyGoAwayFrame);
|
ctx.nextOutboundMessageBuffer().add(spdyGoAwayFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,12 @@ public interface SpdySynReplyFrame extends SpdyHeaderBlock {
|
|||||||
/**
|
/**
|
||||||
* Returns the Stream-ID of this frame.
|
* Returns the Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getStreamID();
|
int getStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
||||||
*/
|
*/
|
||||||
void setStreamID(int streamID);
|
void setStreamId(int streamID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if this frame is the last frame to be transmitted
|
* Returns {@code true} if this frame is the last frame to be transmitted
|
||||||
|
@ -23,12 +23,12 @@ public interface SpdyWindowUpdateFrame {
|
|||||||
/**
|
/**
|
||||||
* Returns the Stream-ID of this frame.
|
* Returns the Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getStreamID();
|
int getStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
|
||||||
*/
|
*/
|
||||||
void setStreamID(int streamID);
|
void setStreamId(int streamID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Delta-Window-Size of this frame.
|
* Returns the Delta-Window-Size of this frame.
|
||||||
|
@ -55,7 +55,7 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNotNull(msg);
|
Assert.assertNotNull(msg);
|
||||||
Assert.assertTrue(msg instanceof SpdyDataFrame);
|
Assert.assertTrue(msg instanceof SpdyDataFrame);
|
||||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||||
Assert.assertTrue(spdyDataFrame.getStreamID() == streamID);
|
Assert.assertTrue(spdyDataFrame.getStreamId() == streamID);
|
||||||
Assert.assertTrue(spdyDataFrame.isLast() == last);
|
Assert.assertTrue(spdyDataFrame.isLast() == last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNotNull(msg);
|
Assert.assertNotNull(msg);
|
||||||
Assert.assertTrue(msg instanceof SpdySynReplyFrame);
|
Assert.assertTrue(msg instanceof SpdySynReplyFrame);
|
||||||
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
|
||||||
Assert.assertTrue(spdySynReplyFrame.getStreamID() == streamID);
|
Assert.assertTrue(spdySynReplyFrame.getStreamId() == streamID);
|
||||||
Assert.assertTrue(spdySynReplyFrame.isLast() == last);
|
Assert.assertTrue(spdySynReplyFrame.isLast() == last);
|
||||||
assertHeaderBlock(spdySynReplyFrame, headers);
|
assertHeaderBlock(spdySynReplyFrame, headers);
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNotNull(msg);
|
Assert.assertNotNull(msg);
|
||||||
Assert.assertTrue(msg instanceof SpdyRstStreamFrame);
|
Assert.assertTrue(msg instanceof SpdyRstStreamFrame);
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
||||||
Assert.assertTrue(spdyRstStreamFrame.getStreamID() == streamID);
|
Assert.assertTrue(spdyRstStreamFrame.getStreamId() == streamID);
|
||||||
Assert.assertTrue(spdyRstStreamFrame.getStatus().equals(status));
|
Assert.assertTrue(spdyRstStreamFrame.getStatus().equals(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNotNull(msg);
|
Assert.assertNotNull(msg);
|
||||||
Assert.assertTrue(msg instanceof SpdyHeadersFrame);
|
Assert.assertTrue(msg instanceof SpdyHeadersFrame);
|
||||||
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
||||||
Assert.assertTrue(spdyHeadersFrame.getStreamID() == streamID);
|
Assert.assertTrue(spdyHeadersFrame.getStreamId() == streamID);
|
||||||
assertHeaderBlock(spdyHeadersFrame, headers);
|
assertHeaderBlock(spdyHeadersFrame, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,18 +207,18 @@ public class SpdySessionHandlerTest {
|
|||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
|
|
||||||
// Check if session handler rejects HEADERS for closed streams
|
// Check if session handler rejects HEADERS for closed streams
|
||||||
int testStreamID = spdyDataFrame.getStreamID();
|
int testStreamID = spdyDataFrame.getStreamId();
|
||||||
sessionHandler.writeInbound(spdyDataFrame);
|
sessionHandler.writeInbound(spdyDataFrame);
|
||||||
assertDataFrame(sessionHandler.readOutbound(), testStreamID, spdyDataFrame.isLast());
|
assertDataFrame(sessionHandler.readOutbound(), testStreamID, spdyDataFrame.isLast());
|
||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
spdyHeadersFrame.setStreamID(testStreamID);
|
spdyHeadersFrame.setStreamId(testStreamID);
|
||||||
sessionHandler.writeInbound(spdyHeadersFrame);
|
sessionHandler.writeInbound(spdyHeadersFrame);
|
||||||
assertRstStream(sessionHandler.readOutbound(), testStreamID, SpdyStreamStatus.INVALID_STREAM);
|
assertRstStream(sessionHandler.readOutbound(), testStreamID, SpdyStreamStatus.INVALID_STREAM);
|
||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
|
|
||||||
// Check if session handler returns PROTOCOL_ERROR if it receives
|
// Check if session handler returns PROTOCOL_ERROR if it receives
|
||||||
// an invalid HEADERS frame
|
// an invalid HEADERS frame
|
||||||
spdyHeadersFrame.setStreamID(localStreamID);
|
spdyHeadersFrame.setStreamId(localStreamID);
|
||||||
spdyHeadersFrame.setInvalid();
|
spdyHeadersFrame.setInvalid();
|
||||||
sessionHandler.writeInbound(spdyHeadersFrame);
|
sessionHandler.writeInbound(spdyHeadersFrame);
|
||||||
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.PROTOCOL_ERROR);
|
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
@ -248,7 +248,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler ignores Data frames after sending
|
// Check if session handler ignores Data frames after sending
|
||||||
// a GOAWAY frame
|
// a GOAWAY frame
|
||||||
spdyDataFrame.setStreamID(localStreamID);
|
spdyDataFrame.setStreamId(localStreamID);
|
||||||
sessionHandler.writeInbound(spdyDataFrame);
|
sessionHandler.writeInbound(spdyDataFrame);
|
||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user