@@ -272,18 +272,14 @@ public void readerEviction() throws IOException {
272272
273273 /**
274274 * http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#appendix-C.2.2
275- *
276- * <p>This test mimics the draft example which uses ":path", but since gRPC-Java now indexes
277- * ":path" for performance, we use ":method" (with a non-static value like "PUT") to verify the
278- * "Literal Header Field without Indexing - Indexed Name" representation.
279275 */
280276 @ Test public void literalHeaderFieldWithoutIndexingIndexedName () throws IOException {
281- List <Header > headerBlock = headerEntries (":method " , "PUT " );
277+ List <Header > headerBlock = headerEntries (":path " , "/sample/path " );
282278
283- bytesIn .writeByte (0x02 ); // == Literal not indexed ==
284- // Indexed name (idx = 2 ) -> :method
285- bytesIn .writeByte (0x03 ); // Literal value (len = 3 )
286- bytesIn .writeUtf8 ("PUT " );
279+ bytesIn .writeByte (0x04 ); // == Literal not indexed ==
280+ // Indexed name (idx = 4 ) -> :path
281+ bytesIn .writeByte (0x0c ); // Literal value (len = 12 )
282+ bytesIn .writeUtf8 ("/sample/path " );
287283
288284 hpackWriter .writeHeaders (headerBlock );
289285 assertEquals (bytesIn , bytesOut );
@@ -1108,29 +1104,14 @@ public void dynamicTableIndexedHeader() throws IOException {
11081104 }
11091105
11101106 @ Test
1111- public void pseudoHeaderIndexing () throws IOException {
1112- // :method is not indexed (unless it's GET or POST, which are in the static table)
1107+ public void doNotIndexPseudoHeaders () throws IOException {
11131108 hpackWriter .writeHeaders (headerEntries (":method" , "PUT" ));
11141109 assertBytes (0x02 , 3 , 'P' , 'U' , 'T' );
11151110 assertEquals (0 , hpackWriter .dynamicTableHeaderCount );
11161111
1117- // :path should now be indexed
1118- hpackWriter .writeHeaders (headerEntries (":path" , "/okhttp" ));
1119- assertBytes (0x44 , 7 , '/' , 'o' , 'k' , 'h' , 't' , 't' , 'p' );
1120- assertEquals (1 , hpackWriter .dynamicTableHeaderCount );
1121- // Second time should be an index
11221112 hpackWriter .writeHeaders (headerEntries (":path" , "/okhttp" ));
1123- assertBytes (0xbe );
1124- assertEquals (1 , hpackWriter .dynamicTableHeaderCount );
1125-
1126- // :authority should be indexed
1127- hpackWriter .writeHeaders (headerEntries (":authority" , "test.com" ));
1128- assertBytes (0x41 , 8 , 't' , 'e' , 's' , 't' , '.' , 'c' , 'o' , 'm' );
1129- assertEquals (2 , hpackWriter .dynamicTableHeaderCount );
1130- // Second time should be an index
1131- hpackWriter .writeHeaders (headerEntries (":authority" , "test.com" ));
1132- assertBytes (0xbe );
1133- assertEquals (2 , hpackWriter .dynamicTableHeaderCount );
1113+ assertBytes (0x04 , 7 , '/' , 'o' , 'k' , 'h' , 't' , 't' , 'p' );
1114+ assertEquals (0 , hpackWriter .dynamicTableHeaderCount );
11341115 }
11351116
11361117 @ Test
0 commit comments