Updating hashes
Summary: GitHub commits:
https://github.com/facebook/CacheLib/commit/131894ee9cfdc7844d3afe2e5c0fb029fcf0922e https://github.com/facebook/fb303/commit/dbf38812da70f065e81aeaabaa45c7751f95d1ef https://github.com/facebook/fbthrift/commit/06b44f1cec1ad98e090971cbfd7def33cf509d46 https://github.com/facebook/folly/commit/866efdcff136065dd195f7914e2c24187e6d4189 https://github.com/facebook/hermes/commit/65df94b394f7c3a6417d4efbaf613b7ae7608494 https://github.com/facebook/mvfst/commit/cbf07a90962938c40ed11d8899d0e8b2e8771dd5 https://github.com/facebook/proxygen/commit/029d51d1070ba40ea2215fc5f9e8f70df93e438a https://github.com/facebook/pyrefly/commit/fb7004fb993c92927a5264de237daf64ef601c55 https://github.com/facebook/wangle/commit/0d0fd40dc75adf157f9cfa75b4e0963c9c527bce https://github.com/facebookexperimental/edencommon/commit/150a9280848272c64a7623de979697b60b0f71cc https://github.com/facebookexperimental/rust-shed/commit/71a5492f7e1f3686903f9fb40555b2202afb9d15 https://github.com/facebookincubator/fizz/commit/cbdf23e3df653bd4d44898c09545dd0f5cdc923b
Reviewed By: kainanpeace666
fbshipit-source-id: 96dc26580af50bce1d4bc8bba1c3011bc90e8dd6
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Proxygen: Facebook’s C++ HTTP Libraries
This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis for building many HTTP servers, proxies, and clients. This release focuses on the common HTTP abstractions and our simple HTTPServer framework. Future releases will provide simple client APIs as well. The framework supports HTTP/1.1, SPDY/3, SPDY/3.1, HTTP/2, and HTTP/3. The goal is to provide a simple, performant, and modern C++ HTTP library.
We have a Google group for general discussions at https://groups.google.com/d/forum/facebook-proxygen.
The original blog post also has more background on the project.
Learn More in This Intro Video
Installing
Note that currently this project has been tested on Ubuntu 18.04 and Mac OSX although it likely works on many other platforms.
You will need at least 3 GiB of memory to compile
proxygenand its dependencies.Easy Install
Just run
./build.shfrom theproxygen/directory to get and build all the dependencies andproxygen. You can run the tests manually withcd _build/ && make test. Then run./install.shto install it. You can remove the temporary build directory (_build) and./build.sh && ./install.shto rebase the dependencies, and then rebuild and reinstallproxygen.Package Managers
You can download and install proxygen using the vcpkg dependency manager:
The proxygen port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
Other Platforms
If you are running on another platform, you may need to install several packages first. Proxygen and
follyare all Autotools based projects.Introduction
Directory structure and contents:
proxygen/external/proxygen/lib/proxygen/lib/http/proxygen/lib/services/proxygen/lib/utils/proxygen/httpserver/proxygen/lib/for building simple C++ http servers. We recommend building on top of these APIs.Architecture
The central abstractions to understand in
proxygen/libare the session, codec, transaction, and handler. These are the lowest level abstractions, and we don’t generally recommend building off of these directly.When bytes are read off the wire, the
HTTPCodecstored insideHTTPSessionparses these into higher-level objects and associates with it a transaction identifier. The codec then calls intoHTTPSessionwhich is responsible for maintaining the mapping between transaction identifier andHTTPTransactionobjects. Each HTTP request/response pair has a separateHTTPTransactionobject. Finally,HTTPTransactionforwards the call to a handler object which implementsHTTPTransaction:: Handler. The handler is responsible for implementing business logic for the request or response.The handler then calls back into the transaction to generate egress (whether the egress is a request or response). The call flows from the transaction back to the session, which uses the codec to convert the higher-level semantics of the particular call into the appropriate bytes to send on the wire.
The same handler and transaction interfaces are used to both create requests and handle responses. The API is generic enough to allow both.
HTTPSessionis specialized slightly differently depending on whether you are using the connection to issue or respond to HTTP requests.Moving into higher levels of abstraction,
proxygen/HTTP serverhas a simpler set of APIs and is the recommended way to interface withproxygenwhen acting as a server if you don’t need the full control of the lower level abstractions.The basic components here are
HTTPServer,RequestHandlerFactory, andRequestHandler. AnHTTPServertakes some configuration and is given aRequestHandlerFactory. Once the server is started, the installedRequestHandlerFactoryspawns aRequestHandlerfor each HTTP request.RequestHandleris a simple interface users of the library implement. Subclasses ofRequestHandlershould use the inherited protected memberResponseHandler* downstream_to send the response.Using it
Proxygen is a library. After installing it, you can build your C++ server. Try
cding to the directory containing the echo server atproxygen/httpserver/samples/echo/.After building proxygen you can start the echo server with
_build/proxygen/httpserver/proxygen_echoand verify it works using curl in a different terminal:You can find other samples:
_build/proxygen/httpserver/proxygen_push),_build/proxygen/httpserver/proxygen_static)_build/proxygen/httpserver/proxygen_proxy)_build/proxygen/httpclient/samples/curl/proxygen_curl)QUIC and HTTP/3
Proxygen supports HTTP/3!
It depends on Facebook’s mvfst library for the IETF QUIC transport implementation.
This comes with a handy command-line utility that can be used as an HTTP/3 server and client.
Sample usage:
The utility supports the qlog logging format; just start the server with the
--qlogger_pathoption and many knobs to tune both the quic transport and the http layer.Documentation
We use Doxygen for Proxygen’s internal documentation. You can generate a copy of these docs by running
doxygen Doxyfilefrom the project root. You’ll want to look athtml/namespaceproxygen.htmlto start. This will also generatefollydocumentation.License
See LICENSE.
Contributing
Contributions to Proxygen are more than welcome. Read the guidelines in CONTRIBUTING.md. Make sure you’ve signed the CLA before sending in a pull request.
Whitehat
Facebook has a bounty program for the safe disclosure of security bugs. If you find a vulnerability, please go through the process outlined on that page and do not file a public issue.