MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / encoding_type

Function encoding_type

examples/server/httplib.h:3406–3427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3404}
3405
3406inline EncodingType encoding_type(const Request &req, const Response &res) {
3407 auto ret =
3408 detail::can_compress_content_type(res.get_header_value("Content-Type"));
3409 if (!ret) { return EncodingType::None; }
3410
3411 const auto &s = req.get_header_value("Accept-Encoding");
3412 (void)(s);
3413
3414#ifdef CPPHTTPLIB_BROTLI_SUPPORT
3415 // TODO: 'Accept-Encoding' has br, not br;q=0
3416 ret = s.find("br") != std::string::npos;
3417 if (ret) { return EncodingType::Brotli; }
3418#endif
3419
3420#ifdef CPPHTTPLIB_ZLIB_SUPPORT
3421 // TODO: 'Accept-Encoding' has gzip, not gzip;q=0
3422 ret = s.find("gzip") != std::string::npos;
3423 if (ret) { return EncodingType::Gzip; }
3424#endif
3425
3426 return EncodingType::None;
3427}
3428
3429inline bool nocompressor::compress(const char *data, size_t data_length,
3430 bool /*last*/, Callback callback) {

Callers 2

apply_rangesMethod · 0.85

Calls 2

get_header_valueMethod · 0.80

Tested by

no test coverage detected