1
0
mirror of https://github.com/facebook/proxygen.git synced 2026-10-24 01:33:54 +03:00
Michel Lind efd9a3db50 getdeps: EL 10 system packages, static glog by default
Summary:
CentOS Stream 10 and EPEL 10 carry nearly everything `cachelib`
needs, but the manifests only map most of these libraries for
`distro=fedora`, so `getdeps` builds `fmt`, `gflags`, `googletest`,
`benchmark` and `Boost` from source there for no reason. Two mappings
are also wrong for EL 10 rather than merely missing: it ships
`zlib-ng` under the compat names like Fedora, not the plain
`zlib-devel`/`zlib-static` the "not fedora" section assumes, and it has
no `lz4-static` at all, which the selector only excluded for EL 8
and 9.

This diff selects on the `rhel` family rather than naming CentOS
Stream, spelling the mappings as "Fedora, or the `rhel` family other
than 8 and 9", so Alma, Rocky and RHEL itself get them and EL 11 needs
no further edit.

Two libraries stay unmapped outside Fedora because EPEL's versions are
too old for the revisions pinned here: `glog`, where EPEL 9 and 10 both
have 0.3.5 against a post-0.6.0 commit, and `fast_float`, where
EPEL 10's 6.1.6 lacks the `parse_options_t` constructor folly's
`Conv.cpp` uses (found by building:
https://koji.fedoraproject.org/koji/taskinfo?taskID=151005880).

`install-system-deps --dry-run --recursive cachelib` now asks for 35
packages on `centos_stream` 10, the Fedora list minus `glog-devel`,
`fast_float-devel` and `lz4-static`, and all of them exist in CentOS
Stream 10 or EPEL 10. The `centos_stream` 9 and 8 lists are unchanged:
9 still takes `zlib-devel` and `zlib-static` and builds the rest, 8
still takes the `boost169` compat packages.

The `glog` manifest also set `BUILD_SHARED_LIBS=ON` unconditionally,
while `folly` and `fbthrift` set it only under
`feature_shared_libs=on`. A static build therefore still linked a
shared `libglog`, and the manifest's own patchfile comment already
assumes the opposite ("default-visibility symbols in a static archive
are harmless for consumers that don't need the shared_libs feature").

It shows up downstream: the Fedora and EPEL packages of `cachelib` and
`mcrouter` ship executables with the whole stack linked statically and
no libraries at all, yet came out requiring `libglog.so.1`, which
nothing installs. On EPEL 10 that is not even satisfiable, since its
`glog` is 0.3.5 and provides `libglog.so.0`.

This diff moves the define under `feature_shared_libs=on`, as the
other two do, so `--shared-lib` still gets a shared `glog` and everyone
else gets a static one.

Origin: verified on fork branch `michel-slm/CacheLib`
`getdeps-el10-rpm-mappings`, commits `1aef1670` (EL 10 mappings) and
`6ad39916` (`glog` shared default); imported here for ShipIt export.

Reviewed By: yfeldblum

Differential Revision: D124075105

fbshipit-source-id: 4279b1bf9fe58165fcca44333ef3ac3250d16bcc
2026-10-12 15:25:58 -07:00
2024-02-06 09:09:28 -08:00
2019-08-29 23:20:47 -07:00
2017-08-17 13:10:21 -07:00
2022-01-18 16:28:39 -08:00

Proxygen: Facebook's C++ HTTP Libraries

Linux Build Status macOS Build Status

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

Explain Like I’m 5: Proxygen

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 proxygen and its dependencies.

Easy Install

Just run ./build.sh from the proxygen/ directory to get and build all the dependencies and proxygen. You can run the tests manually with cd _build/ && make test. Then run ./install.sh to install it. You can remove the temporary build directory (_build) and ./build.sh && ./install.sh to rebase the dependencies, and then rebuild and reinstall proxygen.

Package Managers

You can download and install proxygen using the vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install proxygen

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 folly are all Autotools based projects.

Introduction

Directory structure and contents:

Directory Purpose
proxygen/external/ Contains non-installed 3rd-party code proxygen depends on.
proxygen/lib/ Core networking abstractions.
proxygen/lib/http/ HTTP specific code. (including HTTP/2 and HTTP/3)
proxygen/lib/services/ Connection management and server code.
proxygen/lib/utils/ Miscellaneous helper code.
proxygen/httpserver/ Contains code wrapping proxygen/lib/ for building simple C++ http servers. We recommend building on top of these APIs.

Architecture

The central abstractions to understand in proxygen/lib are 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 HTTPCodec stored inside HTTPSession parses these into higher-level objects and associates with it a transaction identifier. The codec then calls into HTTPSession which is responsible for maintaining the mapping between transaction identifier and HTTPTransaction objects. Each HTTP request/response pair has a separate HTTPTransaction object. Finally, HTTPTransaction forwards the call to a handler object which implements HTTPTransaction:: 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. HTTPSession is specialized slightly differently depending on whether you are using the connection to issue or respond to HTTP requests.

Core Proxygen Architecture

Moving into higher levels of abstraction, proxygen/HTTP server has a simpler set of APIs and is the recommended way to interface with proxygen when acting as a server if you don't need the full control of the lower level abstractions.

The basic components here are HTTPServer, RequestHandlerFactory, and RequestHandler. An HTTPServer takes some configuration and is given a RequestHandlerFactory. Once the server is started, the installed RequestHandlerFactory spawns a RequestHandler for each HTTP request. RequestHandler is a simple interface users of the library implement. Subclasses of RequestHandler should use the inherited protected member ResponseHandler* downstream_ to send the response.

Using it

Proxygen is a library. After installing it, you can build your C++ server. Try cd ing to the directory containing the echo server at proxygen/httpserver/samples/echo/.

After building proxygen you can start the echo server with _build/proxygen/httpserver/proxygen_echo and verify it works using curl in a different terminal:

$ curl -v http://localhost:11000/
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 11000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:11000
> Accept: */*
>
< HTTP/1.1 200 OK
< Request-Number: 1
< Date: Thu, 30 Oct 2014 17:07:36 GMT
< Connection: keep-alive
< Content-Length: 0
<
* Connection #0 to host localhost left intact

You can find other samples:

  • a simple server that supports HTTP/2 server push (_build/proxygen/httpserver/proxygen_push),
  • a simple server for static files (_build/proxygen/httpserver/proxygen_static)
  • a simple fwdproxy (_build/proxygen/httpserver/proxygen_proxy)
  • a curl-like client (_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:

_build/proxygen/httpserver/hq --mode=server
_build/proxygen/httpserver/hq --mode=client --path=/

The utility supports the qlog logging format; just start the server with the --qlogger_path option 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 Doxyfile from the project root. You'll want to look at html/namespaceproxygen.html to start. This will also generate folly documentation.

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.

Description
Коллекция HTTP-библиотек C++, включая простой в использовании HTTP-сервер
Readme BSD-3-Clause 47 MiB
Languages
C++ 89.6%
Python 6.2%
CMake 3.3%
Shell 0.5%
JavaScript 0.2%