Updating hashes
Summary: GitHub commits:
https://github.com/facebook/CacheLib/commit/f2f83ceb43294e383bc4524bc294b681910737eb https://github.com/facebook/fb303/commit/ce8af6280bc7ce336ddc05064d0165cfdcb24b58 https://github.com/facebook/fbthrift/commit/da27a027f856b63281e2c36b1a35d3c38a7229cf https://github.com/facebook/folly/commit/e243181570d06e6e746bc3995f0745f0e3dfd532 https://github.com/facebook/hermes/commit/36ab30689cf94a66203f5f99d9a4dd4d7930c515 https://github.com/facebook/mvfst/commit/3fc45489431dea92fbbdbf6d74161da416178f1a https://github.com/facebook/proxygen/commit/4954ad12adc177a9654ef7b5f9c30a1bdc6d6658 https://github.com/facebook/pyrefly/commit/b4cf749b51534e0886d9568da126cbd7dae784cd https://github.com/facebook/wangle/commit/ab25c8c58a444e62adb5ba9cb59aa25d4aa1fb45 https://github.com/facebookexperimental/edencommon/commit/f7388c02828151cd5371e1a6d572f741aa7a31f2 https://github.com/facebookexperimental/rust-shed/commit/aaefb4dbc2685df0a63721e3ff2b45e0f5c3b124 https://github.com/facebookincubator/fizz/commit/7de8f52e9878206cd3a0192d9b4295cd58cd2ac9
Reviewed By: ajb85
fbshipit-source-id: 2f63954b9a484cc3590def6cf8ac9d41494bc41f
版权所有:中国计算机学会技术支持:开源发展技术委员会
京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.