hypp & hypr

2018–2023
HTTP client libraries

Reading RFCs is a secret1 hobby of mine. So when I decided to learn HTTP the hard way, I devoured RFC 7230 and RFC 7231 as well as other relevant specification documents and recent updates from the HTTP Working Group.

The first product of this endeavor was hypp, a client-oriented C++ library that can parse and generate HTTP messages and URIs. It aims to conform to the syntax and semantics of HTTP/1.1, with a few exceptions. All things aside, writing a URI parser has taught me how complicated they can be.

// Parsing an HTTTP response with hypp
const auto expected = hypp::parse_response(response);
const auto& r = expected.value();
std::println(r.start_line.code);  // 200

Want to actually send HTTP messages? hypr builds upon hypp to provide an “HTTP for humans” interface to C++. It uses libcurl under the hood for transferring data.

// Making an HTTP request with hypr
const auto r = hypr::get("https://example.com");
std::println(r.status_code());  // 200

Footnotes

  1. Now that you know…