draft-ietf-httpbis-header-compression-00.txt   draft-ietf-httpbis-header-compression-01.txt 
HTTPbis Working Group R. Peon HTTPbis Working Group R. Peon
Internet-Draft Google, Inc Internet-Draft Google, Inc
Intended status: Informational H. Ruellan Intended status: Informational H. Ruellan
Expires: December 27, 2013 Canon CRF Expires: January 10, 2014 Canon CRF
June 25, 2013 July 09, 2013
HTTP Header Compression HTTP/2.0 Header Compression
draft-ietf-httpbis-header-compression-00 draft-ietf-httpbis-header-compression-01
Abstract Abstract
This document describes a format adapted to efficiently represent This document describes a format adapted to efficiently represent
HTTP headers in the context of HTTP/2.0. HTTP headers in the context of HTTP/2.0.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
skipping to change at page 1, line 32 skipping to change at page 1, line 32
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 27, 2013. This Internet-Draft will expire on January 10, 2014.
Copyright Notice Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 12 skipping to change at page 2, line 12
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1. Outline . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1. Outline . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Header Encoding . . . . . . . . . . . . . . . . . . . . . . . 3 3. Header Encoding . . . . . . . . . . . . . . . . . . . . . . . 3
3.1. Encoding Components . . . . . . . . . . . . . . . . . . . 3 3.1. Encoding Components . . . . . . . . . . . . . . . . . . . 3
3.2. Header Table . . . . . . . . . . . . . . . . . . . . . . 4 3.2. Header Table . . . . . . . . . . . . . . . . . . . . . . 4
3.3. Header Representation . . . . . . . . . . . . . . . . . . 5 3.3. Header Representation . . . . . . . . . . . . . . . . . . 5
3.3.1. Literal Representation . . . . . . . . . . . . . . . 5 3.3.1. Literal Representation . . . . . . . . . . . . . . . 5
3.3.2. Indexed Representation . . . . . . . . . . . . . . . 5 3.3.2. Indexed Representation . . . . . . . . . . . . . . . 6
3.4. Differential Coding . . . . . . . . . . . . . . . . . . . 5 3.4. Differential Coding . . . . . . . . . . . . . . . . . . . 6
4. Detailed Format . . . . . . . . . . . . . . . . . . . . . . . 6 4. Detailed Format . . . . . . . . . . . . . . . . . . . . . . . 7
4.1. Header Blocks . . . . . . . . . . . . . . . . . . . . . . 6 4.1. Header Blocks . . . . . . . . . . . . . . . . . . . . . . 7
4.2. Low-level representations . . . . . . . . . . . . . . . . 7 4.2. Low-level representations . . . . . . . . . . . . . . . . 7
4.2.1. Integer representation . . . . . . . . . . . . . . . 7 4.2.1. Integer representation . . . . . . . . . . . . . . . 7
4.2.2. String literal representation . . . . . . . . . . . . 9 4.2.2. String literal representation . . . . . . . . . . . . 9
4.3. Indexed Header Representation . . . . . . . . . . . . . . 9 4.3. Indexed Header Representation . . . . . . . . . . . . . . 9
4.4. Literal Header Representation . . . . . . . . . . . . . . 9 4.4. Literal Header Representation . . . . . . . . . . . . . . 10
4.4.1. Literal Header without Indexing . . . . . . . . . . . 9 4.4.1. Literal Header without Indexing . . . . . . . . . . . 10
4.4.2. Literal Header with Incremental Indexing . . . . . . 10 4.4.2. Literal Header with Incremental Indexing . . . . . . 10
4.4.3. Literal Header with Substitution Indexing . . . . . . 10 4.4.3. Literal Header with Substitution Indexing . . . . . . 11
5. Parameter Negotiation . . . . . . . . . . . . . . . . . . . . 11 5. Parameter Negotiation . . . . . . . . . . . . . . . . . . . . 12
6. Security Considerations . . . . . . . . . . . . . . . . . . . 11 6. Security Considerations . . . . . . . . . . . . . . . . . . . 13
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13
8. Informative References . . . . . . . . . . . . . . . . . . . 11 8. Informative References . . . . . . . . . . . . . . . . . . . 13
Appendix A. Initial header names . . . . . . . . . . . . . . . . 12 Appendix A. Initial header names . . . . . . . . . . . . . . . . 13
A.1. Requests . . . . . . . . . . . . . . . . . . . . . . . . 12 A.1. Requests . . . . . . . . . . . . . . . . . . . . . . . . 14
A.2. Responses . . . . . . . . . . . . . . . . . . . . . . . . 13 A.2. Responses . . . . . . . . . . . . . . . . . . . . . . . . 15
Appendix B. Example . . . . . . . . . . . . . . . . . . . . . . 14 Appendix B. Example . . . . . . . . . . . . . . . . . . . . . . 16
B.1. First header set . . . . . . . . . . . . . . . . . . . . 14 B.1. First header set . . . . . . . . . . . . . . . . . . . . 16
B.2. Second header set . . . . . . . . . . . . . . . . . . . . 15 B.2. Second header set . . . . . . . . . . . . . . . . . . . . 17
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 16 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 18
1. Introduction 1. Introduction
This document describes a format adapted to efficiently represent This document describes a format adapted to efficiently represent
HTTP headers in the context of HTTP/2.0. HTTP headers in the context of HTTP/2.0.
2. Overview 2. Overview
In HTTP/1.X, HTTP headers, which are necessary for the functioning of In HTTP/1.X, HTTP headers, which are necessary for the functioning of
the protocol, are transmitted with no transformations. the protocol, are transmitted with no transformations.
skipping to change at page 4, line 18 skipping to change at page 4, line 18
the other set of compotents. the other set of compotents.
3.2. Header Table 3.2. Header Table
A header table consists of an ordered list of (name, value) pairs. A A header table consists of an ordered list of (name, value) pairs. A
pair is either inserted at the end of the table or replaces an pair is either inserted at the end of the table or replaces an
existing pair depending on the chosen representation. A pair can be existing pair depending on the chosen representation. A pair can be
represented as an index which is its position in the table, starting represented as an index which is its position in the table, starting
with 0 for the first entry. with 0 for the first entry.
Header names are always represented as lower-case strings. An input An input header name matches the header name of a (name, value) pair
header name matches the header name of a (name, value) pair stored in stored in the Header Table if they are equal using a character-based,
the Header Table if they are equal using a character-based, _case _case sensitive_ comparison. An input header value matches the
insensitive_ comparison. An input header value matches the header header value of a (name, value) pair stored in the Header Table if
value of a (name, value) pair stored in the Header Table if they are they are equal using a character-based, _case sensitive_ comparison.
equal using a character-based, _case sensitive_ comparison. An input An input header (name, value) pair matches a pair in the Header Table
header (name, value) pair matches a pair in the Header Table if both if both the name and value are matching as per above.
the name and value are matching as per above.
Generally, the header table will not contain duplicate header (name,
value) entries. However, implementations MUST be prepared to accept
duplicates without signaling an error. If duplicates are added to
the table, they MUST be treated as distinct entries with their own
index positions.
The header table is progressively updated based on headers The header table is progressively updated based on headers
represented as literal (as defined in Section 3.3.1). Two update represented as literal (as defined in Section 3.3.1). Two update
mechanisms are defined: mechanisms are defined:
o Incremental indexing: the represented header is inserted at the o Incremental indexing: the represented header is inserted at the
end of the header table as a (name, value) pair. The inserted end of the header table as a (name, value) pair. The inserted
pair index is set to the next free index in the table: it is equal pair index is set to the next free index in the table: it is equal
to the number of headers in the table before its insertion. to the number of headers in the table before its insertion.
skipping to change at page 5, line 4 skipping to change at page 5, line 8
is selected in a header representation, the header table is not is selected in a header representation, the header table is not
updated. In particular, no update happens on the header table when updated. In particular, no update happens on the header table when
processing an indexed representation. processing an indexed representation.
The header table size can be bounded so as to limit the memory The header table size can be bounded so as to limit the memory
requirements (see the SETTINGS_MAX_BUFFER_SIZE in Section 5). The requirements (see the SETTINGS_MAX_BUFFER_SIZE in Section 5). The
header table size is defined as the sum of the size of each entry of header table size is defined as the sum of the size of each entry of
the table. The size of an entry is the sum of the length in bytes the table. The size of an entry is the sum of the length in bytes
(as defined in Section 4.2.2) of its name, of value's length in bytes (as defined in Section 4.2.2) of its name, of value's length in bytes
and of 32 bytes (for accounting for the entry structure overhead). and of 32 bytes (for accounting for the entry structure overhead).
The header table size MUST NOT exceed this limit.
When an entry is added to the header table, if the header table size Before adding a new entry to the header table or changing an existing
is greater than the limit, the table size is reduced by dropping the one, a check has to be performed to ensure that the change will not
entries at the beginning of the table until the header table size cause the table to grow in size beyond the SETTINGS_MAX_BUFFER_SIZE
becomes lower than or equal to the limit. Dropping entries from the limit. If necessary, one or more items from the beginning of the
beginning of the table causes a renumbering of the remaining entries. table are removed until there is enough free space available to make
[[Feedback is needed on this automatic eviction strategy. ]] the modification. Dropping an entry from the beginning of the table
causes the index positions of the remaining entries in the table to
be decremented by 1. [[Feedback is needed on this automatic eviction
strategy. ]]
When using substitution indexing, it is possible that the existing
item being replaced might be one of the items removed when performing
the necessary size adjustment. In such cases, the substituted value
being added to the header table is inserted at the beginning of the
header table (at index position #0) and the index positions of the
other remaining entries in the table are incremented by 1.
To optimize the representation of the headers exchanged at the To optimize the representation of the headers exchanged at the
beginning of an HTTP/2.0 session, the header table is initialized beginning of an HTTP/2.0 session, the header table is initialized
with common headers. Two lists of initial headers are provided in with common headers. Two lists of initial headers are provided in
Appendix A. One is for messages sent from a client to a server, the Appendix A. One is for messages sent from a client to a server, the
other is for messages sent from a server to a client. other is for messages sent from a server to a client.
3.3. Header Representation 3.3. Header Representation
3.3.1. Literal Representation 3.3.1. Literal Representation
skipping to change at page 6, line 7 skipping to change at page 6, line 25
A set of headers is encoded as a difference from the previous A set of headers is encoded as a difference from the previous
reference set of headers. The initial reference set of headers is reference set of headers. The initial reference set of headers is
the empty set. the empty set.
An indexed representation toggles the presence of the header in the An indexed representation toggles the presence of the header in the
current set of headers. If the header corresponding to the indexed current set of headers. If the header corresponding to the indexed
representation was not in the set, it is added to the set. If the representation was not in the set, it is added to the set. If the
header index was in the set, it is removed from it. header index was in the set, it is removed from it.
A literal representation adds a header to the current set of headers A literal representation adds a header to the current set of headers.
if the header is added to the header table (either by incremental
indexing or by substitution indexing).
To ensure a correct decoding of a set of headers, the following steps To ensure a correct decoding of a set of headers, the following steps
or equivalent ones MUST be executed by the decoder. or equivalent ones MUST be executed by the decoder.
First, upon starting the decoding of a new set of headers, the First, upon starting the decoding of a new set of headers, the
reference set of headers is interpreted into the working set of reference set of headers is interpreted into the working set of
headers: for each header in the reference set, an entry is added to headers: for each header in the reference set, an entry is added to
the working set, containing the header name, its value, and its the working set, containing the header name, its value, and its
current index in the header table. current index in the header table.
skipping to change at page 9, line 33 skipping to change at page 9, line 47
2. The string value represented as a list of UTF-8 characters. 2. The string value represented as a list of UTF-8 characters.
4.3. Indexed Header Representation 4.3. Indexed Header Representation
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 1 | Index (7+) | | 1 | Index (7+) |
+---+---------------------------+ +---+---------------------------+
This representation starts with the '1' 1-bit prefix, followed by the Indexed Header
index of the matching pair, represented as an integer with a 7-bit
prefix. This representation starts with the '1' 1-bit pattern, followed by
the index of the matching pair, represented as an integer with a
7-bit prefix.
4.4. Literal Header Representation 4.4. Literal Header Representation
4.4.1. Literal Header without Indexing 4.4.1. Literal Header without Indexing
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 1 | 1 | Index (5+) | | 0 | 1 | 1 | Index (5+) |
+---+---+---+-------------------+ +---+---+---+-------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header without Indexing - Indexed Name
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | 1 | 0 |
+---+---+---+-------------------+
| Name Length (8+) |
+-------------------------------+
| Name String (Length octets) |
+-------------------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header without Indexing - New Name
This representation, which does not involve updating the header This representation, which does not involve updating the header
table, starts with the '011' 3-bit pattern. table, starts with the '011' 3-bit pattern.
If the header name matches the header name of a (name, value) pair If the header name matches the header name of a (name, value) pair
stored in the Header Table, the index of the pair increased by one stored in the Header Table, the index of the pair increased by one
(index + 1) is represented as an integer with a 5-bit prefix. Note (index + 1) is represented as an integer with a 5-bit prefix. Note
that if the index is strictly below 31, one byte is used. that if the index is strictly below 31, one byte is used.
If the header name does not match a header name entry, the value 0 is If the header name does not match a header name entry, the value 0 is
skipping to change at page 10, line 18 skipping to change at page 11, line 4
that if the index is strictly below 31, one byte is used. that if the index is strictly below 31, one byte is used.
If the header name does not match a header name entry, the value 0 is If the header name does not match a header name entry, the value 0 is
represented on 5 bits followed by the header name, represented as a represented on 5 bits followed by the header name, represented as a
literal string. literal string.
Header name representation is followed by the header value Header name representation is followed by the header value
represented as a literal string as described in Section 4.2.2. represented as a literal string as described in Section 4.2.2.
4.4.2. Literal Header with Incremental Indexing 4.4.2. Literal Header with Incremental Indexing
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 1 | 0 | Index (5+) | | 0 | 1 | 0 | Index (5+) |
+---+---+---+-------------------+ +---+---+---+-------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header with Incremental Indexing - Indexed Name
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | 0 | 0 |
+---+---+---+-------------------+
| Name Length (8+) |
+-------------------------------+
| Name String (Length octets) |
+-------------------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header with Incremental Indexing - New Name
This representation starts with the '010' 3-bit pattern. This representation starts with the '010' 3-bit pattern.
If the header name matches the header name of a (name, value) pair If the header name matches the header name of a (name, value) pair
stored in the Header Table, the index of the pair increased by one stored in the Header Table, the index of the pair increased by one
(index + 1) is represented as an integer with a 5-bit prefix. Note (index + 1) is represented as an integer with a 5-bit prefix. Note
that if the index is strictly below 31, one byte is used. that if the index is strictly below 31, one byte is used.
If the header name does not match a header name entry, the value 0 is If the header name does not match a header name entry, the value 0 is
represented on 5 bits followed by the header name, represented as a represented on 5 bits followed by the header name, represented as a
skipping to change at page 10, line 44 skipping to change at page 11, line 50
Header name representation is followed by the header value Header name representation is followed by the header value
represented as a literal string as described in Section 4.2.2. represented as a literal string as described in Section 4.2.2.
4.4.3. Literal Header with Substitution Indexing 4.4.3. Literal Header with Substitution Indexing
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
| 0 | 0 | Index (6+) | | 0 | 0 | Index (6+) |
+---+---+-----------------------+ +---+---+-----------------------+
| Substituted Index (8+) |
+-------------------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header with Substitution Indexing - Indexed Name
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 |
+---+---+-----------------------+
| Name Length (8+) |
+-------------------------------+
| Name String (Length octets) |
+-------------------------------+
| Substituted Index (8+) |
+-------------------------------+
| Value Length (8+) |
+-------------------------------+
| Value String (Length octets) |
+-------------------------------+
Literal Header with Substitution Indexing - New Name
This representation starts with the '00' 2-bit pattern. This representation starts with the '00' 2-bit pattern.
If the header name matches the header name of a (name, value) pair If the header name matches the header name of a (name, value) pair
stored in the Header Table, the index of the pair increased by one stored in the Header Table, the index of the pair increased by one
(index + 1) is represented as an integer with a 6-bit prefix. Note (index + 1) is represented as an integer with a 6-bit prefix. Note
that if the index is strictly below 62, one byte is used. that if the index is strictly below 62, one byte is used.
If the header name does not match a header name entry, the value 0 is If the header name does not match a header name entry, the value 0 is
represented on 6 bits followed by the header name, represented as a represented on 6 bits followed by the header name, represented as a
literal string. literal string.
The index of the substituted (name, value) pair is inserted after the The index of the substituted (name, value) pair is inserted after the
header name representation as a 0-bit prefix integer. header name representation as a 0-bit prefix integer.
The index of the substituted pair MUST correspond to a position in
the header table containing a non-void entry. An index for the
substituted pair that corresponds to empty position in the header
table MUST be treated as an error.
This index is followed by the header value represented as a literal This index is followed by the header value represented as a literal
string as described in Section 4.2.2. string as described in Section 4.2.2.
5. Parameter Negotiation 5. Parameter Negotiation
A few parameters can be used to accomodate client and server A few parameters can be used to accomodate client and server
processing and memory requirements. processing and memory requirements. [[These settings are currently
not supported as they have not been integrated in the main
specification. Therefore, the maximum buffer size for the header
table is fixed at 4096 bytes. ]]
SETTINGS_MAX_BUFFER_SIZE: Allows the sender to inform the remote SETTINGS_MAX_BUFFER_SIZE: Allows the sender to inform the remote
endpoint of the maximum size it accepts for the header table. endpoint of the maximum size it accepts for the header table.
The default value is 4096 bytes. The default value is 4096 bytes.
[[Is this default value OK? Do we need a maximum size? Do we [[Is this default value OK? Do we need a maximum size? Do we
want to allow infinite buffer?]] want to allow infinite buffer?]]
When the remote endpoint receives a SETTINGS frame containing a When the remote endpoint receives a SETTINGS frame containing a
SETTINGS_MAX_BUFFER_SIZE setting with a value smaller than the one SETTINGS_MAX_BUFFER_SIZE setting with a value smaller than the one
currently in use, it MUST send as soon as possible a HEADER frame currently in use, it MUST send as soon as possible a HEADER frame
with a stream identifier of 0x0 containing a value smaller than or with a stream identifier of 0x0 containing a value smaller than or
skipping to change at page 12, line 27 skipping to change at page 14, line 18
initial header table user to represent requests sent from a client to initial header table user to represent requests sent from a client to
a server. a server.
+-------+---------------------+--------------+ +-------+---------------------+--------------+
| Index | Header Name | Header Value | | Index | Header Name | Header Value |
+-------+---------------------+--------------+ +-------+---------------------+--------------+
| 0 | :scheme | http | | 0 | :scheme | http |
| 1 | :scheme | https | | 1 | :scheme | https |
| 2 | :host | | | 2 | :host | |
| 3 | :path | / | | 3 | :path | / |
| 4 | :method | get | | 4 | :method | GET |
| 5 | accept | | | 5 | accept | |
| 6 | accept-charset | | | 6 | accept-charset | |
| 7 | accept-encoding | | | 7 | accept-encoding | |
| 8 | accept-language | | | 8 | accept-language | |
| 9 | cookie | | | 9 | cookie | |
| 10 | if-modified-since | | | 10 | if-modified-since | |
| 11 | keep-alive | | | 11 | keep-alive | |
| 12 | user-agent | | | 12 | user-agent | |
| 13 | proxy-connection | | | 13 | proxy-connection | |
| 14 | referer | | | 14 | referer | |
 End of changes. 19 change blocks. 
47 lines changed or deleted 136 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/