fix SpdyHttpDecoder
This commit is contained in:
parent
cf9ee928b0
commit
b5527e905e
@ -108,7 +108,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
if (associatedToStreamId == 0) {
|
if (associatedToStreamId == 0) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INVALID_STREAM);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INVALID_STREAM);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String URL = SpdyHeaders.getUrl(spdyVersion, spdySynStreamFrame);
|
String URL = SpdyHeaders.getUrl(spdyVersion, spdySynStreamFrame);
|
||||||
@ -118,7 +119,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
if (URL == null) {
|
if (URL == null) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a client receives a response with a truncated header block,
|
// If a client receives a response with a truncated header block,
|
||||||
@ -126,7 +128,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
if (spdySynStreamFrame.isTruncated()) {
|
if (spdySynStreamFrame.isTruncated()) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INTERNAL_ERROR);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INTERNAL_ERROR);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -149,7 +152,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// SYN_STREAM frames initiated by the client are HTTP requests
|
// SYN_STREAM frames initiated by the client are HTTP requests
|
||||||
@ -163,7 +166,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
spdySynReplyFrame,
|
spdySynReplyFrame,
|
||||||
HttpResponseStatus.REQUEST_HEADER_FIELDS_TOO_LARGE);
|
HttpResponseStatus.REQUEST_HEADER_FIELDS_TOO_LARGE);
|
||||||
SpdyHeaders.setVersion(spdyVersion, spdySynReplyFrame, HttpVersion.HTTP_1_0);
|
SpdyHeaders.setVersion(spdyVersion, spdySynReplyFrame, HttpVersion.HTTP_1_0);
|
||||||
out.add(spdySynReplyFrame);
|
ctx.writeAndFlush(spdySynReplyFrame);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -186,7 +190,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
spdySynReplyFrame.setLast(true);
|
spdySynReplyFrame.setLast(true);
|
||||||
SpdyHeaders.setStatus(spdyVersion, spdySynReplyFrame, HttpResponseStatus.BAD_REQUEST);
|
SpdyHeaders.setStatus(spdyVersion, spdySynReplyFrame, HttpResponseStatus.BAD_REQUEST);
|
||||||
SpdyHeaders.setVersion(spdyVersion, spdySynReplyFrame, HttpVersion.HTTP_1_0);
|
SpdyHeaders.setVersion(spdyVersion, spdySynReplyFrame, HttpVersion.HTTP_1_0);
|
||||||
out.add(spdySynReplyFrame);
|
ctx.writeAndFlush(spdySynReplyFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +204,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
if (spdySynReplyFrame.isTruncated()) {
|
if (spdySynReplyFrame.isTruncated()) {
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INTERNAL_ERROR);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.INTERNAL_ERROR);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -221,7 +226,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
|
|||||||
// the client must reply with a RST_STREAM frame indicating a PROTOCOL_ERROR
|
// the client must reply with a RST_STREAM frame indicating a PROTOCOL_ERROR
|
||||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||||
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
new DefaultSpdyRstStreamFrame(streamId, SpdyStreamStatus.PROTOCOL_ERROR);
|
||||||
out.add(spdyRstStreamFrame);
|
ctx.writeAndFlush(spdyRstStreamFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (msg instanceof SpdyHeadersFrame) {
|
} else if (msg instanceof SpdyHeadersFrame) {
|
||||||
|
Loading…
Reference in New Issue
Block a user