https://bz.apache.org/bugzilla/show_bug.cgi?id=65340
--- Comment #8 from linking12 <297442...@qq.com> --- (In reply to gr...@webtide.com from comment #5) > Mark, I can't tell either if this is Jetty encoding or Tomcat decoding. > > If you want to write a test to do some jetty encodes and tomcate decodes, > then if you have a maven dependency on > org.eclipse.jetty.http2:http2-hpack:jar > the following code shows how to do jetty encoding/decoding: > > @Test > public void encodeDecodeTest() throws Exception > { > HpackEncoder encoder = new HpackEncoder(); > HpackDecoder decoder = new HpackDecoder(4096, 8192); > > HttpFields fields = new HttpFields(); > fields.add(HttpHeader.CONTENT_TYPE, "text/html"); > fields.add(HttpHeader.CONTENT_LENGTH, "1024"); > > MetaData.Request request = new MetaData.Request("POST", new > HttpURI("/test"), HttpVersion.HTTP_2, fields); > > ByteBuffer buffer = BufferUtil.allocateDirect(16 * 1024); > BufferUtil.clearToFill(buffer); > encoder.encode(buffer, request); > BufferUtil.flipToFlush(buffer, 0); > > MetaData.Request requestReceived = > (MetaData.Request)decoder.decode(buffer); > > System.err.println(requestReceived); > requestReceived.getFields().stream().forEach(System.err::println); > > MetaData.Response response = new > MetaData.Response(HttpVersion.HTTP_2, 200, fields); > > BufferUtil.clearToFill(buffer); > encoder.encode(buffer, response); > BufferUtil.flipToFlush(buffer, 0); > > MetaData.Response responseReceived = > (Response)decoder.decode(buffer); > > System.err.println(responseReceived); > responseReceived.getFields().stream().forEach(System.err::println); > } I have test your code, It is ok but we do something,and found more information,when the header is larger, it appear more frequently; we have done something: 1: when we not index and not hufman header in jetty and the header is larger than 1k, tomcat can not processs the header; 2: as thomas's reply, in javadoc in org.apache.coyote.http2.Hpack.decodeInteger(ByteBuffer, int), it can return -1, why tomcat do not process -1 to throw some more detail exception, i think it is not make sense -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org