ID -> Id (#393 Ensure all fields follow our naming convention)
This commit is contained in:
parent
676b81a4cd
commit
154198a385
@ -23,8 +23,8 @@ import io.netty.util.internal.StringUtil;
|
|||||||
public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
|
public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
|
||||||
implements SpdySynStreamFrame {
|
implements SpdySynStreamFrame {
|
||||||
|
|
||||||
private int streamID;
|
private int streamId;
|
||||||
private int associatedToStreamID;
|
private int associatedToStreamId;
|
||||||
private byte priority;
|
private byte priority;
|
||||||
private boolean last;
|
private boolean last;
|
||||||
private boolean unidirectional;
|
private boolean unidirectional;
|
||||||
@ -32,44 +32,44 @@ public class DefaultSpdySynStreamFrame extends DefaultSpdyHeaderBlock
|
|||||||
/**
|
/**
|
||||||
* 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 associatedToStreamID the Associated-To-Stream-ID of this frame
|
* @param associatedToStreamId the Associated-To-Stream-ID of this frame
|
||||||
* @param priority the priority of the stream
|
* @param priority the priority of the stream
|
||||||
*/
|
*/
|
||||||
public DefaultSpdySynStreamFrame(
|
public DefaultSpdySynStreamFrame(
|
||||||
int streamID, int associatedToStreamID, byte priority) {
|
int streamId, int associatedToStreamId, byte priority) {
|
||||||
setStreamID(streamID);
|
setStreamId(streamId);
|
||||||
setAssociatedToStreamID(associatedToStreamID);
|
setAssociatedToStreamId(associatedToStreamId);
|
||||||
setPriority(priority);
|
setPriority(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
public int getAssociatedToStreamID() {
|
public int getAssociatedToStreamId() {
|
||||||
return associatedToStreamID;
|
return associatedToStreamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAssociatedToStreamID(int associatedToStreamID) {
|
public void setAssociatedToStreamId(int associatedToStreamId) {
|
||||||
if (associatedToStreamID < 0) {
|
if (associatedToStreamId < 0) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Associated-To-Stream-ID cannot be negative: " +
|
"Associated-To-Stream-ID cannot be negative: " +
|
||||||
associatedToStreamID);
|
associatedToStreamId);
|
||||||
}
|
}
|
||||||
this.associatedToStreamID = associatedToStreamID;
|
this.associatedToStreamId = associatedToStreamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -117,11 +117,11 @@ public class DefaultSpdySynStreamFrame 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);
|
||||||
if (associatedToStreamID != 0) {
|
if (associatedToStreamId != 0) {
|
||||||
buf.append("--> Associated-To-Stream-ID = ");
|
buf.append("--> Associated-To-Stream-ID = ");
|
||||||
buf.append(associatedToStreamID);
|
buf.append(associatedToStreamId);
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE);
|
||||||
}
|
}
|
||||||
buf.append("--> Priority = ");
|
buf.append("--> Priority = ");
|
||||||
|
@ -122,8 +122,8 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
|||||||
out.writeShort(SPDY_SYN_STREAM_FRAME);
|
out.writeShort(SPDY_SYN_STREAM_FRAME);
|
||||||
out.writeByte(flags);
|
out.writeByte(flags);
|
||||||
out.writeMedium(length);
|
out.writeMedium(length);
|
||||||
out.writeInt(spdySynStreamFrame.getStreamID());
|
out.writeInt(spdySynStreamFrame.getStreamId());
|
||||||
out.writeInt(spdySynStreamFrame.getAssociatedToStreamID());
|
out.writeInt(spdySynStreamFrame.getAssociatedToStreamId());
|
||||||
if (version < 3) {
|
if (version < 3) {
|
||||||
// Restrict priorities for SPDY/2 to between 0 and 3
|
// Restrict priorities for SPDY/2 to between 0 and 3
|
||||||
byte priority = spdySynStreamFrame.getPriority();
|
byte priority = spdySynStreamFrame.getPriority();
|
||||||
|
@ -70,11 +70,11 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
|
|||||||
|
|
||||||
// HTTP requests/responses are mapped one-to-one to SPDY streams.
|
// HTTP requests/responses are mapped one-to-one to SPDY streams.
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
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
|
||||||
|
@ -151,7 +151,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
|
|
||||||
HttpRequest httpRequest = (HttpRequest) msg;
|
HttpRequest httpRequest = (HttpRequest) msg;
|
||||||
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpRequest);
|
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpRequest);
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
out.add(spdySynStreamFrame);
|
out.add(spdySynStreamFrame);
|
||||||
addContent(out, streamID, httpRequest);
|
addContent(out, streamID, httpRequest);
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
|||||||
HttpResponse httpResponse = (HttpResponse) msg;
|
HttpResponse httpResponse = (HttpResponse) msg;
|
||||||
if (httpResponse.containsHeader(SpdyHttpHeaders.Names.ASSOCIATED_TO_STREAM_ID)) {
|
if (httpResponse.containsHeader(SpdyHttpHeaders.Names.ASSOCIATED_TO_STREAM_ID)) {
|
||||||
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpResponse);
|
SpdySynStreamFrame spdySynStreamFrame = createSynStreamFrame(httpResponse);
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
out.add(spdySynStreamFrame);
|
out.add(spdySynStreamFrame);
|
||||||
addContent(out, streamID, httpResponse);
|
addContent(out, streamID, httpResponse);
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,7 +236,7 @@ public class SpdySessionHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
// Check if we received a valid SYN_STREAM frame
|
// Check if we received a valid SYN_STREAM frame
|
||||||
if (spdySynStreamFrame.isInvalid() ||
|
if (spdySynStreamFrame.isInvalid() ||
|
||||||
@ -564,7 +564,7 @@ public class SpdySessionHandler
|
|||||||
} else if (msg instanceof SpdySynStreamFrame) {
|
} else if (msg instanceof SpdySynStreamFrame) {
|
||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
|
|
||||||
if (isRemoteInitiatedID(streamID)) {
|
if (isRemoteInitiatedID(streamID)) {
|
||||||
ctx.fireExceptionCaught(PROTOCOL_EXCEPTION);
|
ctx.fireExceptionCaught(PROTOCOL_EXCEPTION);
|
||||||
|
@ -23,23 +23,23 @@ public interface SpdySynStreamFrame 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 the Associated-To-Stream-ID of this frame.
|
* Returns the Associated-To-Stream-ID of this frame.
|
||||||
*/
|
*/
|
||||||
int getAssociatedToStreamID();
|
int getAssociatedToStreamId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Associated-To-Stream-ID of this frame.
|
* Sets the Associated-To-Stream-ID of this frame.
|
||||||
* The Associated-To-Stream-ID cannot be negative.
|
* The Associated-To-Stream-ID cannot be negative.
|
||||||
*/
|
*/
|
||||||
void setAssociatedToStreamID(int associatedToStreamID);
|
void setAssociatedToStreamId(int associatedToStreamId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the priority of the stream.
|
* Returns the priority of the stream.
|
||||||
|
@ -156,7 +156,7 @@ public class SpdySessionHandlerTest {
|
|||||||
// Check if session handler closed the streams using the number
|
// Check if session handler closed the streams using the number
|
||||||
// of concurrent streams and that it returns REFUSED_STREAM
|
// of concurrent streams and that it returns REFUSED_STREAM
|
||||||
// if it receives a SYN_STREAM frame it does not wish to accept
|
// if it receives a SYN_STREAM frame it does not wish to accept
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
spdySynStreamFrame.setLast(true);
|
spdySynStreamFrame.setLast(true);
|
||||||
spdySynStreamFrame.setUnidirectional(true);
|
spdySynStreamFrame.setUnidirectional(true);
|
||||||
sessionHandler.writeInbound(spdySynStreamFrame);
|
sessionHandler.writeInbound(spdySynStreamFrame);
|
||||||
@ -184,11 +184,11 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler returns PROTOCOL_ERROR if it receives
|
// Check if session handler returns PROTOCOL_ERROR if it receives
|
||||||
// a SYN_STREAM frame with an invalid Stream-ID
|
// a SYN_STREAM frame with an invalid Stream-ID
|
||||||
spdySynStreamFrame.setStreamID(localStreamID - 1);
|
spdySynStreamFrame.setStreamId(localStreamID - 1);
|
||||||
sessionHandler.writeInbound(spdySynStreamFrame);
|
sessionHandler.writeInbound(spdySynStreamFrame);
|
||||||
assertRstStream(sessionHandler.readOutbound(), localStreamID - 1, SpdyStreamStatus.PROTOCOL_ERROR);
|
assertRstStream(sessionHandler.readOutbound(), localStreamID - 1, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
|
|
||||||
// Check if session handler correctly limits the number of
|
// Check if session handler correctly limits the number of
|
||||||
// concurrent streams in the SETTINGS frame
|
// concurrent streams in the SETTINGS frame
|
||||||
@ -241,7 +241,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
// Check if session handler returns REFUSED_STREAM if it receives
|
// Check if session handler returns REFUSED_STREAM if it receives
|
||||||
// SYN_STREAM frames after sending a GOAWAY frame
|
// SYN_STREAM frames after sending a GOAWAY frame
|
||||||
spdySynStreamFrame.setStreamID(localStreamID);
|
spdySynStreamFrame.setStreamId(localStreamID);
|
||||||
sessionHandler.writeInbound(spdySynStreamFrame);
|
sessionHandler.writeInbound(spdySynStreamFrame);
|
||||||
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.REFUSED_STREAM);
|
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.REFUSED_STREAM);
|
||||||
Assert.assertNull(sessionHandler.readOutbound());
|
Assert.assertNull(sessionHandler.readOutbound());
|
||||||
@ -290,11 +290,11 @@ public class SpdySessionHandlerTest {
|
|||||||
new DefaultSpdySynStreamFrame(streamID, 0, (byte) 0);
|
new DefaultSpdySynStreamFrame(streamID, 0, (byte) 0);
|
||||||
spdySynStreamFrame.setLast(true);
|
spdySynStreamFrame.setLast(true);
|
||||||
ctx.write(spdySynStreamFrame);
|
ctx.write(spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
ctx.write(spdySynStreamFrame);
|
ctx.write(spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
ctx.write(spdySynStreamFrame);
|
ctx.write(spdySynStreamFrame);
|
||||||
spdySynStreamFrame.setStreamID(spdySynStreamFrame.getStreamID() + 2);
|
spdySynStreamFrame.setStreamId(spdySynStreamFrame.getStreamId() + 2);
|
||||||
ctx.write(spdySynStreamFrame);
|
ctx.write(spdySynStreamFrame);
|
||||||
|
|
||||||
// Limit the number of concurrent streams to 3
|
// Limit the number of concurrent streams to 3
|
||||||
@ -317,7 +317,7 @@ public class SpdySessionHandlerTest {
|
|||||||
|
|
||||||
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
SpdySynStreamFrame spdySynStreamFrame = (SpdySynStreamFrame) msg;
|
||||||
if (!spdySynStreamFrame.isUnidirectional()) {
|
if (!spdySynStreamFrame.isUnidirectional()) {
|
||||||
int streamID = spdySynStreamFrame.getStreamID();
|
int streamID = spdySynStreamFrame.getStreamId();
|
||||||
SpdySynReplyFrame spdySynReplyFrame = new DefaultSpdySynReplyFrame(streamID);
|
SpdySynReplyFrame spdySynReplyFrame = new DefaultSpdySynReplyFrame(streamID);
|
||||||
spdySynReplyFrame.setLast(spdySynStreamFrame.isLast());
|
spdySynReplyFrame.setLast(spdySynStreamFrame.isLast());
|
||||||
for (Map.Entry<String, String> entry: spdySynStreamFrame.getHeaders()) {
|
for (Map.Entry<String, String> entry: spdySynStreamFrame.getHeaders()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user