GitHub user maskit opened a pull request:
https://github.com/apache/trafficserver/pull/460
TS-4092: Decouple HPACK from HTTP/2
I tried to decouple HPACK from HTTP2, and it partially succeeded. It's very
difficult to completely decouple HPACK unless we use MIMEField in it.
# Changes:
- Added two functions to HPACK module
- hpack_decode_header_block
- hpack_encode_header_block
These functions handle a header block(uint8_t *) and a header
list(HTTPHdr *), and convert them from one to another. They simply take care of
RFC7541(HPACK). Which means no special treatment for particular headers such as
pseudo headers.
- Simplified HPACK related functions in HTTP2 module
- http2_write_psuedo_headers(removed)
- http2_write_header_fragment(removed)
- http2_convert_header_from_1_1_to_2(added)
- http2_convert_header_from_2_to_1_1(renamed)
- http2_decode_header_blocks(simplified)
- http2_encode_header_blocks(added)
The last two functions handle a header block and a header list too, but
they take care of RFC7540(HTTP2). They are responsible for handling of
sensitive headers, effectiveness (RFC7540 Section 8.1.2.5) and HTTP2 related
limitations.
- Added a flag of sensitivity to MIMEField
The flag is used for determining a representation of a header field when
encoding response headers. It will also be used when we support HTTP2 on server
side connections because an intermediary needs to remember representation of
each header fields to ensure that a never-indexed representation field will not
be re-encoded as a indexed representation field (RFC7541 Section 7.1.3).
# Benefits:
- HPACK module has been simple
Simple is best.
- HPACK module has been testable
Our HPACK module has been a pure HPACK implementation. It means we can
use external common test cases which other implementations use. It will ensure
compatibility.
https://github.com/http2jp/hpack-test-case
- HPACK module has been (almost) decoupled from HTTP2
We can use the module not only for HTTP2 but also QUIC (if we support
it).
# Issues:
- MIMEField converts header names old fashioned
Because RFC 7541(HPACK) does not mention about case of characters, we
should not change them in HPACK module but MIMEField does against WKSs. So we
have to convert the strings to lowercase just before encoding in HPACK module
to follow RFC 7540(HTTP2). This blocks complete decoupling.
- Cannot prepend a header field to HTTPHdr
HTTP2 cares order of header fields. Pseudo header fields must be at the
beginning of header fields. To convert HTTP1.1 header to HTTP2 header, we need
to prepend pseudo header fields to a existing HTTPHdr. However, the only way to
achieve this is creating new HTTPHdr for now. It does cost. The same thing will
happen when we support HTTP2 on server side connection. This would affect
performance.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maskit/trafficserver ts4092
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/460.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #460
----
commit 3f5ac05a50443ce77201746061f43f5804eff4ec
Author: Masakazu Kitajo <[email protected]>
Date: 2016-02-08T14:52:59Z
TS-4092: Decouple HPACK from HTTP/2
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---