{"id":13449450,"url":"https://github.com/facebook/proxygen","last_synced_at":"2025-05-13T20:03:05.677Z","repository":{"id":21458286,"uuid":"24776728","full_name":"facebook/proxygen","owner":"facebook","description":"A collection of C++ HTTP libraries including an easy to use HTTP server.","archived":false,"fork":false,"pushed_at":"2025-05-06T16:38:41.000Z","size":25722,"stargazers_count":8231,"open_issues_count":22,"forks_count":1515,"subscribers_count":478,"default_branch":"main","last_synced_at":"2025-05-06T19:52:03.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-10-03T23:18:42.000Z","updated_at":"2025-05-06T16:38:46.000Z","dependencies_parsed_at":"2023-09-21T17:38:57.760Z","dependency_job_id":"2f16a65a-7f31-46d7-80b8-15ff002188cd","html_url":"https://github.com/facebook/proxygen","commit_stats":{"total_commits":13271,"total_committers":572,"mean_commits":23.20104895104895,"dds":0.4356868359581041,"last_synced_commit":"47e9469379d4cf31b495db1b2d01735a31b8537b"},"previous_names":[],"tags_count":436,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fproxygen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fproxygen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fproxygen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fproxygen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/proxygen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020471,"owners_count":22000749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T06:00:39.198Z","updated_at":"2025-05-13T20:03:05.624Z","avatar_url":"https://github.com/facebook.png","language":"C++","readme":"## Proxygen: Facebook's C++ HTTP Libraries\n\n[![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat\u0026labelColor=005BBB)](https://opensource.facebook.com/support-ukraine)\n[![Linux Build Status](https://github.com/facebook/proxygen/actions/workflows/getdeps_linux.yml/badge.svg)](https://github.com/facebook/proxygen/actions/workflows/getdeps_linux.yml)\n[![macOS Build Status](https://github.com/facebook/proxygen/actions/workflows/getdeps_mac.yml/badge.svg)](https://github.com/facebook/proxygen/actions/workflows/getdeps_mac.yml)\n\nThis project comprises the core C++ HTTP abstractions used at\nFacebook. Internally, it is used as the basis for building many HTTP\nservers, proxies, and clients. This release focuses on the common HTTP\nabstractions and our simple HTTPServer framework. Future releases will\nprovide simple client APIs as well. The framework supports HTTP/1.1,\nSPDY/3, SPDY/3.1, HTTP/2, and HTTP/3. The goal is to provide a simple,\nperformant, and modern C++ HTTP library.\n\nWe have a Google group for general discussions at https://groups.google.com/d/forum/facebook-proxygen.\n\nThe [original blog post](https://engineering.fb.com/production-engineering/introducing-proxygen-facebook-s-c-http-framework/)\nalso has more background on the project.\n\n## Learn More in This Intro Video\n[![Explain Like I’m 5: Proxygen](https://img.youtube.com/vi/OsrBYHIYCYk/0.jpg)](https://www.youtube.com/watch?v=OsrBYHIYCYk)\n\n### Installing\n\nNote that currently this project has been tested on Ubuntu 18.04 and Mac OSX\nalthough it likely works on many other platforms.\n\nYou will need at least 3 GiB of memory to compile `proxygen` and its\ndependencies.\n\n##### Easy Install\n\nJust run `./build.sh` from the `proxygen/` directory to get and build all\nthe dependencies and `proxygen`. You can run the tests manually with `cd _build/ \u0026\u0026 make test`.\nThen run `./install.sh` to install it. You can remove the temporary build directory (`_build`) and `./build.sh \u0026\u0026 ./install.sh`\nto rebase the dependencies, and then rebuild and reinstall `proxygen`.\n\n##### Package Managers\n\nYou can download and install proxygen using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:\n\n    git clone https://github.com/Microsoft/vcpkg.git\n    cd vcpkg\n    ./bootstrap-vcpkg.sh\n    ./vcpkg integrate install\n    ./vcpkg install proxygen\n\nThe 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](https://github.com/Microsoft/vcpkg) on the vcpkg repository.\n\n##### Other Platforms\n\nIf you are running on another platform, you may need to install several\npackages first. Proxygen and `folly` are all Autotools based projects.\n\n### Introduction\n\nDirectory structure and contents:\n\n| Directory                  | Purpose                                                                       |\n|----------------------------|-------------------------------------------------------------------------------|\n| `proxygen/external/`       | Contains non-installed 3rd-party code proxygen depends on.                    |\n| `proxygen/lib/`            | Core networking abstractions.                                                 |\n| `proxygen/lib/http/`       | HTTP specific code. (including HTTP/2 and HTTP/3)                             |\n| `proxygen/lib/services/`   | Connection management and server code.                                        |\n| `proxygen/lib/utils/`      | Miscellaneous helper code.                                                    |\n| `proxygen/httpserver/`     | Contains code wrapping `proxygen/lib/` for building simple C++ http servers. We recommend building on top of these APIs. |\n\n### Architecture\n\nThe central abstractions to understand in `proxygen/lib` are the session, codec,\ntransaction, and handler. These are the lowest level abstractions, and we\ndon't generally recommend building off of these directly.\n\nWhen bytes are read off the wire, the `HTTPCodec` stored inside\n`HTTPSession` parses these into higher-level objects and associates with\nit a transaction identifier. The codec then calls into `HTTPSession` which\nis responsible for maintaining the mapping between transaction identifier\nand `HTTPTransaction` objects. Each HTTP request/response pair has a\nseparate `HTTPTransaction` object. Finally, `HTTPTransaction` forwards the\ncall to a handler object which implements `HTTPTransaction:: Handler`. The\nhandler is responsible for implementing business logic for the request or\nresponse.\n\nThe handler then calls back into the transaction to generate egress\n(whether the egress is a request or response). The call flows from the\ntransaction back to the session, which uses the codec to convert the\nhigher-level semantics of the particular call into the appropriate bytes\nto send on the wire.\n\nThe same handler and transaction interfaces are used to both create requests\nand handle responses. The API is generic enough to allow\nboth. `HTTPSession` is specialized slightly differently depending on\nwhether you are using the connection to issue or respond to HTTP\nrequests.\n\n![Core Proxygen Architecture](CoreProxygenArchitecture.png)\n\nMoving into higher levels of abstraction, `proxygen/HTTP server` has a\nsimpler set of APIs and is the recommended way to interface with `proxygen`\nwhen acting as a server if you don't need the full control of the lower\nlevel abstractions.\n\nThe basic components here are `HTTPServer`, `RequestHandlerFactory`, and\n`RequestHandler`. An `HTTPServer` takes some configuration and is given a\n`RequestHandlerFactory`. Once the server is started, the installed\n`RequestHandlerFactory` spawns a `RequestHandler` for each HTTP\nrequest. `RequestHandler` is a simple interface users of the library\nimplement. Subclasses of `RequestHandler` should use the inherited\nprotected member `ResponseHandler* downstream_` to send the response.\n\n### Using it\n\nProxygen is a library. After installing it, you can build your C++\nserver. Try `cd` ing to the directory containing the echo server at\n`proxygen/httpserver/samples/echo/`.\n\nAfter building proxygen you can start the echo server with `_build/proxygen/httpserver/proxygen_echo`\nand verify it works using curl in a different terminal:\n```shell\n$ curl -v http://localhost:11000/\n*   Trying 127.0.0.1...\n* Connected to localhost (127.0.0.1) port 11000 (#0)\n\u003e GET / HTTP/1.1\n\u003e User-Agent: curl/7.35.0\n\u003e Host: localhost:11000\n\u003e Accept: */*\n\u003e\n\u003c HTTP/1.1 200 OK\n\u003c Request-Number: 1\n\u003c Date: Thu, 30 Oct 2014 17:07:36 GMT\n\u003c Connection: keep-alive\n\u003c Content-Length: 0\n\u003c\n* Connection #0 to host localhost left intact\n```\n\nYou can find other samples:\n  * a simple server that supports HTTP/2 server push (`_build/proxygen/httpserver/proxygen_push`),\n  * a simple server for static files (`_build/proxygen/httpserver/proxygen_static`)\n  * a simple fwdproxy (`_build/proxygen/httpserver/proxygen_proxy`)\n  * a curl-like client (`_build/proxygen/httpclient/samples/curl/proxygen_curl`)\n\n### QUIC and HTTP/3\n\nProxygen supports HTTP/3!\n\nIt depends on Facebook's [mvfst](https://github.com/facebook/mvfst)\nlibrary for the [IETF QUIC](https://github.com/quicwg/base-drafts) transport\nimplementation.\n\nThis comes with a handy command-line utility that can be used as an HTTP/3\nserver and client.\n\nSample usage:\n```shell\n_build/proxygen/httpserver/hq --mode=server\n_build/proxygen/httpserver/hq --mode=client --path=/\n```\nThe utility supports the [qlog](https://github.com/quiclog/internet-drafts)\nlogging format; just start the server with the `--qlogger_path` option and many\nknobs to tune both the quic transport and the http layer.\n\n### Documentation\n\nWe use Doxygen for Proxygen's internal documentation. You can generate a\ncopy of these docs by running `doxygen Doxyfile` from the project\nroot. You'll want to look at `html/namespaceproxygen.html` to start. This\nwill also generate `folly` documentation.\n\n### License\nSee [LICENSE](LICENSE).\n\n### Contributing\nContributions to Proxygen are more than welcome. [Read the guidelines in CONTRIBUTING.md](CONTRIBUTING.md).\nMake sure you've [signed the CLA](https://code.facebook.com/cla) before sending in a pull request.\n\n### Whitehat\n\nFacebook has a [bounty program](https://www.facebook.com/whitehat/) for\nthe safe disclosure of security bugs. If you find a vulnerability, please\ngo through the process outlined on that page and do not file a public issue.\n","funding_links":[],"categories":["Networking","C++","RPC Frameworks","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","HarmonyOS","内存分配","Programming Languages","Implementations"],"sub_categories":["Windows Manager","网络","C++"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fproxygen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2Fproxygen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fproxygen/lists"}