@Test public void decodeLargerThanHeaderListSizeButLessThanGoAwayWithInitialDecoderSettings() throws Exception { ByteBuf buf = encode(b(":method"), b("GET"), b("test_header"), b(String.format("%09000d", 0).replace('0', 'A'))); final int streamId = 1; try { decoder.decodeHeaders(streamId, buf); fail(); } catch (Http2Exception.HeaderListSizeException e) { assertEquals(streamId, e.streamId()); } finally { buf.release(); } }
@Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); @Override void maxHeaderTableSize(long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(long max, long goAwayMax); @Override long maxHeaderListSize(); @Override long maxHeaderListSizeGoAway(); @Override Configuration configuration(); @Override Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock); }
DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration { @Override public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders); headerArraySizeAccumulator = HEADERS_COUNT_WEIGHT_NEW * headers.size() + HEADERS_COUNT_WEIGHT_HISTORICAL * headerArraySizeAccumulator; return headers; } catch (Http2Exception e) { throw e; } catch (Throwable e) { throw connectionError(COMPRESSION_ERROR, e, e.getMessage()); } } DefaultHttp2HeadersDecoder();  DefaultHttp2HeadersDecoder(boolean validateHeaders);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize);  DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      int initialHuffmanDecodeCapacity);   DefaultHttp2HeadersDecoder(boolean validateHeaders, HpackDecoder hpackDecoder); @Override void maxHeaderTableSize(long max); @Override long maxHeaderTableSize(); @Override void maxHeaderListSize(long max, long goAwayMax); @Override long maxHeaderListSize(); @Override long maxHeaderListSizeGoAway(); @Override Configuration configuration(); @Override Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock);  }