| 3852 | } |
| 3853 | |
| 3854 | inline 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 | |
| 3877 | inline bool nocompressor::compress(const char *data, size_t data_length, |
| 3878 | bool /*last*/, Callback callback) { |
no test coverage detected