Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/2 HPACK module #3

Open
daurnimator opened this issue Jun 27, 2019 · 7 comments
Open

HTTP/2 HPACK module #3

daurnimator opened this issue Jun 27, 2019 · 7 comments

Comments

@daurnimator
Copy link
Contributor

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:

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

@vegai
Copy link

vegai commented Sep 27, 2019

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?

@andrewrk
Copy link
Member

@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.

@vegai
Copy link

vegai commented Oct 9, 2019

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

@nektro
Copy link

nektro commented Sep 26, 2020

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

@andrewrk andrewrk transferred this issue from ziglang/zig Sep 30, 2020
@wtarreau
Copy link

wtarreau commented Dec 3, 2023

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.

@Jeevananthan-23
Copy link

https://github.com/richiejp/barely-http2/blob/main/src/hpack.zig @richiejp implemented HPACK/ http2 server for zig.

@richiejp
Copy link
Sponsor

Having a Huffman API, at least to generate a encoder/decoder from an existing table would be interesting. I seem to remember that Huffman encoding soaked up a lot of time and that is without doing any optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants