MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / encoding_type

Function encoding_type

external/httplib.h:3854–3875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3852}
3853
3854inline EncodingType encoding_type(const Request &req, const Response &res) {
3855 auto ret =
3856 detail::can_compress_content_type(res.get_header_value("Content-Type"));
3857 if (!ret) { return EncodingType::None; }
3858
3859 const auto &s = req.get_header_value("Accept-Encoding");
3860 (void)(s);
3861
3862#ifdef CPPHTTPLIB_BROTLI_SUPPORT
3863 // TODO: 'Accept-Encoding' has br, not br;q=0
3864 ret = s.find("br") != std::string::npos;
3865 if (ret) { return EncodingType::Brotli; }
3866#endif
3867
3868#ifdef CPPHTTPLIB_ZLIB_SUPPORT
3869 // TODO: 'Accept-Encoding' has gzip, not gzip;q=0
3870 ret = s.find("gzip") != std::string::npos;
3871 if (ret) { return EncodingType::Gzip; }
3872#endif
3873
3874 return EncodingType::None;
3875}
3876
3877inline bool nocompressor::compress(const char *data, size_t data_length,
3878 bool /*last*/, Callback callback) {

Callers 2

apply_rangesMethod · 0.85

Calls 3

get_header_valueMethod · 0.80
findMethod · 0.80

Tested by

no test coverage detected