HPACK implementation in OCaml.
For parsing and serialization, angstrom and faraday are used. Encoding and decoding algorithms are described in Exploring HTTP/2 Header Compression.
Compatibility with other HPACK implementations and sample test cases.
The compression rate for the sample test cases of hpack-test-case is comparable with other implementations
story | ocaml-hpack | nghttp2 | node-http2-hpack | haskell-http2-linear-huffman |
---|---|---|---|---|
story_00.json | 0.38 (70/183) | 0.38 (70/183) | 0.38 (70/183) | 0.38 (70/183) |
story_01.json | 0.34 (60/178) | 0.33 (58/178) | 0.33 (58/178) | 0.33 (58/178) |
story_02.json | 0.21 (723/3456) | 0.21 (723/3456) | 0.21 (723/3456) | 0.21 (723/3456) |
story_03.json | 0.16 (508/3113) | 0.16 (508/3113) | 0.16 (508/3113) | 0.16 (508/3113) |
story_04.json | 0.16 (508/3113) | 0.16 (508/3113) | 0.16 (508/3113) | 0.16 (508/3113) |
story_05.json | 0.16 (566/3455) | 0.16 (566/3455) | 0.16 (566/3455) | 0.16 (566/3455) |
story_06.json | 0.24 (838/3489) | 0.24 (838/3489) | 0.24 (838/3489) | 0.24 (838/3489) |
story_07.json | 0.19 (621/3192) | 0.19 (621/3192) | 0.19 (621/3192) | 0.19 (621/3192) |
story_08.json | 0.24 (972/4006) | 0.24 (972/4006) | 0.24 (972/4006) | 0.24 (972/4006) |
story_09.json | 0.20 (677/3309) | 0.20 (677/3309) | 0.20 (677/3309) | 0.20 (677/3309) |
story_10.json | 0.18 (549/3078) | 0.18 (549/3078) | 0.18 (549/3078) | 0.18 (549/3078) |
story_11.json | 0.21 (793/3706) | 0.21 (793/3706) | 0.21 (793/3706) | 0.21 (793/3706) |
story_12.json | 0.15 (746/4975) | 0.15 (746/4975) | 0.15 (746/4975) | 0.15 (746/4975) |
story_13.json | 0.18 (552/3104) | 0.18 (552/3104) | 0.18 (552/3104) | 0.18 (552/3104) |
story_14.json | 0.19 (599/3114) | 0.19 (599/3114) | 0.19 (599/3114) | 0.19 (599/3114) |
story_15.json | 0.16 (485/3046) | 0.16 (485/3046) | 0.16 (485/3046) | 0.16 (485/3046) |
story_16.json | 0.25 (1042/4189) | 0.23 (963/4189) | 0.23 (963/4189) | 0.23 (963/4189) |
story_17.json | 0.19 (622/3233) | 0.19 (622/3233) | 0.19 (622/3233) | 0.19 (622/3233) |
story_18.json | 0.20 (690/3457) | 0.20 (690/3457) | 0.20 (690/3457) | 0.20 (690/3457) |
story_19.json | 0.21 (684/3321) | 0.21 (684/3321) | 0.21 (684/3321) | 0.21 (684/3321) |
story_20.json | 0.14 (8729/63971) | 0.14 (8729/63971) | 0.14 (8729/63971) | 0.14 (8729/63971) |
story_21.json | 0.37 (54742/147841) | 0.38 (55470/147841) | 0.38 (55470/147841) | 0.39 (57858/147841) |
story_22.json | 0.27 (30786/112819) | 0.27 (30766/112819) | 0.27 (30766/112819) | 0.27 (30820/112819) |
story_23.json | 0.37 (40006/108675) | 0.37 (40015/108675) | 0.37 (40015/108675) | 0.36 (39361/108675) |
story_24.json | 0.29 (2769/9458) | 0.29 (2769/9458) | 0.29 (2769/9458) | 0.29 (2768/9458) |
story_25.json | 0.35 (24609/71264) | 0.35 (24606/71264) | 0.35 (24606/71264) | 0.35 (24854/71264) |
story_26.json | 0.32 (11940/37215) | 0.32 (11938/37215) | 0.32 (11941/37215) | 0.34 (12631/37215) |
story_27.json | 0.30 (39932/133117) | 0.30 (40296/133117) | 0.30 (40296/133117) | 0.32 (42514/133117) |
story_28.json | 0.32 (13701/42824) | 0.33 (14317/42824) | 0.33 (14317/42824) | 0.34 (14639/42824) |
story_29.json | 0.35 (40561/117127) | 0.35 (40494/117127) | 0.35 (40497/117127) | 0.35 (41279/117127) |
story_30.json | 0.31 (66752/218129) | 0.31 (66736/218129) | 0.31 (66736/218129) | 0.31 (67848/218129) |
story_31.json | 0.32 (11961/37215) | 0.32 (11959/37215) | 0.32 (11962/37215) | 0.34 (12652/37215) |
Overall | 0.31 (358793/1162372) | 0.31 (360319/1162372) | 0.31 (360328/1162372) | 0.32 (368177/1162372) |