SPDY: remove unused code in SpdyHeaderBlockRawEncoder

This commit is contained in:
Jeff Pinner 2014-05-04 13:17:30 -07:00 committed by Norman Maurer
parent 31b01c87e4
commit 78963635ba

View File

@ -34,20 +34,12 @@ public class SpdyHeaderBlockRawEncoder extends SpdyHeaderBlockEncoder {
} }
private void setLengthField(ByteBuf buffer, int writerIndex, int length) { private void setLengthField(ByteBuf buffer, int writerIndex, int length) {
if (version < 3) {
buffer.setShort(writerIndex, length);
} else {
buffer.setInt(writerIndex, length); buffer.setInt(writerIndex, length);
} }
}
private void writeLengthField(ByteBuf buffer, int length) { private void writeLengthField(ByteBuf buffer, int length) {
if (version < 3) {
buffer.writeShort(length);
} else {
buffer.writeInt(length); buffer.writeInt(length);
} }
}
@Override @Override
public ByteBuf encode(SpdyHeadersFrame frame) throws Exception { public ByteBuf encode(SpdyHeadersFrame frame) throws Exception {
@ -77,12 +69,7 @@ public class SpdyHeaderBlockRawEncoder extends SpdyHeaderBlockEncoder {
valueLength += valueBytes.length + 1; valueLength += valueBytes.length + 1;
} }
} }
if (valueLength == 0) { if (valueLength != 0) {
if (version < 3) {
throw new IllegalArgumentException(
"header value cannot be empty: " + name);
}
} else {
valueLength --; valueLength --;
} }
if (valueLength > SPDY_MAX_NV_LENGTH) { if (valueLength > SPDY_MAX_NV_LENGTH) {