std-lib-orphanage icon indicating copy to clipboard operation
std-lib-orphanage copied to clipboard

HTTP/2 HPACK module

Open daurnimator opened this issue 6 years ago • 7 comments

Now that ziglang/zig#2263 is merged, it's possible to write a HPACK module.

The decoder should be fed HTTP/2 HEADERS blocks and dynamic table resize instructions; it should output http.headers objects. Vice-versa for the encoder.

Related:

  • ziglang/zig#910
  • ziglang/zig#2007

Note: I'm happy to mentor on this task if someone picks it up.

daurnimator avatar Jun 27 '19 18:06 daurnimator

I might be interested in this. What do you think, should the huffman coding part of HPACK (excluding the code tables) be in the stdlib in a generically usable form? If so, perhaps that could be a separate issue/PR combo?

vegai avatar Sep 27 '19 05:09 vegai

@vegai I don't know much about HPACK or what the API of a Huffman coding implementation would look like, but that sounds reasonable to me.

andrewrk avatar Sep 28 '19 23:09 andrewrk

I think I'll have to retreat here, not enough time and energy to really focus on this. Anyone else, feel free.

vegai avatar Oct 09 '19 11:10 vegai

Fixed link for HPACK docs https://httpwg.org/specs/rfc7541.html

nektro avatar Sep 26 '20 00:09 nektro

In case you're still interested in this, please note that I purposely wrote haproxy's hpack stack under MIT license so that it's easy to reuse it. The code is fast, proven and easy to read. It contains the huffman decoder and doesn't have an huffman encoder since it's only optional (and most often useless IMHO given that the dictionary offers much more savings than the extra few bits saved by huffman). Feel free to either copy it or inspire yourself from it to rewrite it in Zig, as you see fit.

Have a look at include/haproxy/hpack*.h, src/hpack*.c and dev/hpack/ in https://github.com/haproxy/haproxy/ if you're interested.

wtarreau avatar Dec 03 '23 07:12 wtarreau