elixir-mint / mint

Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱
Apache License 2.0
1.36k stars 112 forks source link

Mint's HPack implementation is great and should be a separate hex package #330

Closed mtrudel closed 3 years ago

mtrudel commented 3 years ago

I'm working on a greenfield pure-Elixir HTTP(/2) server called bandit (unveiling it at ElixirConf next month!) and in chasing down the last few HPack bugs in the h2spec suite I'm coming to realize that mint's HPack implementation is the best of the pack (I've also considered HPack and hpack_erl but they both fail in fairly deep & subtle ways and neither project seems active any longer).

In light of this, would you be amenable to breaking out mint's HPack implementation into a discrete hex package to share the implementation between client and server? I'm happy to do the work, and take/not take ownership of the resultant package as you'd prefer.

From a timeline perspective, I'm really hoping to hit 100% h2spec compliance in time for ElixirConf, so I'd be looking at landing at least the library itself in the next couple of weeks (recognizing that a PR to migrate mint itself to the library is likely too optimistic on that timeline).

In future, I've got a bunch of other cool plans for bandit and mint to symbiotically share code / test / fuzz against one another. Hoping this is the first of many successful collaborations!

whatyouhide commented 3 years ago

I'm open to the idea of separating the HPack implementation into its own library but only if @ericmj and I remain maintainers and it stays under the @elixir-mint GitHub organization. This is not in any way a show of distrust @mtrudel! I just want to know that we will keep maintainer access and ultimately "last calls" for what happens to the library. We also care to keep control over the license when possible. 🙃

That said, if @ericmj is on board, I would be happy to create a repo under @elixir-mint so that you can start opening PRs over there. We have no rush to move Mint but the whole moving of code and replacing calls in Mint should not be a lot of work. Let's wait for Eric!

Thanks 💟

mtrudel commented 3 years ago

Thanks for the quick reply! That sounds ideal; I obviously have no problems with you staying as maintainers (it's your code, after all!), and keeping the library under the mint umbrella makes the most sense for sure.

Fortunately, our needs for the library should be perfectly in sync (as you obviously are aware the use of HPack is totally symmetric in the protocol) so I'm sure your 'last calls' would be fine from my perspective. FWIW the edge cases I'm running up against with other libraries stem from cases 5.2, 6.1 and 6.3 of the h2spec suite, all of which have pretty objectively correct resolutions.

I'll keep a close eye on this issue and am happy to do any work bringing code over as you and @ericmj wish.

ericmj commented 3 years ago

I am on board!

Looking forward to learning more about your HTTP server @mtrudel.

whatyouhide commented 3 years ago

@ericmj @mtrudel my naming suggestions:

  1. hpax/HPAX (like Msgpax and other libraries in Elixir that use the "x" naming)
  2. mint_hpack/MintHPACK

Any preference or other suggestions?

mtrudel commented 3 years ago

I prefer hpax!

ericmj commented 3 years ago

HPAX 👍

whatyouhide commented 3 years ago

@mtrudel I created https://github.com/elixir-mint/hpax. You're welcome to start moving the code over 🙃

whatyouhide commented 3 years ago

Closing this issue since we have something actionable that we'll do!

mtrudel commented 3 years ago

Work is complete at: