| 3404 | } |
| 3405 | |
| 3406 | inline 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 | |
| 3429 | inline bool nocompressor::compress(const char *data, size_t data_length, |
| 3430 | bool /*last*/, Callback callback) { |
no test coverage detected