Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
Compress.hpp File Reference
#include <orbit/legacy_namespaces.hpp>
#include <orbit/routing/Router.hpp>
#include <string_view>
#include <vector>
Include dependency graph for Compress.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  orbit::middleware::CompressOptions
 Options for compress(). More...
 

Namespaces

namespace  orbit
 
namespace  orbit::middleware
 

Enumerations

enum class  orbit::middleware::ContentCoding { orbit::middleware::Identity , orbit::middleware::Gzip , orbit::middleware::Brotli , orbit::middleware::Zstd }
 A response content coding (RFC 9110 section 8.4.1). More...
 

Functions

routing::Middleware orbit::middleware::compress (CompressOptions options={})
 Returns a middleware that compresses response bodies with brotli, zstd or gzip, whichever the client accepts and the server prefers.
 
ContentCoding orbit::middleware::negotiate_coding (std::string_view accept_encoding, const std::vector< ContentCoding > &preference, bool only_available=true)
 Chooses the coding for a response.
 
bool orbit::middleware::coding_available (ContentCoding coding)
 True if this build can produce coding.
 
std::string_view orbit::middleware::coding_name (ContentCoding coding)
 The Content-Encoding token for coding ("gzip", "br", "zstd"; "" for identity).
 
bool orbit::middleware::compress_body (ContentCoding coding, const std::string &in, std::string &out, const CompressOptions &options={})
 Compresses in with coding at the levels in options.
 
bool orbit::middleware::accepts_gzip (std::string_view accept_encoding)
 Whether an Accept-Encoding header value allows gzip.