SPDY: SpdyHeaderBlockDecoder should not discard input data
This commit is contained in:
parent
4dab51b619
commit
0c8cf5cdc8
@ -81,7 +81,6 @@ public class SpdyHeaderBlockRawDecoder extends SpdyHeaderBlockDecoder {
|
|||||||
// Try to read length of name
|
// Try to read length of name
|
||||||
if (encoded.readableBytes() < lengthFieldSize) {
|
if (encoded.readableBytes() < lengthFieldSize) {
|
||||||
encoded.resetReaderIndex();
|
encoded.resetReaderIndex();
|
||||||
encoded.discardReadBytes();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int nameLength = readLengthField(encoded);
|
int nameLength = readLengthField(encoded);
|
||||||
@ -100,7 +99,6 @@ public class SpdyHeaderBlockRawDecoder extends SpdyHeaderBlockDecoder {
|
|||||||
// Try to read name
|
// Try to read name
|
||||||
if (encoded.readableBytes() < nameLength) {
|
if (encoded.readableBytes() < nameLength) {
|
||||||
encoded.resetReaderIndex();
|
encoded.resetReaderIndex();
|
||||||
encoded.discardReadBytes();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte[] nameBytes = new byte[nameLength];
|
byte[] nameBytes = new byte[nameLength];
|
||||||
@ -116,7 +114,6 @@ public class SpdyHeaderBlockRawDecoder extends SpdyHeaderBlockDecoder {
|
|||||||
// Try to read length of value
|
// Try to read length of value
|
||||||
if (encoded.readableBytes() < lengthFieldSize) {
|
if (encoded.readableBytes() < lengthFieldSize) {
|
||||||
encoded.resetReaderIndex();
|
encoded.resetReaderIndex();
|
||||||
encoded.discardReadBytes();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int valueLength = readLengthField(encoded);
|
int valueLength = readLengthField(encoded);
|
||||||
@ -149,7 +146,6 @@ public class SpdyHeaderBlockRawDecoder extends SpdyHeaderBlockDecoder {
|
|||||||
// Try to read value
|
// Try to read value
|
||||||
if (encoded.readableBytes() < valueLength) {
|
if (encoded.readableBytes() < valueLength) {
|
||||||
encoded.resetReaderIndex();
|
encoded.resetReaderIndex();
|
||||||
encoded.discardReadBytes();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte[] valueBytes = new byte[valueLength];
|
byte[] valueBytes = new byte[valueLength];
|
||||||
|
@ -69,6 +69,7 @@ class SpdyHeaderBlockZlibDecoder extends SpdyHeaderBlockRawDecoder {
|
|||||||
if (frame != null) {
|
if (frame != null) {
|
||||||
decompressed.writeBytes(out, 0, numBytes);
|
decompressed.writeBytes(out, 0, numBytes);
|
||||||
super.decode(decompressed, frame);
|
super.decode(decompressed, frame);
|
||||||
|
decompressed.discardReadBytes();
|
||||||
}
|
}
|
||||||
return numBytes;
|
return numBytes;
|
||||||
} catch (DataFormatException e) {
|
} catch (DataFormatException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user