mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
ae8f56a799
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 |
||
---|---|---|
.. | ||
fs | ||
integration | ||
locale | ||
mononoke | ||
scm | ||
test_support | ||
test-data | ||
.gitignore | ||
Eden.project.toml |