Discussion:
How to use HPACK with HttpClient 5
Jack van Ooststroom
2018-08-22 14:57:23 UTC
Permalink
Hello,

We started using HttpClient 5 in order for us to communicate with
Apple's APNs service which requires the usage of HTTP/2. However, we are
currently running into an issue with the "apns-collapse-id" header.
According to the specification
(https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html):

/"APNs requires the use of HPACK (header compression for HTTP/2),
which prevents repeated header keys and values. APNs maintains a
small dynamic table for HPACK. To help avoid filling up the APNs
HPACK table and necessitating the discarding of table data, encode
headers in the following way—especially when sending a large number
of streams:/

* /The :path value should be encoded as a literal header field
without indexing/
* /The authorization request header, if present, should be encoded
as a literal header field without indexing/
* /The appropriate encoding to employ for the apns-id,
apns-expiration, and apns-collapse-id request headers differs
depending on whether it is part of the initial or a subsequent
POST operation, as follows:/
o /The first time you send these headers, encode them with
incremental indexing to allow the header names to be added
to the dynamic table/
o /Subsequent times you send these headers, encode them as
literal header fields without indexing/

/Encode all other headers as literal header fields with incremental
indexing. For specifics on header encoding, see
tools.ietf.org/html/rfc7541#section-6.2.1 and
tools.ietf.org/html/rfc7541#section-6.2.2."/

When setting headers on a SimpleHttpRequest, how can we differentiate
between /"... //encode them with incremental indexing..."/ and /"...
//encode them as literal header fields without indexing"/?

Thanks in advance.

Regards,
Jack...
//
Oleg Kalnichevski
2018-08-23 08:38:00 UTC
Permalink
Post by Jack van Ooststroom
Hello,
We started using HttpClient 5 in order for us to communicate with 
Apple's APNs service which requires the usage of HTTP/2. However, we
are 
currently running into an issue with the "apns-collapse-id" header. 
According to the specification 
(https://developer.apple.com/library/archive/documentation/Networking
Internet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html)
    /"APNs requires the use of HPACK (header compression for HTTP/2),
    which prevents repeated header keys and values. APNs maintains a
    small dynamic table for HPACK. To help avoid filling up the APNs
    HPACK table and necessitating the discarding of table data,
encode
    headers in the following way—especially when sending a large
number
    of streams:/
      * /The :path value should be encoded as a literal header field
        without indexing/
      * /The authorization request header, if present, should be
encoded
        as a literal header field without indexing/
      * /The appropriate encoding to employ for the apns-id,
        apns-expiration, and apns-collapse-id request headers differs
        depending on whether it is part of the initial or a
subsequent
        POST operation, as follows:/
          o /The first time you send these headers, encode them with
            incremental indexing to allow the header names to be
added
            to the dynamic table/
          o /Subsequent times you send these headers, encode them as
            literal header fields without indexing/
    /Encode all other headers as literal header fields with
incremental
    indexing. For specifics on header encoding, see
    tools.ietf.org/html/rfc7541#section-6.2.1 and
    tools.ietf.org/html/rfc7541#section-6.2.2."/
When setting headers on a SimpleHttpRequest, how can we
differentiate 
between /"... //encode them with incremental indexing..."/ and /"... 
//encode them as literal header fields without indexing"/?
Use `sensitive` attribute on the request header to ensure its literal
encoding of the header when transmitted over an HTTP/2 connection.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-***@hc.apache.org
For additional commands, e-mail: httpclient-users-***@hc.apache.org
Loading...