sapling/eden
Thomas Orozco ae8f56a799 mononoke/server: convert HTTP stack to Hyper
Summary:
Like it says in the title, this updates our HTTP stack to Hyper. There are a
few reasons to do this here:

- We can remove all the manual parsing & generation of HTTP, and instead let
  Hyper (i.e. a HTTP framework) handle HTTP for us.
- We can use / reuse more pre-existing abstractions for things where we have to
  implement HTTP handling (rather than just try to update to a websocket ASAP),
  like the net speed test.
- And finally, my main motivation for this is that this will make it much
  easier to load EdenAPI into Mononoke Server as a service. At this point, we
  have a `Request` to pass into a function that returns a `Response`, which is
  exactly what EdenAPI is, so hooking it in will be trivial.

There's a lot going on in this diff, so here is an overview. Overall, our
connection handling process is:

- Accept connection
- Perform TLS handshake
- Check if the remote is trusted
- Check ALPN:
  - If hgcli, then read the preamble then run wireproto over the socket.
  - If http, hand off the socket to Hyper. Hyper will call into our
    MononokeHttpService (which is a Hyper Service) once per request.
    - If websocket upgrade, accept the upgrade, then run wireproto over the
      resulting I/O (i.e. the upgraded connection). An upgrade takes over the
      connection, so implicitly this means there won't be further requests.
    - If health check or net speed test, handle it. There might be multiple
      requests here via connection reuse.
    - This is where hooking EdenAPI will happen. We can instantiate Gotham
      here: it also is a Hyper Service, so we just need to call it.

While in there, I've modelled those various states using structs instead of
passing a handful of arguments here or there.

Reviewed By: johansglock

Differential Revision: D26018641

fbshipit-source-id: dd757d72fe0f17f7c98c1948a6aa34d0c4d95cbf
2021-02-01 07:53:15 -08:00
..
fs rate limit logging 2021-01-29 14:34:23 -08:00
integration improve the glob tests 2021-01-27 12:04:50 -08:00
locale add a copyright header to glibc_en.po 2019-04-26 14:38:27 -07:00
mononoke mononoke/server: convert HTTP stack to Hyper 2021-02-01 07:53:15 -08:00
scm create subvolumes on disk backing repo 2021-01-29 20:43:23 -08:00
test_support Manually upgrading eden, and fixing their config 2020-08-06 12:37:04 -07:00
test-data enable treemanifest in snapshots 2019-08-28 18:46:03 -07:00
.gitignore eden: wire up mac contbuild 2019-02-05 21:52:30 -08:00
Eden.project.toml Eden.project.toml file for Nuclide 2018-04-26 11:05:23 -07:00