#include <charconv>
#include <cstring>
#include <string>
#include <boost/beast.hpp>
#include <ctre.hpp>
#include <flatmap.hpp>
#include "libdeflate.hpp"
Go to the source code of this file.
|
| template<class Allocator > |
| bool | handle_compression (const boost::beast::http::basic_fields< Allocator > &in_head, boost::beast::http::basic_fields< Allocator > &out_head, std::string &body) |
| |
Available compression algorithms
| Enumerator |
|---|
| deflate |
|
| gzip |
|
| identity |
|
template<class Allocator >
| bool handle_compression |
( |
const boost::beast::http::basic_fields< Allocator > & |
in_head, |
|
|
boost::beast::http::basic_fields< Allocator > & |
out_head, |
|
|
std::string & |
body |
|
) |
| |
Perform the appropriate compression on the response body
- Template Parameters
-
- Parameters
-
| [in] | in_head | request header fields |
| [in] | out_head | response header fields |
| [in,out] | body | response body |
- Returns
true on success, false on failure
TODO check if the content-type looks like it could be compressed TODO check if the body is large enough to have any advantage compressing it
| constexpr ctll::fixed_string weigthed_encodings_pattern = R"(([a-z]+|\*)(?:;q=([0-1].?(?:[\d]+)?)?)?(?:,\s*)?)" |
|
static |
Regex pattern for parsing boost::beast::http::field::accept_encoding's value