Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
fd07247a
Commit
fd07247a
authored
Jan 11, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update doc
parent
da9bbb58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
448 additions
and
313 deletions
+448
-313
README.rst
README.rst
+448
-313
No files found.
README.rst
View file @
fd07247a
...
@@ -429,41 +429,45 @@ The ``src`` directory contains HPACK tools. The ``deflatehd`` is
...
@@ -429,41 +429,45 @@ The ``src`` directory contains HPACK tools. The ``deflatehd`` is
command-line header compression tool. The ``inflatehd`` is
command-line header compression tool. The ``inflatehd`` is
command-line header decompression tool. Both tools read input from
command-line header decompression tool. Both tools read input from
stdin and write output to stdout. The errors are written to
stdin and write output to stdout. The errors are written to
stderr. They take JSON as input and output.
stderr. They take JSON as input and output. We use the same JSON data
format used in https://github.com/Jxck/hpack-test-case
deflatehd - header compressor
deflatehd - header compressor
+++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++
The ``deflatehd`` reads JSON
array
or HTTP/1-style header fields from
The ``deflatehd`` reads JSON
data
or HTTP/1-style header fields from
stdin and outputs compressed header block in JSON
array
.
stdin and outputs compressed header block in JSON.
For the JSON input, the element of input array must be a JSON
For the JSON input, the root JSON object must contain ``context`` key,
object. Each object must have at least following key:
which indicates which compression context is used. If it is
``request``, request compression context is used. Otherwise, response
headers
compression context is used. The value of ``cases`` key contains the
A JSON array of name/value pairs. The each element is a JSON array
sequence of input header set. They share the same compression context
of 2 strings. The index 0 must contain header name and the index 1
and are processed in the order they appear. Each item in the sequence
must contain header value.
is a JSON object and it must have at least ``headers`` key. Its value
is an array of a JSON object containing exactly one name/value pair.
Example::
Example::
{
"context": "request",
"cases":
[
[
{
{
"headers": [
"headers": [
[ ":method", "GET" ]
,
{ ":method": "GET" }
,
[ ":path", "/" ]
{ ":path": "/" }
]
]
},
},
{
{
"headers": [
"headers": [
[ ":method", "POST" ]
,
{ ":method": "POST" }
,
[ ":path", "/" ]
{ ":path": "/" }
]
]
}
}
]
]
}
These header sets are processed in the order they appear in the JSON
outer most array using same compression context.
With ``-t`` option, the program can accept more familiar HTTP/1 style
With ``-t`` option, the program can accept more familiar HTTP/1 style
header field block. Each header set is delimited by empty line:
header field block. Each header set is delimited by empty line:
...
@@ -477,46 +481,97 @@ Example::
...
@@ -477,46 +481,97 @@ Example::
:method: POST
:method: POST
user-agent: nghttp2
user-agent: nghttp2
The output is a JSON array and each element is JSON object, which has
The output is JSON object. It contains ``context`` key and its value
at least following keys:
is ``request`` if the compression context is request, otherwise
``response``. The root JSON object also contains ``cases`` key and its
value is an array of JSON object, which has at least following keys:
seq
seq
The index of header set in the input.
The index of header set in the input.
input
Len
input
_length
The sum of length of name/value pair in the input.
The sum of length of name/value pair in the input.
output
L
ength
output
_l
ength
The length of compressed header block.
The length of compressed header block.
percentage
OfOriginalS
ize
percentage
_of_original_s
ize
inputLen / outputLength
* 100
``input_length`` / ``output_length``
* 100
output
wire
The compressed header block in hex string.
The compressed header block in hex string.
headers
The input header set.
header_table_size
The header table size adjsuted before deflating header set.
Examples::
Examples::
{
"context": "request",
"cases":
[
[
{
{
"seq": 0,
"seq": 0,
"inputLen": 66,
"input_length": 66,
"outputLength": 20,
"output_length": 20,
"percentageOfOriginalSize": 30.303030303030305,
"percentage_of_original_size": 30.303030303030305,
"output": "818703881f3468e5891afcbf863c856659c62e3f"
"wire": "01881f3468e5891afcbf83868a3d856659c62e3f",
"headers": [
{
":authority": "example.org"
},
},
{
":method": "GET"
},
{
":path": "/"
},
{
":scheme": "https"
},
{
"user-agent": "nghttp2"
}
],
"header_table_size": 4096
}
,
{
{
"seq": 1,
"seq": 1,
"inputLen": 74,
"input_length": 74,
"outputLength": 10,
"output_length": 10,
"percentageOfOriginalSize": 13.513513513513514,
"percentage_of_original_size": 13.513513513513514,
"output": "87038504252dd5918386"
"wire": "88448504252dd5918485",
"headers": [
{
":authority": "example.org"
},
{
":method": "POST"
},
{
":path": "/account"
},
{
":scheme": "https"
},
{
"user-agent": "nghttp2"
}
],
"header_table_size": 4096
}
}
]
]
}
The output can be used as the input for ``inflatehd``.
With ``-d`` option, the extra ``headerTable`` key is added and its
The output can be used as the input for ``inflatehd`` and
``deflatehd``.
With ``-d`` option, the extra ``header_table`` key is added and its
associated value contains the state of dyanmic header table after the
associated value contains the state of dyanmic header table after the
corresponding header set was processed. The value contains following
corresponding header set was processed. The value contains following
keys:
keys:
...
@@ -535,58 +590,73 @@ size
...
@@ -535,58 +590,73 @@ size
The sum of the spaces entries occupied, this includes the
The sum of the spaces entries occupied, this includes the
entry overhead.
entry overhead.
max
S
ize
max
_s
ize
The maximum header table size.
The maximum header table size.
deflateSize
deflate_size
The sum of the spaces entries occupied within ``maxDeflateSize``.
The sum of the spaces entries occupied within
``max_deflate_size``.
max
DeflateS
ize
max
_deflate_s
ize
The maximum header table size encoder uses. This can be smaller
The maximum header table size encoder uses. This can be smaller
than ``max
S
ize``. In this case, encoder only uses up to first
than ``max
_s
ize``. In this case, encoder only uses up to first
``max
DeflateS
ize`` buffer. Since the header table size is still
``max
_deflate_s
ize`` buffer. Since the header table size is still
``max
S
ize``, the encoder has to keep track of entries ouside the
``max
_s
ize``, the encoder has to keep track of entries ouside the
``max
DeflateSize`` but inside the ``maxSize`` and make sure that
``max
_deflate_size`` but inside the ``max_size`` and make sure
they are no longer referenced.
th
at th
ey are no longer referenced.
Example::
Example::
{
"context": "request",
"cases":
[
[
{
{
"seq": 0,
"seq": 0,
"inputLen": 66,
"input_length": 66,
"outputLength": 20,
"output_length": 20,
"percentageOfOriginalSize": 30.303030303030305,
"percentage_of_original_size": 30.303030303030305,
"output": "818703881f3468e5891afcbf863c856659c62e3f",
"wire": "01881f3468e5891afcbf83868a3d856659c62e3f",
"headerTable": {
"headers": [
{
":authority": "example.org"
},
{
":method": "GET"
},
{
":path": "/"
},
{
":scheme": "https"
},
{
"user-agent": "nghttp2"
}
],
"header_table_size": 4096,
"header_table": {
"entries": [
"entries": [
{
{
"index": 0
,
"index": 1
,
"name": "user-agent",
"name": "user-agent",
"value": "nghttp2",
"value": "nghttp2",
"referenced": true,
"referenced": true,
"size": 49
"size": 49
},
},
{
"index": 1,
"name": ":path",
"value": "/",
"referenced": true,
"size": 38
},
{
{
"index": 2,
"index": 2,
"name": ":authority
",
"name": ":scheme
",
"value": "example.org
",
"value": "https
",
"referenced": true,
"referenced": true,
"size": 53
"size": 44
},
},
{
{
"index": 3,
"index": 3,
"name": ":scheme
",
"name": ":path
",
"value": "https
",
"value": "/
",
"referenced": true,
"referenced": true,
"size": 44
"size": 38
},
},
{
{
"index": 4,
"index": 4,
...
@@ -594,29 +664,48 @@ Example::
...
@@ -594,29 +664,48 @@ Example::
"value": "GET",
"value": "GET",
"referenced": true,
"referenced": true,
"size": 42
"size": 42
},
{
"index": 5,
"name": ":authority",
"value": "example.org",
"referenced": true,
"size": 53
}
}
],
],
"size": 226,
"size": 226,
"maxS
ize": 4096,
"max_s
ize": 4096,
"deflateS
ize": 226,
"deflate_s
ize": 226,
"maxDeflateS
ize": 4096
"max_deflate_s
ize": 4096
}
}
},
}
,
{
{
"seq": 1,
"seq": 1,
"inputLen": 74,
"input_length": 74,
"outputLength": 10,
"output_length": 10,
"percentageOfOriginalSize": 13.513513513513514,
"percentage_of_original_size": 13.513513513513514,
"output": "87038504252dd5918386",
"wire": "88448504252dd5918485",
"headerTable": {
"headers": [
"entries": [
{
{
"index": 0,
":authority": "example.org"
"name": ":path",
"value": "/account",
"referenced": true,
"size": 45
},
},
{
":method": "POST"
},
{
":path": "/account"
},
{
":scheme": "https"
},
{
"user-agent": "nghttp2"
}
],
"header_table_size": 4096,
"header_table": {
"entries": [
{
{
"index": 1,
"index": 1,
"name": ":method",
"name": ":method",
...
@@ -633,98 +722,144 @@ Example::
...
@@ -633,98 +722,144 @@ Example::
},
},
{
{
"index": 3,
"index": 3,
"name": ":scheme",
"value": "https",
"referenced": true,
"size": 44
},
{
"index": 4,
"name": ":path",
"name": ":path",
"value": "/",
"value": "/",
"referenced": false,
"referenced": false,
"size": 38
"size": 38
},
},
{
"index": 4,
"name": ":authority",
"value": "example.org",
"referenced": true,
"size": 53
},
{
{
"index": 5,
"index": 5,
"name": ":scheme",
"value": "https",
"referenced": true,
"size": 44
},
{
"index": 6,
"name": ":method",
"name": ":method",
"value": "GET",
"value": "GET",
"referenced": false,
"referenced": false,
"size": 42
"size": 42
},
{
"index": 6,
"name": ":authority",
"value": "example.org",
"referenced": true,
"size": 53
}
}
],
],
"size": 314
,
"size": 269
,
"maxS
ize": 4096,
"max_s
ize": 4096,
"deflateSize": 314
,
"deflate_size": 269
,
"maxDeflateS
ize": 4096
"max_deflate_s
ize": 4096
}
}
}
}
]
]
}
inflatehd - header decompressor
inflatehd - header decompressor
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++
The ``inflatehd`` reads JSON array from stdin and outputs decompressed
The ``inflatehd`` reads JSON data from stdin and outputs decompressed
name/value pairs in JSON array. The element of input array must be a
name/value pairs in JSON.
JSON object. Each object must have at least following key:
output
The root JSON object must contain ``context`` key, which indicates
compressed header block in hex string.
which compression context is used. If it is ``request``, request
compression context is used. Otherwise, response compression context
is used. The value of ``cases`` key contains the sequence of
compressed header block. They share the same compression context and
are processed in the order they appear. Each item in the sequence is a
JSON object and it must have at least ``wire`` key. Its value is a
string containing compressed header block in hex string.
Example::
Example::
{
"context": "request",
"cases":
[
[
{ "output": "0284f77778ff
" },
{ "wire": "8285
" },
{ "output": "0185fafd3c3c7f81
" }
{ "wire": "8583
" }
]
]
}
The output is a JSON array and each element is JSON object, which has
The output is JSON object. It contains ``context`` key and its value
at least following keys:
is ``request`` if the compression context is request, otherwise
``response``. The root JSON object also contains ``cases`` key and its
value is an array of JSON object, which has at least following keys:
seq
seq
The index of header set in the input.
The index of header set in the input.
headers
headers
The JSON array contains decompressed name/value pairs. Each
The JSON array contains decompressed name/value pairs.
element is JSON aray having 2 elements. The index 0 of the array
contains the header field name. The index 1 contains the header
wire
field value.
The compressed header block in hex string.
header_table_size
The header table size adjsuted before inflating compressed header
block.
Example::
Example::
{
"context": "request",
"cases":
[
[
{
{
"seq": 0,
"seq": 0,
"wire": "01881f3468e5891afcbf83868a3d856659c62e3f",
"headers": [
"headers": [
[":authority", "example.org"],
{
[":method", "GET"],
":authority": "example.org"
[":path", "/"],
[":scheme", "https"],
["user-agent", "nghttp2"]
]
},
},
{
":method": "GET"
},
{
":path": "/"
},
{
":scheme": "https"
},
{
"user-agent": "nghttp2"
}
],
"header_table_size": 4096
}
,
{
{
"seq": 1,
"seq": 1,
"wire": "88448504252dd5918485",
"headers": [
"headers": [
[":authority", "example.org"],
{
[":method", "POST"],
":method": "POST"
[":path", "/account"],
},
[":scheme", "https"],
{
["user-agent", "nghttp2"]
":path": "/account"
]
},
{
"user-agent": "nghttp2"
},
{
":scheme": "https"
},
{
":authority": "example.org"
}
],
"header_table_size": 4096
}
}
]
]
}
The output can be used as the input for ``deflatehd``.
The output can be used as the input for ``deflatehd`` and
``inflatehd``.
With ``-d`` option, the extra ``header
T
able`` key is added and its
With ``-d`` option, the extra ``header
_t
able`` key is added and its
associated value contains the state of dyanmic header table after the
associated value contains the state of dyanmic header table after the
corresponding header set was processed. The format is the same as
corresponding header set was processed. The format is the same as
``deflatehd``.
``deflatehd``.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment