idnits 2.17.1 draft-ietf-httpbis-header-compression-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The abstract seems to contain references ([2], [3], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 246: '...uplicate entries MUST NOT be treated a...' RFC 2119 keyword, line 329: '...ny other indices MUST be treated as er...' RFC 2119 keyword, line 340: '... decoder MAY pass the emitted header...' RFC 2119 keyword, line 355: '...r set, a decoder MUST obey the followi...' RFC 2119 keyword, line 429: '...The size of the header table MUST stay...' (3 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1105 has weird spacing: '... sym as ...' -- The document date (February 13, 2014) is 3723 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 19 -- Looks like a reference, but probably isn't: '2' on line 21 -- Looks like a reference, but probably isn't: '3' on line 22 -- Looks like a reference, but probably isn't: '4' on line 1207 -- Looks like a reference, but probably isn't: '27' on line 1269 -- Looks like a reference, but probably isn't: '8' on line 1228 -- Looks like a reference, but probably isn't: '12' on line 1232 -- Looks like a reference, but probably isn't: '14' on line 1200 -- Looks like a reference, but probably isn't: '15' on line 1145 -- Looks like a reference, but probably isn't: '6' on line 1225 -- Looks like a reference, but probably isn't: '7' on line 1224 -- Looks like a reference, but probably isn't: '11' on line 1230 -- Looks like a reference, but probably isn't: '10' on line 1196 -- Looks like a reference, but probably isn't: '5' on line 1222 -- Looks like a reference, but probably isn't: '9' on line 1195 -- Looks like a reference, but probably isn't: '18' on line 1166 -- Looks like a reference, but probably isn't: '17' on line 1231 -- Looks like a reference, but probably isn't: '13' on line 1199 -- Looks like a reference, but probably isn't: '19' on line 1202 -- Looks like a reference, but probably isn't: '26' on line 1362 == Outdated reference: A later version (-17) exists of draft-ietf-httpbis-http2-10 Summary: 3 errors (**), 0 flaws (~~), 3 warnings (==), 21 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis Working Group R. Peon 3 Internet-Draft Google, Inc 4 Intended status: Standards Track H. Ruellan 5 Expires: August 17, 2014 Canon CRF 6 February 13, 2014 8 HPACK - Header Compression for HTTP/2 9 draft-ietf-httpbis-header-compression-06 11 Abstract 13 This specification defines HPACK, a compression format for 14 efficiently representing HTTP header fields in the context of HTTP/2. 16 Editorial Note (To be removed by RFC Editor) 18 Discussion of this draft takes place on the HTTPBIS working group 19 mailing list (ietf-http-wg@w3.org), which is archived at [1]. 21 Working Group information and related documents can be found at [2] 22 (Wiki) and [3] (source code and issues tracker). 24 The changes in this draft are summarized in Appendix A.1. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on August 17, 2014. 43 Copyright Notice 45 Copyright (c) 2014 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 3 62 2.1. Outline . . . . . . . . . . . . . . . . . . . . . . . . . 4 63 3. Header Field Encoding . . . . . . . . . . . . . . . . . . . . 4 64 3.1. Encoding Concepts . . . . . . . . . . . . . . . . . . . . 4 65 3.1.1. Encoding Context . . . . . . . . . . . . . . . . . . 5 66 3.1.2. Header Table . . . . . . . . . . . . . . . . . . . . 5 67 3.1.3. Reference Set . . . . . . . . . . . . . . . . . . . . 6 68 3.1.4. Header Field Representation . . . . . . . . . . . . . 7 69 3.1.5. Header Field Emission . . . . . . . . . . . . . . . . 8 70 3.2. Header Block Decoding . . . . . . . . . . . . . . . . . . 8 71 3.2.1. Header Field Representation Processing . . . . . . . 8 72 3.2.2. Reference Set Emission . . . . . . . . . . . . . . . 9 73 3.2.3. Header Set Completion . . . . . . . . . . . . . . . . 9 74 3.3. Header Table Management . . . . . . . . . . . . . . . . . 9 75 3.3.1. Maximum Table Size . . . . . . . . . . . . . . . . . 10 76 3.3.2. Entry Eviction When Header Table Size Changes . . . . 10 77 3.3.3. Entry Eviction when Adding New Entries . . . . . . . 10 78 4. Detailed Format . . . . . . . . . . . . . . . . . . . . . . . 11 79 4.1. Low-level representations . . . . . . . . . . . . . . . . 11 80 4.1.1. Integer representation . . . . . . . . . . . . . . . 11 81 4.1.2. String Literal Representation . . . . . . . . . . . . 13 82 4.2. Indexed Header Field Representation . . . . . . . . . . . 15 83 4.3. Literal Header Field Representation . . . . . . . . . . . 15 84 4.3.1. Literal Header Field without Indexing . . . . . . . . 15 85 4.3.2. Literal Header Field with Incremental Indexing . . . 16 86 4.4. Encoding Context Update . . . . . . . . . . . . . . . . . 17 87 5. Security Considerations . . . . . . . . . . . . . . . . . . . 18 88 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 19 89 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 90 7.1. Normative References . . . . . . . . . . . . . . . . . . 19 91 7.2. Informative References . . . . . . . . . . . . . . . . . 19 92 Appendix A. Change Log (to be removed by RFC Editor before 93 publication . . . . . . . . . . . . . . . . . . . . 20 94 A.1. Since draft-ietf-httpbis-header-compression-05 . . . . . 20 95 A.2. Since draft-ietf-httpbis-header-compression-04 . . . . . 20 96 A.3. Since draft-ietf-httpbis-header-compression-03 . . . . . 21 97 A.4. Since draft-ietf-httpbis-header-compression-02 . . . . . 21 98 A.5. Since draft-ietf-httpbis-header-compression-01 . . . . . 21 99 A.6. Since draft-ietf-httpbis-header-compression-00 . . . . . 21 100 Appendix B. Static Table . . . . . . . . . . . . . . . . . . . . 22 101 Appendix C. Huffman Codes . . . . . . . . . . . . . . . . . . . 24 102 Appendix D. Examples . . . . . . . . . . . . . . . . . . . . . . 29 103 D.1. Header Field Representation Examples . . . . . . . . . . 30 104 D.1.1. Literal Header Field with Indexing . . . . . . . . . 30 105 D.1.2. Literal Header Field without Indexing . . . . . . . . 30 106 D.1.3. Indexed Header Field . . . . . . . . . . . . . . . . 31 107 D.1.4. Indexed Header Field from Static Table . . . . . . . 32 108 D.2. Request Examples without Huffman . . . . . . . . . . . . 33 109 D.2.1. First request . . . . . . . . . . . . . . . . . . . . 33 110 D.2.2. Second request . . . . . . . . . . . . . . . . . . . 34 111 D.2.3. Third request . . . . . . . . . . . . . . . . . . . . 35 112 D.3. Request Examples with Huffman . . . . . . . . . . . . . . 37 113 D.3.1. First request . . . . . . . . . . . . . . . . . . . . 37 114 D.3.2. Second request . . . . . . . . . . . . . . . . . . . 38 115 D.3.3. Third request . . . . . . . . . . . . . . . . . . . . 40 116 D.4. Response Examples without Huffman . . . . . . . . . . . . 42 117 D.4.1. First response . . . . . . . . . . . . . . . . . . . 42 118 D.4.2. Second response . . . . . . . . . . . . . . . . . . . 44 119 D.4.3. Third response . . . . . . . . . . . . . . . . . . . 45 120 D.5. Response Examples with Huffman . . . . . . . . . . . . . 47 121 D.5.1. First response . . . . . . . . . . . . . . . . . . . 47 122 D.5.2. Second response . . . . . . . . . . . . . . . . . . . 50 123 D.5.3. Third response . . . . . . . . . . . . . . . . . . . 51 125 1. Introduction 127 This specification defines HPACK, a compression format for 128 efficiently representing HTTP header fields in the context of HTTP/2 129 (see [HTTP2]). 131 2. Overview 133 In HTTP/1.1 (see [HTTP-p1]), header fields are encoded without any 134 form of compression. As web pages have grown to include dozens to 135 hundreds of requests, the redundant header fields in these requests 136 now measurably increase latency and unnecessarily consume bandwidth 137 (see [PERF1] and [PERF2]). 139 SPDY [SPDY] initially addressed this redundancy by compressing header 140 fields using the DEFLATE format [DEFLATE], which proved very 141 effective at efficiently representing the redundant header fields. 142 However, that approach exposed a security risk as demonstrated by the 143 CRIME attack (see [CRIME]). 145 This document describes HPACK, a new compressor for header fields 146 which eliminates redundant header fields, is not vulnerable to known 147 security attacks, and which also has a bounded memory requirement for 148 use in constrained environments. 150 2.1. Outline 152 The HTTP header field encoding defined in this document is based on a 153 header table that maps name-value pairs to index values. The header 154 table is incrementally updated during the HTTP/2 connection. 156 A set of header fields is treated as an unordered collection of name- 157 value pairs. Names and values are considered to be opaque sequences 158 of octets. The order of header fields is not guaranteed to be 159 preserved after being compressed and decompressed. 161 As two consecutive sets of header fields often have header fields in 162 common, each set is coded as a difference from the previous set. The 163 goal is to only encode the changes (header fields present in one of 164 the sets that are absent from the other) between the two sets of 165 header fields. 167 A header field is represented either literally or as a reference to a 168 name-value pair in the header table. A set of header fields is 169 stored as a set of references to entries in the header table 170 (possibly keeping only a subset of it, as some header fields may be 171 missing a corresponding entry in the header table). Differences 172 between consecutive sets of header fields are encoded as changes to 173 the set of references. 175 The encoder is responsible for deciding which header fields to insert 176 as new entries in the header table. The decoder executes the 177 modifications to the header table and reference set prescribed by the 178 encoder, reconstructing the set of header fields in the process. 179 This enables decoders to remain simple and understand a wide variety 180 of encoders. 182 Examples illustrating the use of these different mechanisms to 183 represent header fields are available in Appendix D. 185 3. Header Field Encoding 187 3.1. Encoding Concepts 189 The encoding and decoding of header fields relies on some components 190 and concepts: 192 Header Field: A name-value pair. Both the name and value are 193 treated as opaque sequences of octets. 195 Header Table: The header table (see Section 3.1.2) is a component 196 used to associate stored header fields to index values. 198 Static Table: The static table (see Appendix B) is a component used 199 to associate static header fields to index values. This data is 200 ordered, read-only, always accessible, and may be shared amongst 201 all encoding contexts. 203 Reference Set: The reference set (see Section 3.1.3) is a component 204 containing an unordered set of references to entries in the header 205 table. This is used for the differential encoding of a new header 206 set. 208 Header Set: A header set is an unordered group of header fields that 209 are encoded jointly. A complete set of key-value pairs contained 210 in a HTTP request or response is a header set. 212 Header Field Representation: A header field can be represented in 213 encoded form either as a literal or as an index (see 214 Section 3.1.4). 216 Header Block: The entire set of encoded header field representations 217 which, when decoded, yield a complete header set. 219 Header Field Emission: When decoding a set of header field 220 representations, some operations emit a header field (see 221 Section 3.1.5). Emitted header fields are added to the current 222 header set and cannot be removed. 224 3.1.1. Encoding Context 226 The set of mutable structures used within an encoding context include 227 a header table and a reference set. Everything else is either 228 immutable or conceptual. 230 HTTP messages are exchanged between a client and a server in both 231 directions. The encoding of header fields in each direction is 232 independent from the other direction. There is a single encoding 233 context for each direction used to encode all header fields sent in 234 that direction. 236 3.1.2. Header Table 238 A header table consists of a list of header fields maintained in 239 first-in, first-out order. The first and newest entry in a header 240 table is always at index 1, and the oldest entry of a header table is 241 at the index len(header table). 243 The header table is initially empty. 245 There is typically no need for the header table to contain duplicate 246 entries. However, duplicate entries MUST NOT be treated as an error 247 by a decoder. 249 The encoder decides how to update the header table and as such can 250 control how much memory is used by the header table. To limit the 251 memory requirements of the decoder, the header table size is strictly 252 bounded (see Section 3.3.1). 254 The header table is updated during the processing of a set of header 255 field representations (see Section 3.2.1). 257 3.1.3. Reference Set 259 A reference set is an unordered set of references to entries of the 260 header table. 262 The reference set is initially empty. 264 The reference set is updated during the processing of a set of header 265 field representations (see Section 3.2.1). 267 The reference set enables differential encoding, whereby only 268 differences between the previous header set and the current header 269 set need to be encoded. The use of differential encoding is optional 270 for any header set. 272 When an entry is evicted from the header table, if it was referenced 273 from the reference set, its reference is removed from the reference 274 set. 276 To limit the memory requirements on the decoder side for handling the 277 reference set, only entries within the header table can be contained 278 in the reference set. To still allow entries from the static table 279 to take advantage of the differential encoding, when a header field 280 is represented as a reference to an entry of the static table, this 281 entry is inserted into the header table (see Section 3.2.1). 283 3.1.4. Header Field Representation 285 An encoded header field can be represented either as a literal or as 286 an index. 288 Literal Representation: A literal representation defines a new 289 header field. The header field name is represented either 290 literally or as a reference to an entry of the header table. The 291 header field value is represented literally. 293 Two different literal representations are provided: 295 * A literal representation that does not add the header field to 296 the header table (see Section 4.3.1). 298 * A literal representation that adds the header field as a new 299 entry at the beginning of the header table (see Section 4.3.2). 301 Indexed Representation: The indexed representation defines a header 302 field as a reference to an entry in either the header table or the 303 static table (see Section 4.2). 305 <---------- Index Address Space ----------> 306 <-- Header Table --> <-- Static Table --> 307 +---+-----------+---+ +---+-----------+---+ 308 | 1 | ... | k | |k+1| ... | n | 309 +---+-----------+---+ +---+-----------+---+ 310 ^ | 311 | V 312 Insertion Point Drop Point 314 Index Address Space 316 Indices between 1 and len(header table), inclusive, refer to 317 elements in the header table, with index 1 referring to the 318 beginning of the table. 320 Indices between len(header table)+1 and len(header 321 table)+len(static table), inclusive, refer to elements in the 322 static table, where the index len(header table)+1 refers to the 323 first entry in the static table. 325 Index 0 signals a modification of the encoding context: either 326 the reference set is emptied, or the maximum size of the header 327 table is updated (see Section 4.4). 329 Any other indices MUST be treated as erroneous, and the 330 compression context considered corrupt and unusable. 332 3.1.5. Header Field Emission 334 The emission of a header field is the process of marking a header 335 field as belonging to the current header set. Once a header has been 336 emitted, it cannot be removed from the current header set. 338 On the decoding side, an emitted header field can be safely passed to 339 the upper processing layer as part of the current header set. The 340 decoder MAY pass the emitted header fields to the upper processing 341 layer in any order. 343 By emitting header fields instead of emitting header sets, the 344 decoder can be implemented in a streaming way, and as such has only 345 to keep in memory the header table and the reference set. This 346 bounds the amount of memory used by the decoder, even in presence of 347 a very large set of header fields. The management of memory for 348 handling very large sets of header fields can therefore be deferred 349 to the upper processing layers. 351 3.2. Header Block Decoding 353 The processing of a header block to obtain a header set is defined in 354 this section. To ensure that the decoding will successfully produce 355 a header set, a decoder MUST obey the following rules. 357 3.2.1. Header Field Representation Processing 359 All the header field representations contained in a header block are 360 processed in the order in which they are presented, as specified 361 below. 363 An _indexed representation_ with an index value of 0 entails one of 364 the following actions, depending on what is encoded next: 366 o The reference set is emptied. 368 o The maximum size of the header table is updated. 370 An _indexed representation_ corresponding to an entry _present_ in 371 the reference set entails the following actions: 373 o The entry is removed from the reference set. 375 An _indexed representation_ corresponding to an entry _not present_ 376 in the reference set entails the following actions: 378 o If referencing an element of the static table: 380 * The header field corresponding to the referenced entry is 381 emitted. 383 * The referenced static entry is inserted at the beginning of the 384 header table. 386 * A reference to this new header table entry is added to the 387 reference set (except if this new entry didn't fit in the 388 header table). 390 o If referencing an element of the header table: 392 * The header field corresponding to the referenced entry is 393 emitted. 395 * The referenced header table entry is added to the reference 396 set. 398 A _literal representation_ that is _not added_ to the header table 399 entails the following action: 401 o The header field is emitted. 403 A _literal representation_ that is _added_ to the header table 404 entails the following actions: 406 o The header field is emitted. 408 o The header field is inserted at the beginning of the header table. 410 o A reference to the new entry is added to the reference set (except 411 if this new entry didn't fit in the header table). 413 3.2.2. Reference Set Emission 415 Once all the representations contained in a header block have been 416 processed, the header fields referenced in the reference set which 417 have not previously been emitted during this processing are emitted. 419 3.2.3. Header Set Completion 421 Once all of the header field representations have been processed, and 422 the remaining items in the reference set have been emitted, the 423 header set is complete. 425 3.3. Header Table Management 426 3.3.1. Maximum Table Size 428 To limit the memory requirements on the decoder side, the size of the 429 header table is bounded. The size of the header table MUST stay 430 lower than or equal to its maximum size. 432 By default, the maximum size of the header table is equal to the 433 value of the HTTP/2 setting SETTINGS_HEADER_TABLE_SIZE defined by the 434 decoder (see [HTTP2]). The encoder can change this maximum size (see 435 Section 4.4), but it must stay lower than or equal to the value of 436 SETTINGS_HEADER_TABLE_SIZE. 438 The size of the header table is the sum of the size of its entries. 440 The size of an entry is the sum of its name's length in octets (as 441 defined in Section 4.1.2), of its value's length in octets 442 (Section 4.1.2) and of 32 octets. 444 The lengths are measured on the non-encoded entry name and entry 445 value (for the case when a Huffman encoding is used to transmit 446 string values). 448 The 32 octets are an accounting for the entry structure overhead. 449 For example, an entry structure using two 64-bits pointers to 450 reference the name and the value and the entry, and two 64-bits 451 integer for counting the number of references to these name and value 452 would use 32 octets. 454 3.3.2. Entry Eviction When Header Table Size Changes 456 Whenever an entry is evicted from the header table, any reference to 457 that entry contained by the reference set is removed. 459 Whenever the maximum size for the header table is made smaller, 460 entries are evicted from the end of the header table until the size 461 of the header table is less than or equal to the maximum size. 463 The eviction of an entry from the header table causes the index of 464 the entries in the static table to be reduced by one. 466 3.3.3. Entry Eviction when Adding New Entries 468 Whenever a new entry is to be added to the table, any name referenced 469 by the representation of this new entry is cached, and then entries 470 are evicted from the end of the header table until the size of the 471 header table is less than or equal to (maximum size - new entry 472 size), or until the table is empty. 474 If the size of the new entry is less than or equal to the maximum 475 size, that entry is added to the table. It is not an error to 476 attempt to add an entry that is larger than the maximum size. 478 4. Detailed Format 480 4.1. Low-level representations 482 4.1.1. Integer representation 484 Integers are used to represent name indexes, pair indexes or string 485 lengths. To allow for optimized processing, an integer 486 representation always finishes at the end of an octet. 488 An integer is represented in two parts: a prefix that fills the 489 current octet and an optional list of octets that are used if the 490 integer value does not fit within the prefix. The number of bits of 491 the prefix (called N) is a parameter of the integer representation. 493 The N-bit prefix allows filling the current octet. If the value is 494 small enough (strictly less than 2^N-1), it is encoded within the 495 N-bit prefix. Otherwise all the bits of the prefix are set to 1 and 496 the value is encoded using an unsigned variable length integer [4] 497 representation. N is always between 1 and 8 bits. An integer 498 starting at an octet-boundary will have an 8-bit prefix. 500 The algorithm to represent an integer I is as follows: 502 if I < 2^N - 1, encode I on N bits 503 else 504 encode (2^N - 1) on N bits 505 I = I - (2^N - 1) 506 while I >= 128 507 encode (I % 128 + 128) on 8 bits 508 I = I / 128 509 encode I on 8 bits 511 For informational purpose, the algorithm to decode an integer I is as 512 follows: 514 decode I from the next N bits 515 if I < 2^N - 1, return I 516 else 517 M = 0 518 repeat 519 B = next octet 520 I = I + (B & 127) * 2^M 521 M = M + 7 522 while B & 128 == 128 523 return I 525 This integer representation allows for values of indefinite size. It 526 is also possible for an encoder to send a large number of zero 527 values, which can waste octets and could be used to overflow integer 528 values. Excessively large integer encodings - in value or octet 529 length - MUST be treated as a decoding error. Different limits can 530 be set for each of the different uses of integers, based on 531 implementation constraints. 533 4.1.1.1. Example 1: Encoding 10 using a 5-bit prefix 535 The value 10 is to be encoded with a 5-bit prefix. 537 o 10 is less than 31 (= 2^5 - 1) and is represented using the 5-bit 538 prefix. 540 0 1 2 3 4 5 6 7 541 +---+---+---+---+---+---+---+---+ 542 | X | X | X | 0 | 1 | 0 | 1 | 0 | 10 stored on 5 bits 543 +---+---+---+---+---+---+---+---+ 545 4.1.1.2. Example 2: Encoding 1337 using a 5-bit prefix 547 The value I=1337 is to be encoded with a 5-bit prefix. 549 1337 is greater than 31 (= 2^5 - 1). 551 The 5-bit prefix is filled with its max value (31). 553 I = 1337 - (2^5 - 1) = 1306. 555 I (1306) is greater than or equal to 128, the while loop body 556 executes: 558 I % 128 == 26 560 26 + 128 == 154 561 154 is encoded in 8 bits as: 10011010 563 I is set to 10 (1306 / 128 == 10) 565 I is no longer greater than or equal to 128, the while loop 566 terminates. 568 I, now 10, is encoded on 8 bits as: 00001010 570 The process ends. 572 0 1 2 3 4 5 6 7 573 +---+---+---+---+---+---+---+---+ 574 | X | X | X | 1 | 1 | 1 | 1 | 1 | Prefix = 31, I = 1306 575 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1306>=128, encode(154), I=1306/128 576 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 10<128, encode(10), done 577 +---+---+---+---+---+---+---+---+ 579 4.1.1.3. Example 3: Encoding 42 starting at an octet-boundary 581 The value 42 is to be encoded starting at an octet-boundary. This 582 implies that a 8-bit prefix is used. 584 o 42 is less than 255 (= 2^8 - 1) and is represented using the 8-bit 585 prefix. 587 0 1 2 3 4 5 6 7 588 +---+---+---+---+---+---+---+---+ 589 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 42 stored on 8 bits 590 +---+---+---+---+---+---+---+---+ 592 4.1.2. String Literal Representation 594 Header field names and header field values are encoded as sequences 595 of octets. A header field name or a header field value is encoded in 596 three parts: 598 1. One bit, H, indicating whether or not the octets are Huffman 599 encoded. 601 2. The number of octets required to hold the result of the next 602 step, represented as an integer with a 7-bit prefix (see 603 Section 4.1.1), immediately following the first bit. 605 3. The encoded data of the string: 607 * If H is '1', then the encoded string data is the bitwise 608 concatenation of the canonical [CANON] Huffman code [HUFF] 609 corresponding to each octet of the data, followed by between 610 0-7 bits of padding. 612 * If H is '0', then the encoded string is the octets of the 613 field value without modification. 615 Padding is necessary when doing Huffman encoding to ensure that the 616 remaining bits between the actual end of the data and the next octet 617 boundary are not misinterpreted as part of the input data. 619 When padding for Huffman encoding, the bits from the EOS (end-of- 620 string) entry in the Huffman table are used, starting with the MSB 621 (most significant bit). This entry is guaranteed to be at least 8 622 bits long. 624 String literals which use Huffman encoding are encoded with the 625 Huffman Codes Appendix C (see examples in Request Examples with 626 Huffman Appendix D.3 and in Response Examples with Huffman 627 Appendix D.5). 629 The EOS symbol is represented with value 256, and is used solely to 630 signal the end of the Huffman-encoded key data or the end of the 631 Huffman-encoded value data. Given that only between 0-7 bits of the 632 EOS symbol is included in any Huffman-encoded string, and given that 633 the EOS symbol is at least 8 bits long, it is expected that it should 634 never be successfully decoded. 636 0 1 2 3 4 5 6 7 637 +---+---+---+---+---+---+---+---+ 638 | 1 | Value Length Prefix (7) | 639 +---+---+---+---+---+---+---+---+ 640 | Value Length (0-N octets) | 641 +---+---+---+---+---+---+---+---+ 642 ... 643 +---+---+---+---+---+---+---+---+ 644 | Huffman Encoded Data |Padding| 645 +---+---+---+---+---+---+---+---+ 647 String Literal with Huffman Encoding 649 0 1 2 3 4 5 6 7 650 +---+---+---+---+---+---+---+---+ 651 | 0 | Value Length Prefix (7) | 652 +---+---+---+---+---+---+---+---+ 653 | Value Length (0-N octets) | 654 +---+---+---+---+---+---+---+---+ 655 ... 656 +---+---+---+---+---+---+---+---+ 657 | Field Bytes without Encoding | 658 +---+---+---+---+---+---+---+---+ 660 String Literal without Huffman Encoding 662 4.2. Indexed Header Field Representation 664 An indexed header field representation either identifies an entry in 665 the header table or static table. The processing of an indexed 666 header field representation is described in Section 3.2.1. 668 0 1 2 3 4 5 6 7 669 +---+---+---+---+---+---+---+---+ 670 | 1 | Index (7+) | 671 +---+---------------------------+ 673 Indexed Header Field 675 This representation starts with the '1' 1-bit pattern, followed by 676 the index of the matching pair, represented as an integer with a 677 7-bit prefix. 679 The index value of 0 is reserved for signalling changes in the 680 encoding context (see Section 4.4). 682 4.3. Literal Header Field Representation 684 Literal header field representations contain a literal header field 685 value. Header field names are either provided as a literal or by 686 reference to an existing header table or static table entry. 688 Literal representations all result in the emission of a header field 689 when decoded. 691 4.3.1. Literal Header Field without Indexing 693 A literal header field without indexing causes the emission of a 694 header field without altering the header table. 696 0 1 2 3 4 5 6 7 697 +---+---+---+---+---+---+---+---+ 698 | 0 | 1 | Index (6+) | 699 +---+---+---+-------------------+ 700 | H | Value Length (7+) | 701 +---+---------------------------+ 702 | Value String (Length octets) | 703 +-------------------------------+ 705 Literal Header Field without Indexing - Indexed Name 707 0 1 2 3 4 5 6 7 708 +---+---+---+---+---+---+---+---+ 709 | 0 | 1 | 0 | 710 +---+---+---+-------------------+ 711 | H | Name Length (7+) | 712 +---+---------------------------+ 713 | Name String (Length octets) | 714 +---+---------------------------+ 715 | H | Value Length (7+) | 716 +---+---------------------------+ 717 | Value String (Length octets) | 718 +-------------------------------+ 720 Literal Header Field without Indexing - New Name 722 This representation starts with the '01' 2-bit pattern. 724 If the header field name matches the header field name of a (name, 725 value) pair stored in the Header Table or Static Table, the header 726 field name can be represented using the index of that entry. In this 727 case, the index of the entry, index (which is strictly greater than 728 0), is represented as an integer with a 6-bit prefix (see 729 Section 4.1.1). 731 Otherwise, the header field name is represented as a literal. The 732 value 0 is represented on 6 bits followed by the header field name 733 (see Section 4.1.2). 735 The header field name representation is followed by the header field 736 value represented as a literal string as described in Section 4.1.2. 738 4.3.2. Literal Header Field with Incremental Indexing 740 A literal header field with incremental indexing adds a new entry to 741 the header table. 743 0 1 2 3 4 5 6 7 744 +---+---+---+---+---+---+---+---+ 745 | 0 | 0 | Index (6+) | 746 +---+---+---+-------------------+ 747 | H | Value Length (7+) | 748 +---+---------------------------+ 749 | Value String (Length octets) | 750 +-------------------------------+ 751 Literal Header Field with Incremental Indexing - Indexed Name 753 0 1 2 3 4 5 6 7 754 +---+---+---+---+---+---+---+---+ 755 | 0 | 0 | 0 | 756 +---+---+---+-------------------+ 757 | H | Name Length (7+) | 758 +---+---------------------------+ 759 | Name String (Length octets) | 760 +---+---------------------------+ 761 | H | Value Length (7+) | 762 +---+---------------------------+ 763 | Value String (Length octets) | 764 +-------------------------------+ 766 Literal Header Field with Incremental Indexing - New Name 768 This representation starts with the '00' 2-bit pattern. 770 If the header field name matches the header field name of a (name, 771 value) pair stored in the Header Table or Static Table, the header 772 field name can be represented using the index of that entry. In this 773 case, the index of the entry, index (which is strictly greater than 774 0), is represented as an integer with a 6-bit prefix (see 775 Section 4.1.1). 777 Otherwise, the header field name is represented as a literal. The 778 value 0 is represented on 6 bits followed by the header field name 779 (see Section 4.1.2). 781 The header field name representation is followed by the header field 782 value represented as a literal string as described in Section 4.1.2. 784 4.4. Encoding Context Update 786 An indexed value of 0 is reserved for signalling changes in the 787 encoding context. The type of the change is encoded on the following 788 octet(s). Any change in the encoding context is applied immediately. 790 0 1 2 3 4 5 6 7 791 +---+---+---+---+---+---+---+---+ 792 | 1 | 0 | 793 +---+---------------------------+ 795 Reference Set Emptying 797 An octet with its high bit set to '1' signals that the reference set 798 is emptied. The remaining bits are set to '0'. 800 0 1 2 3 4 5 6 7 801 +---+---+---+---+---+---+---+---+ 802 | 0 | New maximum size (7+) | 803 +---+---------------------------+ 805 Maximum Header Table Size Change 807 An octet with its high bit set to '0' signals the new maximum size of 808 the header table. This new maximum size MUST be lower than or equal 809 to the value of the setting SETTINGS_HEADER_TABLE_SIZE (see [HTTP2]). 811 The new maximum size is encoded as an integer with a 7-bit prefix. 813 Change in the maximum size of the header table can trigger entry 814 evictions (see Section 3.3.2). 816 5. Security Considerations 818 This compressor exists to solve security issues present in stream 819 compressors such as DEFLATE whereby the compression context can be 820 efficiently probed to reveal secrets. A conformant implementation of 821 this specification should be fairly safe against that kind of attack, 822 as the reaping of any information from the compression context 823 requires more work than guessing and verifying the plain text data 824 directly with the server. As with any secret, however, the longer 825 the length of the secret, the more difficult the secret is to guess. 826 It is inadvisable to have short cookies that are relied upon to 827 remain secret for any duration of time. 829 A proper security-conscious implementation will also need to prevent 830 timing attacks by ensuring that the amount of time it takes to do 831 string comparisons is always a function of the total length of the 832 strings, and not a function of the number of matched characters. 834 A decoder needs to ensure that larger values or encodings of integers 835 do not permit exploitation. Decoders MUST limit the size of 836 integers, both in value and encoded length, that it accepts (see 837 Section 4.1.1). 839 Another common security problem is when the remote endpoint 840 successfully causes the local endpoint to exhaust its memory. This 841 compressor attempts to deal with the most obvious ways that this 842 could occur by limiting both the peak and the steady-state amount of 843 memory consumed in the compressor state, by providing ways for the 844 application to consume/flush the emitted header fields in small 845 chunks, and by considering overhead in the state size calculation. 846 Implementors must still be careful in the creation of APIs to an 847 implementation of this compressor by ensuring that header field keys 848 and values are either emitted as a stream, or that the compression 849 implementation have a limit on the maximum size of a key or value. 850 Failure to implement these kinds of safeguards may still result in a 851 scenario where the local endpoint exhausts its memory. 853 A particular care should be used for the maximum size of the header 854 table. While an endpoint can fully control the maximum size of its 855 header table for the decoding size, by using 856 SETTINGS_HEADER_TABLE_SIZE, the maximum size of the encoding size is 857 controlled by the remote peer. The endpoint should check the 858 SETTINGS_HEADER_TABLE_SIZE defined by the remote peer, and decrease 859 the maximum size for the encoding size if needed. 861 6. Acknowledgements 863 This document includes substantial editorial contributions from the 864 following individuals: Mike Bishop, Jeff Pinner, Julian Reschke, 865 Martin Thomson. 867 7. References 869 7.1. Normative References 871 [HTTP-p1] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 872 Protocol (HTTP/1.1): Message Syntax and Routing", draft- 873 ietf-httpbis-p1-messaging-26 (work in progress), February 874 2014. 876 [HTTP2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 877 Transfer Protocol version 2", draft-ietf-httpbis-http2-10 878 (work in progress), February 2014. 880 7.2. Informative References 882 [CANON] Schwartz, E. and B. Kallick, "Generating a canonical 883 prefix encoding", Communications of the ACM Volume 7 Issue 884 3, pp. 166-169, March 1964, 885 . 887 [CRIME] Rizzo, J. and T. Duong, "The CRIME Attack", September 888 2012, . 892 [DEFLATE] Deutsch, P., "DEFLATE Compressed Data Format Specification 893 version 1.3", RFC 1951, May 1996. 895 [HUFF] Huffman, D., "A Method for the Construction of Minimum 896 Redundancy Codes", Proceedings of the Institute of Radio 897 Engineers Volume 40, Number 9, pp. 1098-1101, September 898 1952, . 901 [PERF1] Belshe, M., "IETF83: SPDY and What to Consider for HTTP/ 902 2.0", March 2012, . 905 [PERF2] McManus, P., "SPDY: What I Like About You", September 906 2011, . 909 [SPDY] Belshe, M. and R. Peon, "SPDY Protocol", draft-mbelshe- 910 httpbis-spdy-00 (work in progress), February 2012. 912 Appendix A. Change Log (to be removed by RFC Editor before publication 914 A.1. Since draft-ietf-httpbis-header-compression-05 916 o Regenerated examples. 918 o Only one Huffman table for requests and responses. 920 o Added maximum size for header table, independent of 921 SETTINGS_HEADER_TABLE_SIZE. 923 o Added pseudo-code for integer decoding. 925 o Improved examples (removing unnecessary removals). 927 A.2. Since draft-ietf-httpbis-header-compression-04 929 o Updated examples: take into account changes in the spec, and show 930 more features. 932 o Use 'octet' everywhere instead of having both 'byte' and 'octet'. 934 o Added reference set emptying. 936 o Editorial changes and clarifications. 938 o Added "host" header to the static table. 940 o Ordering for list of values (either NULL- or comma-separated). 942 A.3. Since draft-ietf-httpbis-header-compression-03 944 o A large number of editorial changes; changed the description of 945 evicting/adding new entries. 947 o Removed substitution indexing 949 o Changed 'initial headers' to 'static headers', as per issue #258 951 o Merged 'request' and 'response' static headers, as per issue #259 953 o Changed text to indicate that new headers are added at index 0 and 954 expire from the largest index, as per issue #233 956 A.4. Since draft-ietf-httpbis-header-compression-02 958 o Corrected error in integer encoding pseudocode. 960 A.5. Since draft-ietf-httpbis-header-compression-01 962 o Refactored of Header Encoding Section: split definitions and 963 processing rule. 965 o Backward incompatible change: Updated reference set management as 966 per issue #214. This changes how the interaction between the 967 reference set and eviction works. This also changes the working 968 of the reference set in some specific cases. 970 o Backward incompatible change: modified initial header list, as per 971 issue #188. 973 o Added example of 32 octets entry structure (issue #191). 975 o Added Header Set Completion section. Reflowed some text. 976 Clarified some writing which was akward. Added text about 977 duplicate header entry encoding. Clarified some language w.r.t 978 Header Set. Changed x-my-header to mynewheader. Added text in 979 the HeaderEmission section indicating that the application may 980 also be able to free up memory more quickly. Added information in 981 Security Considerations section. 983 A.6. Since draft-ietf-httpbis-header-compression-00 985 Fixed bug/omission in integer representation algorithm. 987 Changed the document title. 989 Header matching text rewritten. 991 Changed the definition of header emission. 993 Changed the name of the setting which dictates how much memory the 994 compression context should use. 996 Removed "specific use cases" section 998 Corrected erroneous statement about what index can be contained in 999 one octet 1001 Added descriptions of opcodes 1003 Removed security claims from introduction. 1005 Appendix B. Static Table 1007 The static table consists of an unchangeable ordered list of (name, 1008 value) pairs. The first entry in the table is always represented by 1009 the index len(header table)+1, and the last entry in the table is 1010 represented by the index len(header table)+len(static table). 1012 [[The ordering of these tables is currently arbitrary. The tables in 1013 this section should be updated and ordered such that the table 1014 entries with the smallest indices are those which, based on a 1015 statistical analysis of the frequency of use weighted by size, 1016 achieve the largest decrease in octets transmitted subject to HTTP 2 1017 header field rules (like removal of some header fields). This set of 1018 header fields is currently very likely incomplete, and should be made 1019 complete. ]] 1021 The following table lists the pre-defined header fields that make-up 1022 the static header table. 1024 +-------+-----------------------------+--------------+ 1025 | Index | Header Name | Header Value | 1026 +-------+-----------------------------+--------------+ 1027 | 1 | :authority | | 1028 | 2 | :method | GET | 1029 | 3 | :method | POST | 1030 | 4 | :path | / | 1031 | 5 | :path | /index.html | 1032 | 6 | :scheme | http | 1033 | 7 | :scheme | https | 1034 | 8 | :status | 200 | 1035 | 9 | :status | 500 | 1036 | 10 | :status | 404 | 1037 | 11 | :status | 403 | 1038 | 12 | :status | 400 | 1039 | 13 | :status | 401 | 1040 | 14 | accept-charset | | 1041 | 15 | accept-encoding | | 1042 | 16 | accept-language | | 1043 | 17 | accept-ranges | | 1044 | 18 | accept | | 1045 | 19 | access-control-allow-origin | | 1046 | 20 | age | | 1047 | 21 | allow | | 1048 | 22 | authorization | | 1049 | 23 | cache-control | | 1050 | 24 | content-disposition | | 1051 | 25 | content-encoding | | 1052 | 26 | content-language | | 1053 | 27 | content-length | | 1054 | 28 | content-location | | 1055 | 29 | content-range | | 1056 | 30 | content-type | | 1057 | 31 | cookie | | 1058 | 32 | date | | 1059 | 33 | etag | | 1060 | 34 | expect | | 1061 | 35 | expires | | 1062 | 36 | from | | 1063 | 37 | host | | 1064 | 38 | if-match | | 1065 | 39 | if-modified-since | | 1066 | 40 | if-none-match | | 1067 | 41 | if-range | | 1068 | 42 | if-unmodified-since | | 1069 | 43 | last-modified | | 1070 | 44 | link | | 1071 | 45 | location | | 1072 | 46 | max-forwards | | 1073 | 47 | proxy-authenticate | | 1074 | 48 | proxy-authorization | | 1075 | 49 | range | | 1076 | 50 | referer | | 1077 | 51 | refresh | | 1078 | 52 | retry-after | | 1079 | 53 | server | | 1080 | 54 | set-cookie | | 1081 | 55 | strict-transport-security | | 1082 | 56 | transfer-encoding | | 1083 | 57 | user-agent | | 1084 | 58 | vary | | 1085 | 59 | via | | 1086 | 60 | www-authenticate | | 1087 +-------+-----------------------------+--------------+ 1089 Table 1: Static Table Entries 1091 The table give the index of each entry in the static table. The full 1092 index of each entry, to be used for encoding a reference to this 1093 entry, is computed by adding the number of entries in the header 1094 table to this index. 1096 Appendix C. Huffman Codes 1098 The following Huffman codes are used when encoding string literals. 1100 [[This table will be regenerated. ]] 1102 aligned aligned 1103 to len to len 1104 MSB in LSB in 1105 sym as bits bits as hex bits 1106 ( 0) |11111111|11111111|11110111|010 [27] 7ffffba [27] 1107 ( 1) |11111111|11111111|11110111|011 [27] 7ffffbb [27] 1108 ( 2) |11111111|11111111|11110111|100 [27] 7ffffbc [27] 1109 ( 3) |11111111|11111111|11110111|101 [27] 7ffffbd [27] 1110 ( 4) |11111111|11111111|11110111|110 [27] 7ffffbe [27] 1111 ( 5) |11111111|11111111|11110111|111 [27] 7ffffbf [27] 1112 ( 6) |11111111|11111111|11111000|000 [27] 7ffffc0 [27] 1113 ( 7) |11111111|11111111|11111000|001 [27] 7ffffc1 [27] 1114 ( 8) |11111111|11111111|11111000|010 [27] 7ffffc2 [27] 1115 ( 9) |11111111|11111111|11111000|011 [27] 7ffffc3 [27] 1116 ( 10) |11111111|11111111|11111000|100 [27] 7ffffc4 [27] 1117 ( 11) |11111111|11111111|11111000|101 [27] 7ffffc5 [27] 1118 ( 12) |11111111|11111111|11111000|110 [27] 7ffffc6 [27] 1119 ( 13) |11111111|11111111|11111000|111 [27] 7ffffc7 [27] 1120 ( 14) |11111111|11111111|11111001|000 [27] 7ffffc8 [27] 1121 ( 15) |11111111|11111111|11111001|001 [27] 7ffffc9 [27] 1122 ( 16) |11111111|11111111|11111001|010 [27] 7ffffca [27] 1123 ( 17) |11111111|11111111|11111001|011 [27] 7ffffcb [27] 1124 ( 18) |11111111|11111111|11111001|100 [27] 7ffffcc [27] 1125 ( 19) |11111111|11111111|11111001|101 [27] 7ffffcd [27] 1126 ( 20) |11111111|11111111|11111001|110 [27] 7ffffce [27] 1127 ( 21) |11111111|11111111|11111001|111 [27] 7ffffcf [27] 1128 ( 22) |11111111|11111111|11111010|000 [27] 7ffffd0 [27] 1129 ( 23) |11111111|11111111|11111010|001 [27] 7ffffd1 [27] 1130 ( 24) |11111111|11111111|11111010|010 [27] 7ffffd2 [27] 1131 ( 25) |11111111|11111111|11111010|011 [27] 7ffffd3 [27] 1132 ( 26) |11111111|11111111|11111010|100 [27] 7ffffd4 [27] 1133 ( 27) |11111111|11111111|11111010|101 [27] 7ffffd5 [27] 1134 ( 28) |11111111|11111111|11111010|110 [27] 7ffffd6 [27] 1135 ( 29) |11111111|11111111|11111010|111 [27] 7ffffd7 [27] 1136 ( 30) |11111111|11111111|11111011|000 [27] 7ffffd8 [27] 1137 ( 31) |11111111|11111111|11111011|001 [27] 7ffffd9 [27] 1138 ' ' ( 32) |11101000| [8] e8 [8] 1139 '!' ( 33) |11111111|1100 [12] ffc [12] 1140 '"' ( 34) |11111111|111010 [14] 3ffa [14] 1141 '#' ( 35) |11111111|1111100 [15] 7ffc [15] 1142 '$' ( 36) |11111111|1111101 [15] 7ffd [15] 1143 '%' ( 37) |100100 [6] 24 [6] 1144 '&' ( 38) |1101110 [7] 6e [7] 1145 ''' ( 39) |11111111|1111110 [15] 7ffe [15] 1146 '(' ( 40) |11111111|010 [11] 7fa [11] 1147 ')' ( 41) |11111111|011 [11] 7fb [11] 1148 '*' ( 42) |11111110|10 [10] 3fa [10] 1149 '+' ( 43) |11111111|100 [11] 7fc [11] 1150 ',' ( 44) |11101001| [8] e9 [8] 1151 '-' ( 45) |100101 [6] 25 [6] 1152 '.' ( 46) |00100 [5] 4 [5] 1153 '/' ( 47) |0000 [4] 0 [4] 1154 '0' ( 48) |00101 [5] 5 [5] 1155 '1' ( 49) |00110 [5] 6 [5] 1156 '2' ( 50) |00111 [5] 7 [5] 1157 '3' ( 51) |100110 [6] 26 [6] 1158 '4' ( 52) |100111 [6] 27 [6] 1159 '5' ( 53) |101000 [6] 28 [6] 1160 '6' ( 54) |101001 [6] 29 [6] 1161 '7' ( 55) |101010 [6] 2a [6] 1162 '8' ( 56) |101011 [6] 2b [6] 1163 '9' ( 57) |101100 [6] 2c [6] 1164 ':' ( 58) |11110110|0 [9] 1ec [9] 1165 ';' ( 59) |11101010| [8] ea [8] 1166 '<' ( 60) |11111111|11111111|10 [18] 3fffe [18] 1167 '=' ( 61) |101101 [6] 2d [6] 1168 '>' ( 62) |11111111|11111110|0 [17] 1fffc [17] 1169 '?' ( 63) |11110110|1 [9] 1ed [9] 1170 '@' ( 64) |11111111|111011 [14] 3ffb [14] 1171 'A' ( 65) |1101111 [7] 6f [7] 1172 'B' ( 66) |11101011| [8] eb [8] 1173 'C' ( 67) |11101100| [8] ec [8] 1174 'D' ( 68) |11101101| [8] ed [8] 1175 'E' ( 69) |11101110| [8] ee [8] 1176 'F' ( 70) |1110000 [7] 70 [7] 1177 'G' ( 71) |11110111|0 [9] 1ee [9] 1178 'H' ( 72) |11110111|1 [9] 1ef [9] 1179 'I' ( 73) |11111000|0 [9] 1f0 [9] 1180 'J' ( 74) |11111000|1 [9] 1f1 [9] 1181 'K' ( 75) |11111110|11 [10] 3fb [10] 1182 'L' ( 76) |11111001|0 [9] 1f2 [9] 1183 'M' ( 77) |11101111| [8] ef [8] 1184 'N' ( 78) |11111001|1 [9] 1f3 [9] 1185 'O' ( 79) |11111010|0 [9] 1f4 [9] 1186 'P' ( 80) |11111010|1 [9] 1f5 [9] 1187 'Q' ( 81) |11111011|0 [9] 1f6 [9] 1188 'R' ( 82) |11111011|1 [9] 1f7 [9] 1189 'S' ( 83) |11110000| [8] f0 [8] 1190 'T' ( 84) |11110001| [8] f1 [8] 1191 'U' ( 85) |11111100|0 [9] 1f8 [9] 1192 'V' ( 86) |11111100|1 [9] 1f9 [9] 1193 'W' ( 87) |11111101|0 [9] 1fa [9] 1194 'X' ( 88) |11111101|1 [9] 1fb [9] 1195 'Y' ( 89) |11111110|0 [9] 1fc [9] 1196 'Z' ( 90) |11111111|00 [10] 3fc [10] 1197 '[' ( 91) |11111111|111100 [14] 3ffc [14] 1198 '\' ( 92) |11111111|11111111|11111011|010 [27] 7ffffda [27] 1199 ']' ( 93) |11111111|11100 [13] 1ffc [13] 1200 '^' ( 94) |11111111|111101 [14] 3ffd [14] 1201 '_' ( 95) |101110 [6] 2e [6] 1202 '`' ( 96) |11111111|11111111|110 [19] 7fffe [19] 1203 'a' ( 97) |01000 [5] 8 [5] 1204 'b' ( 98) |101111 [6] 2f [6] 1205 'c' ( 99) |01001 [5] 9 [5] 1206 'd' (100) |110000 [6] 30 [6] 1207 'e' (101) |0001 [4] 1 [4] 1208 'f' (102) |110001 [6] 31 [6] 1209 'g' (103) |110010 [6] 32 [6] 1210 'h' (104) |110011 [6] 33 [6] 1211 'i' (105) |01010 [5] a [5] 1212 'j' (106) |1110001 [7] 71 [7] 1213 'k' (107) |1110010 [7] 72 [7] 1214 'l' (108) |01011 [5] b [5] 1215 'm' (109) |110100 [6] 34 [6] 1216 'n' (110) |01100 [5] c [5] 1217 'o' (111) |01101 [5] d [5] 1218 'p' (112) |01110 [5] e [5] 1219 'q' (113) |11110010| [8] f2 [8] 1220 'r' (114) |01111 [5] f [5] 1221 's' (115) |10000 [5] 10 [5] 1222 't' (116) |10001 [5] 11 [5] 1223 'u' (117) |110101 [6] 35 [6] 1224 'v' (118) |1110011 [7] 73 [7] 1225 'w' (119) |110110 [6] 36 [6] 1226 'x' (120) |11110011| [8] f3 [8] 1227 'y' (121) |11110100| [8] f4 [8] 1228 'z' (122) |11110101| [8] f5 [8] 1229 '{' (123) |11111111|11111110|1 [17] 1fffd [17] 1230 '|' (124) |11111111|101 [11] 7fd [11] 1231 '}' (125) |11111111|11111111|0 [17] 1fffe [17] 1232 '~' (126) |11111111|1101 [12] ffd [12] 1233 (127) |11111111|11111111|11111011|011 [27] 7ffffdb [27] 1234 (128) |11111111|11111111|11111011|100 [27] 7ffffdc [27] 1235 (129) |11111111|11111111|11111011|101 [27] 7ffffdd [27] 1236 (130) |11111111|11111111|11111011|110 [27] 7ffffde [27] 1237 (131) |11111111|11111111|11111011|111 [27] 7ffffdf [27] 1238 (132) |11111111|11111111|11111100|000 [27] 7ffffe0 [27] 1239 (133) |11111111|11111111|11111100|001 [27] 7ffffe1 [27] 1240 (134) |11111111|11111111|11111100|010 [27] 7ffffe2 [27] 1241 (135) |11111111|11111111|11111100|011 [27] 7ffffe3 [27] 1242 (136) |11111111|11111111|11111100|100 [27] 7ffffe4 [27] 1243 (137) |11111111|11111111|11111100|101 [27] 7ffffe5 [27] 1244 (138) |11111111|11111111|11111100|110 [27] 7ffffe6 [27] 1245 (139) |11111111|11111111|11111100|111 [27] 7ffffe7 [27] 1246 (140) |11111111|11111111|11111101|000 [27] 7ffffe8 [27] 1247 (141) |11111111|11111111|11111101|001 [27] 7ffffe9 [27] 1248 (142) |11111111|11111111|11111101|010 [27] 7ffffea [27] 1249 (143) |11111111|11111111|11111101|011 [27] 7ffffeb [27] 1250 (144) |11111111|11111111|11111101|100 [27] 7ffffec [27] 1251 (145) |11111111|11111111|11111101|101 [27] 7ffffed [27] 1252 (146) |11111111|11111111|11111101|110 [27] 7ffffee [27] 1253 (147) |11111111|11111111|11111101|111 [27] 7ffffef [27] 1254 (148) |11111111|11111111|11111110|000 [27] 7fffff0 [27] 1255 (149) |11111111|11111111|11111110|001 [27] 7fffff1 [27] 1256 (150) |11111111|11111111|11111110|010 [27] 7fffff2 [27] 1257 (151) |11111111|11111111|11111110|011 [27] 7fffff3 [27] 1258 (152) |11111111|11111111|11111110|100 [27] 7fffff4 [27] 1259 (153) |11111111|11111111|11111110|101 [27] 7fffff5 [27] 1260 (154) |11111111|11111111|11111110|110 [27] 7fffff6 [27] 1261 (155) |11111111|11111111|11111110|111 [27] 7fffff7 [27] 1262 (156) |11111111|11111111|11111111|000 [27] 7fffff8 [27] 1263 (157) |11111111|11111111|11111111|001 [27] 7fffff9 [27] 1264 (158) |11111111|11111111|11111111|010 [27] 7fffffa [27] 1265 (159) |11111111|11111111|11111111|011 [27] 7fffffb [27] 1266 (160) |11111111|11111111|11111111|100 [27] 7fffffc [27] 1267 (161) |11111111|11111111|11111111|101 [27] 7fffffd [27] 1268 (162) |11111111|11111111|11111111|110 [27] 7fffffe [27] 1269 (163) |11111111|11111111|11111111|111 [27] 7ffffff [27] 1270 (164) |11111111|11111111|11100000|00 [26] 3ffff80 [26] 1271 (165) |11111111|11111111|11100000|01 [26] 3ffff81 [26] 1272 (166) |11111111|11111111|11100000|10 [26] 3ffff82 [26] 1273 (167) |11111111|11111111|11100000|11 [26] 3ffff83 [26] 1274 (168) |11111111|11111111|11100001|00 [26] 3ffff84 [26] 1275 (169) |11111111|11111111|11100001|01 [26] 3ffff85 [26] 1276 (170) |11111111|11111111|11100001|10 [26] 3ffff86 [26] 1277 (171) |11111111|11111111|11100001|11 [26] 3ffff87 [26] 1278 (172) |11111111|11111111|11100010|00 [26] 3ffff88 [26] 1279 (173) |11111111|11111111|11100010|01 [26] 3ffff89 [26] 1280 (174) |11111111|11111111|11100010|10 [26] 3ffff8a [26] 1281 (175) |11111111|11111111|11100010|11 [26] 3ffff8b [26] 1282 (176) |11111111|11111111|11100011|00 [26] 3ffff8c [26] 1283 (177) |11111111|11111111|11100011|01 [26] 3ffff8d [26] 1284 (178) |11111111|11111111|11100011|10 [26] 3ffff8e [26] 1285 (179) |11111111|11111111|11100011|11 [26] 3ffff8f [26] 1286 (180) |11111111|11111111|11100100|00 [26] 3ffff90 [26] 1287 (181) |11111111|11111111|11100100|01 [26] 3ffff91 [26] 1288 (182) |11111111|11111111|11100100|10 [26] 3ffff92 [26] 1289 (183) |11111111|11111111|11100100|11 [26] 3ffff93 [26] 1290 (184) |11111111|11111111|11100101|00 [26] 3ffff94 [26] 1291 (185) |11111111|11111111|11100101|01 [26] 3ffff95 [26] 1292 (186) |11111111|11111111|11100101|10 [26] 3ffff96 [26] 1293 (187) |11111111|11111111|11100101|11 [26] 3ffff97 [26] 1294 (188) |11111111|11111111|11100110|00 [26] 3ffff98 [26] 1295 (189) |11111111|11111111|11100110|01 [26] 3ffff99 [26] 1296 (190) |11111111|11111111|11100110|10 [26] 3ffff9a [26] 1297 (191) |11111111|11111111|11100110|11 [26] 3ffff9b [26] 1298 (192) |11111111|11111111|11100111|00 [26] 3ffff9c [26] 1299 (193) |11111111|11111111|11100111|01 [26] 3ffff9d [26] 1300 (194) |11111111|11111111|11100111|10 [26] 3ffff9e [26] 1301 (195) |11111111|11111111|11100111|11 [26] 3ffff9f [26] 1302 (196) |11111111|11111111|11101000|00 [26] 3ffffa0 [26] 1303 (197) |11111111|11111111|11101000|01 [26] 3ffffa1 [26] 1304 (198) |11111111|11111111|11101000|10 [26] 3ffffa2 [26] 1305 (199) |11111111|11111111|11101000|11 [26] 3ffffa3 [26] 1306 (200) |11111111|11111111|11101001|00 [26] 3ffffa4 [26] 1307 (201) |11111111|11111111|11101001|01 [26] 3ffffa5 [26] 1308 (202) |11111111|11111111|11101001|10 [26] 3ffffa6 [26] 1309 (203) |11111111|11111111|11101001|11 [26] 3ffffa7 [26] 1310 (204) |11111111|11111111|11101010|00 [26] 3ffffa8 [26] 1311 (205) |11111111|11111111|11101010|01 [26] 3ffffa9 [26] 1312 (206) |11111111|11111111|11101010|10 [26] 3ffffaa [26] 1313 (207) |11111111|11111111|11101010|11 [26] 3ffffab [26] 1314 (208) |11111111|11111111|11101011|00 [26] 3ffffac [26] 1315 (209) |11111111|11111111|11101011|01 [26] 3ffffad [26] 1316 (210) |11111111|11111111|11101011|10 [26] 3ffffae [26] 1317 (211) |11111111|11111111|11101011|11 [26] 3ffffaf [26] 1318 (212) |11111111|11111111|11101100|00 [26] 3ffffb0 [26] 1319 (213) |11111111|11111111|11101100|01 [26] 3ffffb1 [26] 1320 (214) |11111111|11111111|11101100|10 [26] 3ffffb2 [26] 1321 (215) |11111111|11111111|11101100|11 [26] 3ffffb3 [26] 1322 (216) |11111111|11111111|11101101|00 [26] 3ffffb4 [26] 1323 (217) |11111111|11111111|11101101|01 [26] 3ffffb5 [26] 1324 (218) |11111111|11111111|11101101|10 [26] 3ffffb6 [26] 1325 (219) |11111111|11111111|11101101|11 [26] 3ffffb7 [26] 1326 (220) |11111111|11111111|11101110|00 [26] 3ffffb8 [26] 1327 (221) |11111111|11111111|11101110|01 [26] 3ffffb9 [26] 1328 (222) |11111111|11111111|11101110|10 [26] 3ffffba [26] 1329 (223) |11111111|11111111|11101110|11 [26] 3ffffbb [26] 1330 (224) |11111111|11111111|11101111|00 [26] 3ffffbc [26] 1331 (225) |11111111|11111111|11101111|01 [26] 3ffffbd [26] 1332 (226) |11111111|11111111|11101111|10 [26] 3ffffbe [26] 1333 (227) |11111111|11111111|11101111|11 [26] 3ffffbf [26] 1334 (228) |11111111|11111111|11110000|00 [26] 3ffffc0 [26] 1335 (229) |11111111|11111111|11110000|01 [26] 3ffffc1 [26] 1336 (230) |11111111|11111111|11110000|10 [26] 3ffffc2 [26] 1337 (231) |11111111|11111111|11110000|11 [26] 3ffffc3 [26] 1338 (232) |11111111|11111111|11110001|00 [26] 3ffffc4 [26] 1339 (233) |11111111|11111111|11110001|01 [26] 3ffffc5 [26] 1340 (234) |11111111|11111111|11110001|10 [26] 3ffffc6 [26] 1341 (235) |11111111|11111111|11110001|11 [26] 3ffffc7 [26] 1342 (236) |11111111|11111111|11110010|00 [26] 3ffffc8 [26] 1343 (237) |11111111|11111111|11110010|01 [26] 3ffffc9 [26] 1344 (238) |11111111|11111111|11110010|10 [26] 3ffffca [26] 1345 (239) |11111111|11111111|11110010|11 [26] 3ffffcb [26] 1346 (240) |11111111|11111111|11110011|00 [26] 3ffffcc [26] 1347 (241) |11111111|11111111|11110011|01 [26] 3ffffcd [26] 1348 (242) |11111111|11111111|11110011|10 [26] 3ffffce [26] 1349 (243) |11111111|11111111|11110011|11 [26] 3ffffcf [26] 1350 (244) |11111111|11111111|11110100|00 [26] 3ffffd0 [26] 1351 (245) |11111111|11111111|11110100|01 [26] 3ffffd1 [26] 1352 (246) |11111111|11111111|11110100|10 [26] 3ffffd2 [26] 1353 (247) |11111111|11111111|11110100|11 [26] 3ffffd3 [26] 1354 (248) |11111111|11111111|11110101|00 [26] 3ffffd4 [26] 1355 (249) |11111111|11111111|11110101|01 [26] 3ffffd5 [26] 1356 (250) |11111111|11111111|11110101|10 [26] 3ffffd6 [26] 1357 (251) |11111111|11111111|11110101|11 [26] 3ffffd7 [26] 1358 (252) |11111111|11111111|11110110|00 [26] 3ffffd8 [26] 1359 (253) |11111111|11111111|11110110|01 [26] 3ffffd9 [26] 1360 (254) |11111111|11111111|11110110|10 [26] 3ffffda [26] 1361 (255) |11111111|11111111|11110110|11 [26] 3ffffdb [26] 1362 EOS (256) |11111111|11111111|11110111|00 [26] 3ffffdc [26] 1364 Appendix D. Examples 1366 A number of examples are worked through here, for both requests and 1367 responses, and with and without Huffman coding. 1369 D.1. Header Field Representation Examples 1371 This section show several independent representation examples. 1373 D.1.1. Literal Header Field with Indexing 1375 The header field representation uses a literal name and a literal 1376 value. 1378 Header set to encode: 1380 custom-key: custom-header 1382 Reference set: empty. 1384 Hex dump of encoded data: 1386 000a 6375 7374 6f6d 2d6b 6579 0d63 7573 | ..custom-key.cus 1387 746f 6d2d 6865 6164 6572 | tom-header 1389 Decoding process: 1391 00 | == Literal indexed == 1392 0a | Literal name (len = 10) 1393 6375 7374 6f6d 2d6b 6579 | custom-key 1394 0d | Literal value (len = 13) 1395 6375 7374 6f6d 2d68 6561 6465 72 | custom-header 1396 | -> custom-key: custom-head\ 1397 | er 1399 Header Table (after decoding): 1401 [ 1] (s = 55) custom-key: custom-header 1402 Table size: 55 1404 Decoded header set: 1406 custom-key: custom-header 1408 D.1.2. Literal Header Field without Indexing 1410 The header field representation uses an indexed name and a literal 1411 value. 1413 Header set to encode: 1415 :path: /sample/path 1417 Reference set: empty. 1419 Hex dump of encoded data: 1421 440c 2f73 616d 706c 652f 7061 7468 | D./sample/path 1423 Decoding process: 1425 44 | == Literal not indexed == 1426 | Indexed name (idx = 4) 1427 | :path 1428 0c | Literal value (len = 12) 1429 2f73 616d 706c 652f 7061 7468 | /sample/path 1430 | -> :path: /sample/path 1432 Header table (after decoding): empty. 1434 Decoded header set: 1436 :path: /sample/path 1438 D.1.3. Indexed Header Field 1440 The header field representation uses an indexed header field, from 1441 the static table. Upon using it, the static table entry is copied 1442 into the header table. 1444 Header set to encode: 1446 :method: GET 1448 Reference set: empty. 1450 Hex dump of encoded data: 1452 82 | . 1454 Decoding process: 1456 82 | == Indexed - Add == 1457 | idx = 2 1458 | -> :method: GET 1460 Header Table (after decoding): 1462 [ 1] (s = 42) :method: GET 1463 Table size: 42 1465 Decoded header set: 1467 :method: GET 1469 D.1.4. Indexed Header Field from Static Table 1471 The header field representation uses an indexed header field, from 1472 the static table. In this example, the SETTINGS_HEADER_TABLE_SIZE is 1473 set to 0, therefore, the entry is not copied into the header table. 1475 Header set to encode: 1477 :method: GET 1479 Reference set: empty. 1481 Hex dump of encoded data: 1483 82 | . 1485 Decoding process: 1487 82 | == Indexed - Add == 1488 | idx = 2 1489 | -> :method: GET 1491 Header table (after decoding): empty. 1493 Decoded header set: 1495 :method: GET 1497 D.2. Request Examples without Huffman 1499 This section shows several consecutive header sets, corresponding to 1500 HTTP requests, on the same connection. 1502 D.2.1. First request 1504 Header set to encode: 1506 :method: GET 1507 :scheme: http 1508 :path: / 1509 :authority: www.example.com 1511 Reference set: empty. 1513 Hex dump of encoded data: 1515 8287 8604 0f77 7777 2e65 7861 6d70 6c65 | .....www.example 1516 2e63 6f6d | .com 1518 Decoding process: 1520 82 | == Indexed - Add == 1521 | idx = 2 1522 | -> :method: GET 1523 87 | == Indexed - Add == 1524 | idx = 7 1525 | -> :scheme: http 1526 86 | == Indexed - Add == 1527 | idx = 6 1528 | -> :path: / 1529 04 | == Literal indexed == 1530 | Indexed name (idx = 4) 1531 | :authority 1532 0f | Literal value (len = 15) 1533 7777 772e 6578 616d 706c 652e 636f 6d | www.example.com 1534 | -> :authority: www.example\ 1535 | .com 1537 Header Table (after decoding): 1539 [ 1] (s = 57) :authority: www.example.com 1540 [ 2] (s = 38) :path: / 1541 [ 3] (s = 43) :scheme: http 1542 [ 4] (s = 42) :method: GET 1543 Table size: 180 1545 Decoded header set: 1547 :method: GET 1548 :scheme: http 1549 :path: / 1550 :authority: www.example.com 1552 D.2.2. Second request 1554 This request takes advantage of the differential encoding of header 1555 sets. 1557 Header set to encode: 1559 :method: GET 1560 :scheme: http 1561 :path: / 1562 :authority: www.example.com 1563 cache-control: no-cache 1565 Reference set: 1567 [ 1] :authority: www.example.com 1568 [ 2] :path: / 1569 [ 3] :scheme: http 1570 [ 4] :method: GET 1572 Hex dump of encoded data: 1574 1b08 6e6f 2d63 6163 6865 | ..no-cache 1576 Decoding process: 1578 1b | == Literal indexed == 1579 | Indexed name (idx = 27) 1580 | cache-control 1581 08 | Literal value (len = 8) 1582 6e6f 2d63 6163 6865 | no-cache 1583 | -> cache-control: no-cache 1585 Header Table (after decoding): 1587 [ 1] (s = 53) cache-control: no-cache 1588 [ 2] (s = 57) :authority: www.example.com 1589 [ 3] (s = 38) :path: / 1590 [ 4] (s = 43) :scheme: http 1591 [ 5] (s = 42) :method: GET 1592 Table size: 233 1594 Decoded header set: 1596 cache-control: no-cache 1597 :authority: www.example.com 1598 :path: / 1599 :scheme: http 1600 :method: GET 1602 D.2.3. Third request 1604 This request has not enough headers in common with the previous 1605 request to take advantage of the differential encoding. Therefore, 1606 the reference set is emptied before encoding the header fields. 1608 Header set to encode: 1610 :method: GET 1611 :scheme: https 1612 :path: /index.html 1613 :authority: www.example.com 1614 custom-key: custom-value 1616 Reference set: 1618 [ 1] cache-control: no-cache 1619 [ 2] :authority: www.example.com 1620 [ 3] :path: / 1621 [ 4] :scheme: http 1622 [ 5] :method: GET 1624 Hex dump of encoded data: 1626 8080 858c 8b84 000a 6375 7374 6f6d 2d6b | ........custom-k 1627 6579 0c63 7573 746f 6d2d 7661 6c75 65 | ey.custom-value 1629 Decoding process: 1631 80 80 | == Empty reference set == 1632 | idx = 0 1633 | flag = 1 1634 85 | == Indexed - Add == 1635 | idx = 5 1636 | -> :method: GET 1637 8c | == Indexed - Add == 1638 | idx = 12 1639 | -> :scheme: https 1640 8b | == Indexed - Add == 1641 | idx = 11 1642 | -> :path: /index.html 1643 84 | == Indexed - Add == 1644 | idx = 4 1645 | -> :authority: www.example\ 1646 | .com 1647 00 | == Literal indexed == 1648 0a | Literal name (len = 10) 1649 6375 7374 6f6d 2d6b 6579 | custom-key 1650 0c | Literal value (len = 12) 1651 6375 7374 6f6d 2d76 616c 7565 | custom-value 1652 | -> custom-key: custom-valu\ 1653 | e 1655 Header Table (after decoding): 1657 [ 1] (s = 54) custom-key: custom-value 1658 [ 2] (s = 48) :path: /index.html 1659 [ 3] (s = 44) :scheme: https 1660 [ 4] (s = 53) cache-control: no-cache 1661 [ 5] (s = 57) :authority: www.example.com 1662 [ 6] (s = 38) :path: / 1663 [ 7] (s = 43) :scheme: http 1664 [ 8] (s = 42) :method: GET 1665 Table size: 379 1667 Decoded header set: 1669 :method: GET 1670 :scheme: https 1671 :path: /index.html 1672 :authority: www.example.com 1673 custom-key: custom-value 1675 D.3. Request Examples with Huffman 1677 This section shows the same examples as the previous section, but 1678 using Huffman encoding for the literal values. 1680 D.3.1. First request 1682 Header set to encode: 1684 :method: GET 1685 :scheme: http 1686 :path: / 1687 :authority: www.example.com 1689 Reference set: empty. 1691 Hex dump of encoded data: 1693 8287 8604 8bdb 6d88 3e68 d1cb 1225 ba7f | ......m..h...%.. 1695 Decoding process: 1697 82 | == Indexed - Add == 1698 | idx = 2 1699 | -> :method: GET 1700 87 | == Indexed - Add == 1701 | idx = 7 1702 | -> :scheme: http 1703 86 | == Indexed - Add == 1704 | idx = 6 1705 | -> :path: / 1706 04 | == Literal indexed == 1707 | Indexed name (idx = 4) 1708 | :authority 1709 8b | Literal value (len = 15) 1710 | Huffman encoded: 1711 db6d 883e 68d1 cb12 25ba 7f | .m..h...%.. 1712 | Decoded: 1713 | www.example.com 1714 | -> :authority: www.example\ 1715 | .com 1717 Header Table (after decoding): 1719 [ 1] (s = 57) :authority: www.example.com 1720 [ 2] (s = 38) :path: / 1721 [ 3] (s = 43) :scheme: http 1722 [ 4] (s = 42) :method: GET 1723 Table size: 180 1725 Decoded header set: 1727 :method: GET 1728 :scheme: http 1729 :path: / 1730 :authority: www.example.com 1732 D.3.2. Second request 1734 This request takes advantage of the differential encoding of header 1735 sets. 1737 Header set to encode: 1739 :method: GET 1740 :scheme: http 1741 :path: / 1742 :authority: www.example.com 1743 cache-control: no-cache 1745 Reference set: 1747 [ 1] :authority: www.example.com 1748 [ 2] :path: / 1749 [ 3] :scheme: http 1750 [ 4] :method: GET 1752 Hex dump of encoded data: 1754 1b86 6365 4a13 98ff | ..ceJ... 1756 Decoding process: 1758 1b | == Literal indexed == 1759 | Indexed name (idx = 27) 1760 | cache-control 1761 86 | Literal value (len = 8) 1762 | Huffman encoded: 1763 6365 4a13 98ff | ceJ... 1764 | Decoded: 1765 | no-cache 1766 | -> cache-control: no-cache 1768 Header Table (after decoding): 1770 [ 1] (s = 53) cache-control: no-cache 1771 [ 2] (s = 57) :authority: www.example.com 1772 [ 3] (s = 38) :path: / 1773 [ 4] (s = 43) :scheme: http 1774 [ 5] (s = 42) :method: GET 1775 Table size: 233 1777 Decoded header set: 1779 cache-control: no-cache 1780 :authority: www.example.com 1781 :path: / 1782 :scheme: http 1783 :method: GET 1785 D.3.3. Third request 1787 This request has not enough headers in common with the previous 1788 request to take advantage of the differential encoding. Therefore, 1789 the reference set is emptied before encoding the header fields. 1791 Header set to encode: 1793 :method: GET 1794 :scheme: https 1795 :path: /index.html 1796 :authority: www.example.com 1797 custom-key: custom-value 1799 Reference set: 1801 [ 1] cache-control: no-cache 1802 [ 2] :authority: www.example.com 1803 [ 3] :path: / 1804 [ 4] :scheme: http 1805 [ 5] :method: GET 1807 Hex dump of encoded data: 1809 8080 858c 8b84 0088 4eb0 8b74 9790 fa7f | ........N..t.... 1810 894e b08b 7497 9a17 a8ff | .N..t..... 1812 Decoding process: 1814 80 80 | == Empty reference set == 1815 | idx = 0 1816 | flag = 1 1817 85 | == Indexed - Add == 1818 | idx = 5 1819 | -> :method: GET 1820 8c | == Indexed - Add == 1821 | idx = 12 1822 | -> :scheme: https 1823 8b | == Indexed - Add == 1824 | idx = 11 1825 | -> :path: /index.html 1826 84 | == Indexed - Add == 1827 | idx = 4 1828 | -> :authority: www.example\ 1829 | .com 1830 00 | == Literal indexed == 1831 88 | Literal name (len = 10) 1832 | Huffman encoded: 1833 4eb0 8b74 9790 fa7f | N..t.... 1834 | Decoded: 1835 | custom-key 1836 89 | Literal value (len = 12) 1837 | Huffman encoded: 1838 4eb0 8b74 979a 17a8 ff | N..t..... 1839 | Decoded: 1840 | custom-value 1841 | -> custom-key: custom-valu\ 1842 | e 1844 Header Table (after decoding): 1846 [ 1] (s = 54) custom-key: custom-value 1847 [ 2] (s = 48) :path: /index.html 1848 [ 3] (s = 44) :scheme: https 1849 [ 4] (s = 53) cache-control: no-cache 1850 [ 5] (s = 57) :authority: www.example.com 1851 [ 6] (s = 38) :path: / 1852 [ 7] (s = 43) :scheme: http 1853 [ 8] (s = 42) :method: GET 1854 Table size: 379 1856 Decoded header set: 1858 :method: GET 1859 :scheme: https 1860 :path: /index.html 1861 :authority: www.example.com 1862 custom-key: custom-value 1864 D.4. Response Examples without Huffman 1866 This section shows several consecutive header sets, corresponding to 1867 HTTP responses, on the same connection. SETTINGS_HEADER_TABLE_SIZE 1868 is set to the value of 256 octets, causing some evictions to occur. 1870 D.4.1. First response 1872 Header set to encode: 1874 :status: 302 1875 cache-control: private 1876 date: Mon, 21 Oct 2013 20:13:21 GMT 1877 location: https://www.example.com 1879 Reference set: empty. 1881 Hex dump of encoded data: 1883 0803 3330 3218 0770 7269 7661 7465 221d | ..302..private". 1884 4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013 1885 2032 303a 3133 3a32 3120 474d 5430 1768 | 20:13:21 GMT0.h 1886 7474 7073 3a2f 2f77 7777 2e65 7861 6d70 | ttps://www.examp 1887 6c65 2e63 6f6d | le.com 1889 Decoding process: 1891 08 | == Literal indexed == 1892 | Indexed name (idx = 8) 1893 | :status 1894 03 | Literal value (len = 3) 1895 3330 32 | 302 1896 | -> :status: 302 1897 18 | == Literal indexed == 1898 | Indexed name (idx = 24) 1899 | cache-control 1900 07 | Literal value (len = 7) 1901 7072 6976 6174 65 | private 1902 | -> cache-control: private 1903 22 | == Literal indexed == 1904 | Indexed name (idx = 34) 1905 | date 1906 1d | Literal value (len = 29) 1907 4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013 1908 2032 303a 3133 3a32 3120 474d 54 | 20:13:21 GMT 1909 | -> date: Mon, 21 Oct 2013 \ 1910 | 20:13:21 GMT 1911 30 | == Literal indexed == 1912 | Indexed name (idx = 48) 1913 | location 1914 17 | Literal value (len = 23) 1915 6874 7470 733a 2f2f 7777 772e 6578 616d | https://www.exam 1916 706c 652e 636f 6d | ple.com 1917 | -> location: https://www.e\ 1918 | xample.com 1920 Header Table (after decoding): 1922 [ 1] (s = 63) location: https://www.example.com 1923 [ 2] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT 1924 [ 3] (s = 52) cache-control: private 1925 [ 4] (s = 42) :status: 302 1926 Table size: 222 1928 Decoded header set: 1930 :status: 302 1931 cache-control: private 1932 date: Mon, 21 Oct 2013 20:13:21 GMT 1933 location: https://www.example.com 1935 D.4.2. Second response 1937 The (":status", "302") header field is evicted from the header table 1938 to free space to allow adding the (":status", "200") header field, 1939 copied from the static table into the header table. The (":status", 1940 "302") header field doesn't need to be removed from the reference set 1941 as it is evicted from the header table. 1943 Header set to encode: 1945 :status: 200 1946 cache-control: private 1947 date: Mon, 21 Oct 2013 20:13:21 GMT 1948 location: https://www.example.com 1950 Reference set: 1952 [ 1] location: https://www.example.com 1953 [ 2] date: Mon, 21 Oct 2013 20:13:21 GMT 1954 [ 3] cache-control: private 1955 [ 4] :status: 302 1957 Hex dump of encoded data: 1959 8c | . 1961 Decoding process: 1963 8c | == Indexed - Add == 1964 | idx = 12 1965 | - evict: :status: 302 1966 | -> :status: 200 1968 Header Table (after decoding): 1970 [ 1] (s = 42) :status: 200 1971 [ 2] (s = 63) location: https://www.example.com 1972 [ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT 1973 [ 4] (s = 52) cache-control: private 1974 Table size: 222 1976 Decoded header set: 1978 :status: 200 1979 location: https://www.example.com 1980 date: Mon, 21 Oct 2013 20:13:21 GMT 1981 cache-control: private 1983 D.4.3. Third response 1985 Several header fields are evicted from the header table during the 1986 processing of this header set. Before evicting a header belonging to 1987 the reference set, it is emitted, by coding it twice as an Indexed 1988 Representation. The first representation removes the header field 1989 from the reference set, the second one adds it again to the reference 1990 set, also emitting it. 1992 Header set to encode: 1994 :status: 200 1995 cache-control: private 1996 date: Mon, 21 Oct 2013 20:13:22 GMT 1997 location: https://www.example.com 1998 content-encoding: gzip 1999 set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1 2001 Reference set: 2003 [ 1] :status: 200 2004 [ 2] location: https://www.example.com 2005 [ 3] date: Mon, 21 Oct 2013 20:13:21 GMT 2006 [ 4] cache-control: private 2008 Hex dump of encoded data: 2010 8484 031d 4d6f 6e2c 2032 3120 4f63 7420 | ....Mon, 21 Oct 2011 3230 3133 2032 303a 3133 3a32 3220 474d | 2013 20:13:22 GM 2012 541d 0467 7a69 7084 8483 833a 3866 6f6f | T..gzip....:8foo 2013 3d41 5344 4a4b 4851 4b42 5a58 4f51 5745 | =ASDJKHQKBZXOQWE 2014 4f50 4955 4158 5157 454f 4955 3b20 6d61 | OPIUAXQWEOIU; ma 2015 782d 6167 653d 3336 3030 3b20 7665 7273 | x-age=3600; vers 2016 696f 6e3d 31 | ion=1 2018 Decoding process: 2020 84 | == Indexed - Remove == 2021 | idx = 4 2022 | -> cache-control: private 2023 84 | == Indexed - Add == 2024 | idx = 4 2025 | -> cache-control: private 2026 03 | == Literal indexed == 2027 | Indexed name (idx = 3) 2028 | date 2029 1d | Literal value (len = 29) 2030 4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013 2031 2032 303a 3133 3a32 3220 474d 54 | 20:13:22 GMT 2032 | - evict: cache-control: pr\ 2033 | ivate 2034 | -> date: Mon, 21 Oct 2013 \ 2035 | 20:13:22 GMT 2036 1d | == Literal indexed == 2037 | Indexed name (idx = 29) 2038 | content-encoding 2039 04 | Literal value (len = 4) 2040 677a 6970 | gzip 2041 | - evict: date: Mon, 21 Oct\ 2042 | 2013 20:13:21 GMT 2043 | -> content-encoding: gzip 2044 84 | == Indexed - Remove == 2045 | idx = 4 2046 | -> location: https://www.e\ 2047 | xample.com 2048 84 | == Indexed - Add == 2049 | idx = 4 2050 | -> location: https://www.e\ 2051 | xample.com 2052 83 | == Indexed - Remove == 2053 | idx = 3 2054 | -> :status: 200 2055 83 | == Indexed - Add == 2056 | idx = 3 2057 | -> :status: 200 2058 3a | == Literal indexed == 2059 | Indexed name (idx = 58) 2060 | set-cookie 2061 38 | Literal value (len = 56) 2062 666f 6f3d 4153 444a 4b48 514b 425a 584f | foo=ASDJKHQKBZXO 2063 5157 454f 5049 5541 5851 5745 4f49 553b | QWEOPIUAXQWEOIU; 2064 206d 6178 2d61 6765 3d33 3630 303b 2076 | max-age=3600; v 2065 6572 7369 6f6e 3d31 | ersion=1 2066 | - evict: location: https:/\ 2067 | /www.example.com 2068 | - evict: :status: 200 2069 | -> set-cookie: foo=ASDJKHQ\ 2070 | KBZXOQWEOPIUAXQWEOIU; ma\ 2071 | x-age=3600; version=1 2073 Header Table (after decoding): 2075 [ 1] (s = 98) set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age\ 2076 =3600; version=1 2077 [ 2] (s = 52) content-encoding: gzip 2078 [ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:22 GMT 2079 Table size: 215 2081 Decoded header set: 2083 cache-control: private 2084 date: Mon, 21 Oct 2013 20:13:22 GMT 2085 content-encoding: gzip 2086 location: https://www.example.com 2087 :status: 200 2088 set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1 2090 D.5. Response Examples with Huffman 2092 This section shows the same examples as the previous section, but 2093 using Huffman encoding for the literal values. The eviction 2094 mechanism uses the length of the decoded literal values, so the same 2095 evictions occurs as in the previous section. 2097 D.5.1. First response 2099 Header set to encode: 2101 :status: 302 2102 cache-control: private 2103 date: Mon, 21 Oct 2013 20:13:21 GMT 2104 location: https://www.example.com 2106 Reference set: empty. 2108 Hex dump of encoded data: 2110 0882 98a7 1885 73d5 cd11 1f22 98ef 6b3a | ......s...."..k: 2111 7a0e 6e8f a263 d072 9a6e 8397 d869 bd87 | z.n..c.r.n...i.. 2112 3747 bbbf c730 90ce 3174 3d80 1b6d b107 | 7G...0..1t=..m.. 2113 cd1a 3962 44b7 4f | ..9bD.O 2115 Decoding process: 2117 08 | == Literal indexed == 2118 | Indexed name (idx = 8) 2119 | :status 2120 82 | Literal value (len = 3) 2121 | Huffman encoded: 2122 98a7 | .. 2123 | Decoded: 2124 | 302 2125 | -> :status: 302 2126 18 | == Literal indexed == 2127 | Indexed name (idx = 24) 2128 | cache-control 2129 85 | Literal value (len = 7) 2130 | Huffman encoded: 2131 73d5 cd11 1f | s.... 2132 | Decoded: 2133 | private 2134 | -> cache-control: private 2135 22 | == Literal indexed == 2136 | Indexed name (idx = 34) 2137 | date 2138 98 | Literal value (len = 29) 2139 | Huffman encoded: 2140 ef6b 3a7a 0e6e 8fa2 63d0 729a 6e83 97d8 | .k:z.n..c.r.n... 2141 69bd 8737 47bb bfc7 | i..7G... 2142 | Decoded: 2143 | Mon, 21 Oct 2013 20:13:21 \ 2144 | GMT 2145 | -> date: Mon, 21 Oct 2013 \ 2146 | 20:13:21 GMT 2147 30 | == Literal indexed == 2148 | Indexed name (idx = 48) 2149 | location 2150 90 | Literal value (len = 23) 2151 | Huffman encoded: 2152 ce31 743d 801b 6db1 07cd 1a39 6244 b74f | .1t=..m....9bD.O 2153 | Decoded: 2154 | https://www.example.com 2155 | -> location: https://www.e\ 2156 | xample.com 2158 Header Table (after decoding): 2160 [ 1] (s = 63) location: https://www.example.com 2161 [ 2] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT 2162 [ 3] (s = 52) cache-control: private 2163 [ 4] (s = 42) :status: 302 2164 Table size: 222 2166 Decoded header set: 2168 :status: 302 2169 cache-control: private 2170 date: Mon, 21 Oct 2013 20:13:21 GMT 2171 location: https://www.example.com 2173 D.5.2. Second response 2175 The (":status", "302") header field is evicted from the header table 2176 to free space to allow adding the (":status", "200") header field, 2177 copied from the static table into the header table. The (":status", 2178 "302") header field doesn't need to be removed from the reference set 2179 as it is evicted from the header table. 2181 Header set to encode: 2183 :status: 200 2184 cache-control: private 2185 date: Mon, 21 Oct 2013 20:13:21 GMT 2186 location: https://www.example.com 2188 Reference set: 2190 [ 1] location: https://www.example.com 2191 [ 2] date: Mon, 21 Oct 2013 20:13:21 GMT 2192 [ 3] cache-control: private 2193 [ 4] :status: 302 2195 Hex dump of encoded data: 2197 8c | . 2199 Decoding process: 2201 8c | == Indexed - Add == 2202 | idx = 12 2203 | - evict: :status: 302 2204 | -> :status: 200 2206 Header Table (after decoding): 2208 [ 1] (s = 42) :status: 200 2209 [ 2] (s = 63) location: https://www.example.com 2210 [ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT 2211 [ 4] (s = 52) cache-control: private 2212 Table size: 222 2214 Decoded header set: 2216 :status: 200 2217 location: https://www.example.com 2218 date: Mon, 21 Oct 2013 20:13:21 GMT 2219 cache-control: private 2221 D.5.3. Third response 2223 Several header fields are evicted from the header table during the 2224 processing of this header set. Before evicting a header belonging to 2225 the reference set, it is emitted, by coding it twice as an Indexed 2226 Representation. The first representation removes the header field 2227 from the reference set, the second one adds it again to the reference 2228 set, also emitting it. 2230 Header set to encode: 2232 :status: 200 2233 cache-control: private 2234 date: Mon, 21 Oct 2013 20:13:22 GMT 2235 location: https://www.example.com 2236 content-encoding: gzip 2237 set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1 2238 Reference set: 2240 [ 1] :status: 200 2241 [ 2] location: https://www.example.com 2242 [ 3] date: Mon, 21 Oct 2013 20:13:21 GMT 2243 [ 4] cache-control: private 2245 Hex dump of encoded data: 2247 8484 0398 ef6b 3a7a 0e6e 8fa2 63d0 729a | .....k:z.n..c.r. 2248 6e83 97d8 69bd 873f 47bb bfc7 1d83 cbd5 | n...i..?G....... 2249 4e84 8483 833a b3c5 adb7 7f87 6fc7 fbf7 | N....:......o... 2250 fdbf bebf f3f7 f4fb 7ebb be9f 5f87 e37f | ............_... 2251 efed faee fa7c 3f1d 5d1a 23ce 5464 36cd | .....|?.].#.Td6. 2252 494b d5d1 cc5f 0535 969b | IK..._.5.. 2254 Decoding process: 2256 84 | == Indexed - Remove == 2257 | idx = 4 2258 | -> cache-control: private 2259 84 | == Indexed - Add == 2260 | idx = 4 2261 | -> cache-control: private 2262 03 | == Literal indexed == 2263 | Indexed name (idx = 3) 2264 | date 2265 98 | Literal value (len = 29) 2266 | Huffman encoded: 2267 ef6b 3a7a 0e6e 8fa2 63d0 729a 6e83 97d8 | .k:z.n..c.r.n... 2268 69bd 873f 47bb bfc7 | i..?G... 2269 | Decoded: 2270 | Mon, 21 Oct 2013 20:13:22 \ 2271 | GMT 2272 | - evict: cache-control: pr\ 2273 | ivate 2274 | -> date: Mon, 21 Oct 2013 \ 2275 | 20:13:22 GMT 2276 1d | == Literal indexed == 2277 | Indexed name (idx = 29) 2278 | content-encoding 2279 83 | Literal value (len = 4) 2280 | Huffman encoded: 2281 cbd5 4e | ..N 2282 | Decoded: 2283 | gzip 2284 | - evict: date: Mon, 21 Oct\ 2285 | 2013 20:13:21 GMT 2286 | -> content-encoding: gzip 2287 84 | == Indexed - Remove == 2288 | idx = 4 2289 | -> location: https://www.e\ 2290 | xample.com 2291 84 | == Indexed - Add == 2292 | idx = 4 2293 | -> location: https://www.e\ 2294 | xample.com 2295 83 | == Indexed - Remove == 2296 | idx = 3 2297 | -> :status: 200 2298 83 | == Indexed - Add == 2299 | idx = 3 2300 | -> :status: 200 2301 3a | == Literal indexed == 2302 | Indexed name (idx = 58) 2303 | set-cookie 2304 b3 | Literal value (len = 56) 2305 | Huffman encoded: 2306 c5ad b77f 876f c7fb f7fd bfbe bff3 f7f4 | .....o.......... 2307 fb7e bbbe 9f5f 87e3 7fef edfa eefa 7c3f | ....._........|? 2308 1d5d 1a23 ce54 6436 cd49 4bd5 d1cc 5f05 | .].#.Td6.IK..._. 2309 3596 9b | 5.. 2310 | Decoded: 2311 | foo=ASDJKHQKBZXOQWEOPIUAXQ\ 2312 | WEOIU; max-age=3600; versi\ 2313 | on=1 2314 | - evict: location: https:/\ 2315 | /www.example.com 2316 | - evict: :status: 200 2317 | -> set-cookie: foo=ASDJKHQ\ 2318 | KBZXOQWEOPIUAXQWEOIU; ma\ 2319 | x-age=3600; version=1 2321 Header Table (after decoding): 2323 [ 1] (s = 98) set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age\ 2324 =3600; version=1 2325 [ 2] (s = 52) content-encoding: gzip 2326 [ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:22 GMT 2327 Table size: 215 2329 Decoded header set: 2331 cache-control: private 2332 date: Mon, 21 Oct 2013 20:13:22 GMT 2333 content-encoding: gzip 2334 location: https://www.example.com 2335 :status: 200 2336 set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1 2338 Authors' Addresses 2340 Roberto Peon 2341 Google, Inc 2343 EMail: fenix@google.com 2345 Herve Ruellan 2346 Canon CRF 2348 EMail: herve.ruellan@crf.canon.fr