private String handleIndexedHeaderName(int index) throws HpackException { if (index <= Hpack.STATIC_TABLE_LENGTH) { return Hpack.STATIC_TABLE[index].name; } else { // index is 1 based if (index > Hpack.STATIC_TABLE_LENGTH + filledTableSlots) { throw new HpackException(sm.getString("hpackdecoder.headerTableIndexInvalid", Integer.valueOf(index), Integer.valueOf(Hpack.STATIC_TABLE_LENGTH), Integer.valueOf(filledTableSlots))); } int adjustedIndex = getRealIndex(index - Hpack.STATIC_TABLE_LENGTH); Hpack.HeaderField res = headerTable[adjustedIndex]; if (res == null) { throw new HpackException(); } return res.name; } }
/** * because we use a ring buffer type construct, and don't actually shuffle * items in the array, we need to figure out the real index to use. * <p/> * package private for unit tests * * @param index The index from the hpack * @return the real index into the array */ int getRealIndex(int index) throws HpackException { //the index is one based, but our table is zero based, hence -1 //also because of our ring buffer setup the indexes are reversed //index = 1 is at position firstSlotPosition + filledSlots int realIndex = (firstSlotPosition + (filledTableSlots - index)) % headerTable.length; if (realIndex < 0) { throw new HpackException(sm.getString("hpackdecoder.headerTableIndexInvalid", Integer.valueOf(index), Integer.valueOf(Hpack.STATIC_TABLE_LENGTH), Integer.valueOf(filledTableSlots))); } return realIndex; }
private boolean handleMaxMemorySizeChange(ByteBuffer buffer, int originalPos) throws HpackException { if (headerCount != 0) { throw new HpackException(sm.getString("hpackdecoder.tableSizeUpdateNotAtStart")); throw new HpackException();
do { if(count++ > MAX_INTEGER_OCTETS) { throw new HpackException(sm.getString("hpack.integerEncodedOverTooManyOctets", Integer.valueOf(MAX_INTEGER_OCTETS)));
throw new HpackException(sm.getString( "hpackhuffman.stringLiteralTooMuchPadding")); throw new HpackException(sm.getString( "hpackhuffman.huffmanEncodedHpackValueDidNotEndWithEOS"));
throw new HpackException(sm.getString("stream.header.case", getConnectionId(), getIdentifier(), name)); throw new HpackException(sm.getString("stream.header.connection", getConnectionId(), getIdentifier())); throw new HpackException(sm.getString("stream.header.te", getConnectionId(), getIdentifier(), value)); coyoteRequest.method().setString(value); } else { throw new HpackException(sm.getString("stream.header.duplicate", getConnectionId(), getIdentifier(), ":method" )); coyoteRequest.scheme().setString(value); } else { throw new HpackException(sm.getString("stream.header.duplicate", getConnectionId(), getIdentifier(), ":scheme" )); throw new HpackException(sm.getString("stream.header.duplicate", getConnectionId(), getIdentifier(), ":path" )); throw new HpackException(sm.getString("stream.header.noPath", getConnectionId(), getIdentifier())); throw new HpackException(sm.getString("stream.header.invalid", getConnectionId(), getIdentifier(), ":authority", value)); throw new HpackException(sm.getString("stream.header.duplicate",