_ZN7httplib6detail17gzip_decompressorD2Ev:
 7668|    139|inline gzip_decompressor::~gzip_decompressor() { inflateEnd(&strm_); }
_ZN7httplib10ClientImplD2Ev:
14538|  3.10k|inline ClientImpl::~ClientImpl() {
14539|       |  // Wait until all the requests in flight are handled.
14540|  3.10k|  size_t retry_count = 10;
14541|  3.10k|  while (retry_count-- > 0) {
  ------------------
  |  Branch (14541:10): [True: 3.10k, False: 0]
  ------------------
14542|  3.10k|    {
14543|  3.10k|      std::lock_guard<std::mutex> guard(socket_mutex_);
14544|  3.10k|      if (socket_requests_in_flight_ == 0) { break; }
  ------------------
  |  Branch (14544:11): [True: 3.10k, False: 0]
  ------------------
14545|  3.10k|    }
14546|      0|    std::this_thread::sleep_for(std::chrono::milliseconds{1});
14547|      0|  }
14548|       |
14549|  3.10k|  std::lock_guard<std::mutex> guard(socket_mutex_);
14550|  3.10k|  shutdown_socket(socket_);
14551|  3.10k|  close_socket(socket_);
14552|  3.10k|}
_ZN7httplib6detail12decompressorD2Ev:
 3707|    139|  virtual ~decompressor() = default;
_ZN7httplib6StreamD2Ev:
 1877|  6.21k|  virtual ~Stream() = default;
_ZNK7httplib10ClientImpl15shutdown_socketERNS0_6SocketE:
14667|  3.10k|inline void ClientImpl::shutdown_socket(Socket &socket) const {
14668|  3.10k|  if (socket.sock == INVALID_SOCKET) { return; }
  ------------------
  |  |  322|  3.10k|#define INVALID_SOCKET (-1)
  ------------------
  |  Branch (14668:7): [True: 3.10k, False: 0]
  ------------------
14669|      0|  detail::shutdown_socket(socket.sock);
14670|      0|}
_ZN7httplib10ClientImpl12close_socketERNS0_6SocketE:
14672|  3.10k|inline void ClientImpl::close_socket(Socket &socket) {
14673|       |  // If there are requests in flight in another thread, usually closing
14674|       |  // the socket will be fine and they will simply receive an error when
14675|       |  // using the closed socket, but it is still a bug since rarely the OS
14676|       |  // may reassign the socket id to be used for a new socket, and then
14677|       |  // suddenly they will be operating on a live socket that is different
14678|       |  // than the one they intended!
14679|  3.10k|  assert(socket_requests_in_flight_ == 0 ||
  ------------------
  |  Branch (14679:3): [True: 3.10k, False: 0]
  |  Branch (14679:3): [True: 0, False: 0]
  |  Branch (14679:3): [True: 3.10k, False: 0]
  ------------------
14680|  3.10k|         socket_requests_are_from_thread_ == std::this_thread::get_id());
14681|       |
14682|       |  // It is also a bug if this happens while SSL is still active
14683|       |#ifdef CPPHTTPLIB_SSL_ENABLED
14684|       |  assert(socket.ssl == nullptr);
14685|       |#endif
14686|       |
14687|  3.10k|  if (socket.sock == INVALID_SOCKET) { return; }
  ------------------
  |  |  322|  3.10k|#define INVALID_SOCKET (-1)
  ------------------
  |  Branch (14687:7): [True: 3.10k, False: 0]
  ------------------
14688|      0|  detail::close_socket(socket.sock);
14689|      0|  socket.sock = INVALID_SOCKET;
  ------------------
  |  |  322|      0|#define INVALID_SOCKET (-1)
  ------------------
14690|      0|}
_ZN7httplib10ClientImplC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi:
14530|  3.10k|    : ClientImpl(host, port, std::string(), std::string()) {}
_ZN7httplib10ClientImplC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEiS9_S9_:
14535|  3.10k|    : host_(detail::escape_abstract_namespace_unix_domain(host)), port_(port),
14536|  3.10k|      client_cert_path_(client_cert_path), client_key_path_(client_key_path) {}
_ZN7httplib6detail37escape_abstract_namespace_unix_domainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6551|  3.10k|inline std::string escape_abstract_namespace_unix_domain(const std::string &s) {
 6552|  3.10k|  if (s.size() > 1 && s[0] == '\0') {
  ------------------
  |  Branch (6552:7): [True: 3.10k, False: 0]
  |  Branch (6552:23): [True: 0, False: 3.10k]
  ------------------
 6553|      0|    auto ret = s;
 6554|      0|    ret[0] = '@';
 6555|      0|    return ret;
 6556|      0|  }
 6557|  3.10k|  return s;
 6558|  3.10k|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEC2Ev:
 1132|  15.5k|  insertion_ordered_multimap() = default;
_ZN7httplib6detail13write_headersERNS_6StreamERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEE:
 8433|  3.10k|inline ssize_t write_headers(Stream &strm, const Headers &headers) {
 8434|  3.10k|  ssize_t write_len = 0;
 8435|  14.2k|  for (const auto &x : headers) {
  ------------------
  |  Branch (8435:22): [True: 14.2k, False: 3.10k]
  ------------------
 8436|       |    // Skip fields with invalid names or values to prevent response splitting
 8437|       |    // via CR/LF injection, matching set_header(). The client validates request
 8438|       |    // headers up front in check_and_write_headers, but the server passes
 8439|       |    // res.headers straight to this writer, and res.headers is a public field
 8440|       |    // an application can populate directly with request-derived values.
 8441|  14.2k|    if (!fields::is_field_valid(x.first, x.second)) { continue; }
  ------------------
  |  Branch (8441:9): [True: 0, False: 14.2k]
  ------------------
 8442|       |
 8443|  14.2k|    std::string s;
 8444|  14.2k|    s = x.first;
 8445|  14.2k|    s += ": ";
 8446|  14.2k|    s += x.second;
 8447|  14.2k|    s += "\r\n";
 8448|       |
 8449|  14.2k|    auto len = strm.write(s.data(), s.size());
 8450|  14.2k|    if (len < 0) { return len; }
  ------------------
  |  Branch (8450:9): [True: 0, False: 14.2k]
  ------------------
 8451|  14.2k|    write_len += len;
 8452|  14.2k|  }
 8453|  3.10k|  auto len = strm.write("\r\n");
 8454|  3.10k|  if (len < 0) { return len; }
  ------------------
  |  Branch (8454:7): [True: 0, False: 3.10k]
  ------------------
 8455|  3.10k|  write_len += len;
 8456|  3.10k|  return write_len;
 8457|  3.10k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE5beginEv:
 1141|  3.10k|  const_iterator begin() const { return make_citer(0, npos()); }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10make_citerEmm:
 1274|  64.9k|  const_iterator make_citer(size_type idx, size_type key_idx) const {
 1275|  64.9k|    return const_iterator(entries_.data(), idx, entries_.size(), key_idx);
 1276|  64.9k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEC2EPSF_mmm:
 1116|  64.9k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE4nposEv:
 1035|   192k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE3endEv:
 1142|  58.4k|  const_iterator end() const { return make_citer(entries_.size(), npos()); }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEneISF_EEbRKNSC_IT_EE:
 1107|  48.4k|    template <typename U> bool operator!=(const iterator_t<U> &rhs) const {
 1108|  48.4k|      return idx_ != rhs.idx_;
 1109|  48.4k|    }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEdeEv:
 1063|  14.2k|    reference operator*() const { return data_[idx_]; }
_ZN7httplib6detail6fields14is_field_validERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
10057|  36.6k|inline bool is_field_valid(const std::string &name, const std::string &value) {
10058|  36.6k|  return is_field_name(name) && is_field_value(value);
  ------------------
  |  Branch (10058:10): [True: 36.6k, False: 0]
  |  Branch (10058:33): [True: 36.6k, False: 0]
  ------------------
10059|  36.6k|}
_ZN7httplib6detail6fields13is_field_nameERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10022|  50.9k|inline bool is_field_name(const std::string &s) { return is_token(s); }
_ZN7httplib6detail6fields8is_tokenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10014|  50.9k|inline bool is_token(const std::string &s) {
10015|  50.9k|  if (s.empty()) { return false; }
  ------------------
  |  Branch (10015:7): [True: 65, False: 50.9k]
  ------------------
10016|   525k|  for (auto c : s) {
  ------------------
  |  Branch (10016:15): [True: 525k, False: 50.7k]
  ------------------
10017|   525k|    if (!is_token_char(c)) { return false; }
  ------------------
  |  Branch (10017:9): [True: 137, False: 525k]
  ------------------
10018|   525k|  }
10019|  50.7k|  return true;
10020|  50.9k|}
_ZN7httplib6detail6fields13is_token_charEc:
10008|   525k|inline bool is_token_char(char c) {
10009|   525k|  return is_ascii_alnum(c) || c == '!' || c == '#' || c == '$' || c == '%' ||
  ------------------
  |  Branch (10009:10): [True: 478k, False: 47.4k]
  |  Branch (10009:31): [True: 598, False: 46.8k]
  |  Branch (10009:43): [True: 2.98k, False: 43.8k]
  |  Branch (10009:55): [True: 1.96k, False: 41.8k]
  |  Branch (10009:67): [True: 321, False: 41.5k]
  ------------------
10010|  41.5k|         c == '&' || c == '\'' || c == '*' || c == '+' || c == '-' ||
  ------------------
  |  Branch (10010:10): [True: 828, False: 40.7k]
  |  Branch (10010:22): [True: 679, False: 40.0k]
  |  Branch (10010:35): [True: 2.30k, False: 37.7k]
  |  Branch (10010:47): [True: 345, False: 37.4k]
  |  Branch (10010:59): [True: 30.9k, False: 6.50k]
  ------------------
10011|  6.50k|         c == '.' || c == '^' || c == '_' || c == '`' || c == '|' || c == '~';
  ------------------
  |  Branch (10011:10): [True: 471, False: 6.03k]
  |  Branch (10011:22): [True: 1.86k, False: 4.17k]
  |  Branch (10011:34): [True: 2.27k, False: 1.89k]
  |  Branch (10011:46): [True: 537, False: 1.35k]
  |  Branch (10011:58): [True: 444, False: 912]
  |  Branch (10011:70): [True: 775, False: 137]
  ------------------
10012|   525k|}
_ZN7httplib6detail14is_ascii_alnumEc:
  590|   525k|inline bool is_ascii_alnum(char c) {
  591|   525k|  return is_ascii_digit(c) || is_ascii_alpha(c);
  ------------------
  |  Branch (591:10): [True: 8.90k, False: 516k]
  |  Branch (591:31): [True: 469k, False: 47.4k]
  ------------------
  592|   525k|}
_ZN7httplib6detail14is_ascii_digitEc:
  584|   569k|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (584:45): [True: 523k, False: 45.3k]
  |  Branch (584:57): [True: 44.6k, False: 479k]
  ------------------
_ZN7httplib6detail14is_ascii_alphaEc:
  586|   516k|inline bool is_ascii_alpha(char c) {
  587|   516k|  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
  ------------------
  |  Branch (587:11): [True: 370k, False: 146k]
  |  Branch (587:23): [True: 369k, False: 1.22k]
  |  Branch (587:37): [True: 105k, False: 41.5k]
  |  Branch (587:49): [True: 99.9k, False: 5.90k]
  ------------------
  588|   516k|}
_ZN7httplib6detail6fields14is_field_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10055|  53.7k|inline bool is_field_value(const std::string &s) { return is_field_content(s); }
_ZN7httplib6detail6fields16is_field_contentERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10030|  53.7k|inline bool is_field_content(const std::string &s) {
10031|  53.7k|  if (s.empty()) { return true; }
  ------------------
  |  Branch (10031:7): [True: 8.21k, False: 45.4k]
  ------------------
10032|       |
10033|  45.4k|  if (s.size() == 1) {
  ------------------
  |  Branch (10033:7): [True: 9.60k, False: 35.8k]
  ------------------
10034|  9.60k|    return is_field_vchar(s[0]);
10035|  35.8k|  } else if (s.size() == 2) {
  ------------------
  |  Branch (10035:14): [True: 385, False: 35.5k]
  ------------------
10036|    385|    return is_field_vchar(s[0]) && is_field_vchar(s[1]);
  ------------------
  |  Branch (10036:12): [True: 384, False: 1]
  |  Branch (10036:36): [True: 383, False: 1]
  ------------------
10037|  35.5k|  } else {
10038|  35.5k|    size_t i = 0;
10039|       |
10040|  35.5k|    if (!is_field_vchar(s[i])) { return false; }
  ------------------
  |  Branch (10040:9): [True: 4, False: 35.5k]
  ------------------
10041|  35.5k|    i++;
10042|       |
10043|  2.21M|    while (i < s.size() - 1) {
  ------------------
  |  Branch (10043:12): [True: 2.17M, False: 35.4k]
  ------------------
10044|  2.17M|      auto c = s[i++];
10045|  2.17M|      if (c == ' ' || c == '\t' || is_field_vchar(c)) {
  ------------------
  |  Branch (10045:11): [True: 24.5k, False: 2.15M]
  |  Branch (10045:23): [True: 1.03k, False: 2.15M]
  |  Branch (10045:36): [True: 2.15M, False: 27]
  ------------------
10046|  2.17M|      } else {
10047|     27|        return false;
10048|     27|      }
10049|  2.17M|    }
10050|       |
10051|  35.4k|    return is_field_vchar(s[i]);
10052|  35.5k|  }
10053|  45.4k|}
_ZN7httplib6detail6fields14is_field_vcharEc:
10028|  2.23M|inline bool is_field_vchar(char c) { return is_vchar(c) || is_obs_text(c); }
  ------------------
  |  Branch (10028:45): [True: 1.37M, False: 860k]
  |  Branch (10028:60): [True: 860k, False: 60]
  ------------------
_ZN7httplib6detail6fields8is_vcharEc:
10024|  2.23M|inline bool is_vchar(char c) { return c >= 33 && c <= 126; }
  ------------------
  |  Branch (10024:39): [True: 1.37M, False: 860k]
  |  Branch (10024:50): [True: 1.37M, False: 4]
  ------------------
_ZN7httplib6detail6fields11is_obs_textEc:
10026|   860k|inline bool is_obs_text(char c) { return 128 <= static_cast<unsigned char>(c); }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEppEv:
 1066|  16.7k|    iterator_t &operator++() {
 1067|       |      // Saturating, so that advancing past the last entry of a key (which
 1068|       |      // get_multimap_value() does when asked for an out-of-range id) stays at
 1069|       |      // end() instead of running off the container.
 1070|  16.7k|      if (idx_ >= size_) { return *this; }
  ------------------
  |  Branch (1070:11): [True: 0, False: 16.7k]
  ------------------
 1071|  16.7k|      ++idx_;
 1072|  16.7k|      if (key_idx_ != npos()) {
  ------------------
  |  Branch (1072:11): [True: 2.52k, False: 14.2k]
  ------------------
 1073|  2.92k|        while (idx_ < size_ && !matches(idx_)) {
  ------------------
  |  Branch (1073:16): [True: 1.79k, False: 1.13k]
  |  Branch (1073:32): [True: 403, False: 1.38k]
  ------------------
 1074|    403|          ++idx_;
 1075|    403|        }
 1076|  2.52k|      }
 1077|  16.7k|      return *this;
 1078|  16.7k|    }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEE7matchesEm:
 1118|  1.79k|    bool matches(size_type i) const {
 1119|  1.79k|      return keys_equal(data_[i].first, data_[key_idx_].first);
 1120|  1.79k|    }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10keys_equalERKS8_SD_:
 1037|  51.3k|  static bool keys_equal(const std::string &a, const std::string &b) {
 1038|  51.3k|    return KeyEqual()(a, b);
 1039|  51.3k|  }
_ZNK7httplib6detail11case_ignore8equal_toclERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_:
  636|  51.3k|  bool operator()(const std::string &a, const std::string &b) const {
  637|  51.3k|    return equal(a, b);
  638|  51.3k|  }
_ZN7httplib6detail11case_ignore5equalERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  628|  52.8k|inline bool equal(const std::string &a, const std::string &b) {
  629|  52.8k|  return a.size() == b.size() &&
  ------------------
  |  Branch (629:10): [True: 10.0k, False: 42.8k]
  ------------------
  630|  10.0k|         std::equal(a.begin(), a.end(), b.begin(), [](char ca, char cb) {
  ------------------
  |  Branch (630:10): [True: 7.28k, False: 2.73k]
  ------------------
  631|  10.0k|           return to_lower(ca) == to_lower(cb);
  632|  10.0k|         });
  633|  52.8k|}
_ZZN7httplib6detail11case_ignore5equalERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_ENKUlccE_clEcc:
  630|   119k|         std::equal(a.begin(), a.end(), b.begin(), [](char ca, char cb) {
  631|   119k|           return to_lower(ca) == to_lower(cb);
  632|   119k|         });
_ZN7httplib6detail11case_ignore8to_lowerEi:
  596|   239k|inline unsigned char to_lower(int c) {
  597|   239k|  const static unsigned char table[256] = {
  598|   239k|      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  599|   239k|      15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  600|   239k|      30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  601|   239k|      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  602|   239k|      60,  61,  62,  63,  64,  97,  98,  99,  100, 101, 102, 103, 104, 105, 106,
  603|   239k|      107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  604|   239k|      122, 91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  605|   239k|      105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  606|   239k|      120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  607|   239k|      135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  608|   239k|      150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  609|   239k|      165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  610|   239k|      180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 224, 225, 226,
  611|   239k|      227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
  612|   239k|      242, 243, 244, 245, 246, 215, 248, 249, 250, 251, 252, 253, 254, 223, 224,
  613|   239k|      225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  614|   239k|      240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  615|   239k|      255,
  616|   239k|  };
  617|   239k|  return table[(unsigned char)(char)c];
  618|   239k|}
_ZN7httplib6Stream5writeEPKc:
11602|  3.10k|inline ssize_t Stream::write(const char *ptr) {
11603|  3.10k|  return write(ptr, strlen(ptr));
11604|  3.10k|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1132|  3.10k|  insertion_ordered_multimap() = default;
_ZN7httplib6detail26insertion_ordered_multimapINS_9FormFieldENSt3__18equal_toINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEEC2Ev:
 1132|  3.10k|  insertion_ordered_multimap() = default;
_ZN7httplib6detail26insertion_ordered_multimapINS_8FormDataENSt3__18equal_toINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEEC2Ev:
 1132|  3.10k|  insertion_ordered_multimap() = default;
_ZN7httplib8ResponseC2Ev:
 1800|  3.10k|  Response() = default;
_ZN7httplib8UserDataC2Ev:
 1328|  3.10k|  UserData() = default;
_ZN7httplib10ClientImpl15process_requestERNS_6StreamERNS_7RequestERNS_8ResponseEbRNS_5ErrorE:
15853|  3.10k|                                        Error &error) {
15854|       |  // Auto-add Expect: 100-continue for large bodies
15855|  3.10k|  if (CPPHTTPLIB_EXPECT_100_THRESHOLD > 0 && !req.has_header("Expect")) {
  ------------------
  |  |   82|  3.10k|#define CPPHTTPLIB_EXPECT_100_THRESHOLD 1024
  ------------------
  |  Branch (15855:7): [True: 3.10k, Folded]
  |  Branch (15855:7): [True: 3.10k, False: 0]
  |  Branch (15855:46): [True: 3.10k, False: 0]
  ------------------
15856|  3.10k|    auto body_size = req.body.empty() ? req.content_length_ : req.body.size();
  ------------------
  |  Branch (15856:22): [True: 3.10k, False: 0]
  ------------------
15857|  3.10k|    if (body_size >= CPPHTTPLIB_EXPECT_100_THRESHOLD) {
  ------------------
  |  |   82|  3.10k|#define CPPHTTPLIB_EXPECT_100_THRESHOLD 1024
  ------------------
  |  Branch (15857:9): [True: 0, False: 3.10k]
  ------------------
15858|      0|      req.set_header("Expect", "100-continue");
15859|      0|    }
15860|  3.10k|  }
15861|       |
15862|       |  // Check for Expect: 100-continue
15863|  3.10k|  auto expect_100_continue =
15864|  3.10k|      detail::has_header_token(req.headers, "Expect", "100-continue");
15865|       |
15866|       |  // Send request (skip body if using Expect: 100-continue)
15867|  3.10k|  auto write_request_success =
15868|  3.10k|      write_request(strm, req, close_connection, error, expect_100_continue);
15869|       |
15870|       |#ifdef CPPHTTPLIB_SSL_ENABLED
15871|       |  if (is_ssl() && !expect_100_continue) {
15872|       |    auto is_proxy_enabled = is_proxy_enabled_for_host(host_);
15873|       |    if (!is_proxy_enabled) {
15874|       |      if (tls::is_peer_closed(socket_.ssl, socket_.sock)) {
15875|       |        error = Error::SSLPeerCouldBeClosed_;
15876|       |        output_error_log(error, &req);
15877|       |        return false;
15878|       |      }
15879|       |    }
15880|       |  }
15881|       |#endif
15882|       |
15883|       |  // Handle Expect: 100-continue.
15884|       |  //
15885|       |  // Wait for an interim/early response by attempting to read the status line
15886|       |  // under a short timeout, instead of trusting raw socket readability. Over
15887|       |  // TLS, post-handshake records (e.g. session tickets) make the socket
15888|       |  // readable without any HTTP response being available; relying on
15889|       |  // `select_read` there caused the body to be withheld forever and the
15890|       |  // request to fail with `Read` (#2458). If no status line arrives within the
15891|       |  // timeout, send the body anyway (matching curl's behavior).
15892|  3.10k|  auto status_line_read = false;
15893|  3.10k|  if (expect_100_continue && write_request_success) {
  ------------------
  |  Branch (15893:7): [True: 0, False: 3.10k]
  |  Branch (15893:30): [True: 0, False: 0]
  ------------------
15894|      0|    if (CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND > 0) {
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
  |  Branch (15894:9): [True: 0, Folded]
  ------------------
15895|      0|      time_t sec = CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND / 1000;
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
15896|      0|      time_t usec = (CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND % 1000) * 1000;
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
15897|      0|      strm.set_read_timeout(sec, usec);
15898|      0|      status_line_read = read_response_line(strm, req, res, false);
15899|      0|      strm.set_read_timeout(read_timeout_sec_, read_timeout_usec_);
15900|      0|    }
15901|       |
15902|      0|    if (!status_line_read) {
  ------------------
  |  Branch (15902:9): [True: 0, False: 0]
  ------------------
15903|       |      // No interim response within the timeout: send the body and handle the
15904|       |      // response as usual.
15905|      0|      if (!write_request_body(strm, req, error)) { return false; }
  ------------------
  |  Branch (15905:11): [True: 0, False: 0]
  ------------------
15906|      0|      expect_100_continue = false; // Switch to normal response handling
15907|      0|    }
15908|      0|  }
15909|       |
15910|       |  // Receive response and headers
15911|       |  // When using Expect: 100-continue, don't auto-skip `100 Continue` response
15912|  3.10k|  if ((!status_line_read &&
  ------------------
  |  Branch (15912:8): [True: 3.10k, False: 0]
  ------------------
15913|  3.10k|       !read_response_line(strm, req, res, !expect_100_continue)) ||
  ------------------
  |  Branch (15913:8): [True: 444, False: 2.66k]
  ------------------
15914|  2.66k|      !detail::read_headers(strm, res.headers)) {
  ------------------
  |  Branch (15914:7): [True: 832, False: 1.82k]
  ------------------
15915|  1.27k|    if (write_request_success) { error = Error::Read; }
  ------------------
  |  Branch (15915:9): [True: 1.27k, False: 0]
  ------------------
15916|  1.27k|    output_error_log(error, &req);
15917|  1.27k|    return false;
15918|  1.27k|  }
15919|       |
15920|  1.82k|  if (!write_request_success) { return false; }
  ------------------
  |  Branch (15920:7): [True: 0, False: 1.82k]
  ------------------
15921|       |
15922|       |  // Handle Expect: 100-continue response
15923|  1.82k|  if (expect_100_continue) {
  ------------------
  |  Branch (15923:7): [True: 0, False: 1.82k]
  ------------------
15924|      0|    if (res.status == StatusCode::Continue_100) {
  ------------------
  |  Branch (15924:9): [True: 0, False: 0]
  ------------------
15925|       |      // Server accepted, send the body
15926|      0|      if (!write_request_body(strm, req, error)) { return false; }
  ------------------
  |  Branch (15926:11): [True: 0, False: 0]
  ------------------
15927|       |
15928|       |      // Read the actual response
15929|      0|      res.headers.clear();
15930|      0|      res.body.clear();
15931|      0|      if (!read_response_line(strm, req, res) ||
  ------------------
  |  Branch (15931:11): [True: 0, False: 0]
  ------------------
15932|      0|          !detail::read_headers(strm, res.headers)) {
  ------------------
  |  Branch (15932:11): [True: 0, False: 0]
  ------------------
15933|      0|        error = Error::Read;
15934|      0|        output_error_log(error, &req);
15935|      0|        return false;
15936|      0|      }
15937|      0|    }
15938|       |    // If not 100 Continue, server returned an error; proceed with that response
15939|      0|  }
15940|       |
15941|       |  // Body
15942|  1.82k|  if ((res.status != StatusCode::NoContent_204) && req.method != "HEAD" &&
  ------------------
  |  Branch (15942:7): [True: 1.81k, False: 10]
  |  Branch (15942:52): [True: 1.81k, False: 0]
  ------------------
15943|  1.81k|      req.method != "CONNECT") {
  ------------------
  |  Branch (15943:7): [True: 1.81k, False: 0]
  ------------------
15944|  1.81k|    auto redirect = 300 < res.status && res.status < 400 &&
  ------------------
  |  Branch (15944:21): [True: 772, False: 1.04k]
  |  Branch (15944:41): [True: 235, False: 537]
  ------------------
15945|    235|                    res.status != StatusCode::NotModified_304 &&
  ------------------
  |  Branch (15945:21): [True: 219, False: 16]
  ------------------
15946|    219|                    follow_location_;
  ------------------
  |  Branch (15946:21): [True: 0, False: 219]
  ------------------
15947|       |
15948|  1.81k|    if (req.response_handler && !redirect) {
  ------------------
  |  Branch (15948:9): [True: 0, False: 1.81k]
  |  Branch (15948:33): [True: 0, False: 0]
  ------------------
15949|      0|      if (!req.response_handler(res)) {
  ------------------
  |  Branch (15949:11): [True: 0, False: 0]
  ------------------
15950|      0|        error = Error::Canceled;
15951|      0|        output_error_log(error, &req);
15952|      0|        return false;
15953|      0|      }
15954|      0|    }
15955|       |
15956|  1.81k|    auto out =
15957|  1.81k|        req.content_receiver
  ------------------
  |  Branch (15957:9): [True: 0, False: 1.81k]
  ------------------
15958|  1.81k|            ? static_cast<ContentReceiverWithProgress>(
15959|      0|                  [&](const char *buf, size_t n, size_t off, size_t len) {
15960|      0|                    if (redirect) { return true; }
15961|      0|                    auto ret = req.content_receiver(buf, n, off, len);
15962|      0|                    if (!ret) {
15963|      0|                      error = Error::Canceled;
15964|      0|                      output_error_log(error, &req);
15965|      0|                    }
15966|      0|                    return ret;
15967|      0|                  })
15968|  1.81k|            : static_cast<ContentReceiverWithProgress>(
15969|  1.81k|                  [&](const char *buf, size_t n, size_t /*off*/,
15970|  1.81k|                      size_t /*len*/) {
15971|  1.81k|                    assert(res.body.size() + n <= res.body.max_size());
15972|  1.81k|                    if (payload_max_length_ > 0 &&
15973|  1.81k|                        (res.body.size() >= payload_max_length_ ||
15974|  1.81k|                         n > payload_max_length_ - res.body.size())) {
15975|  1.81k|                      return false;
15976|  1.81k|                    }
15977|  1.81k|                    res.body.append(buf, n);
15978|  1.81k|                    return true;
15979|  1.81k|                  });
15980|       |
15981|  1.81k|    auto progress = [&](size_t current, size_t total) {
15982|  1.81k|      if (!req.download_progress || redirect) { return true; }
15983|  1.81k|      auto ret = req.download_progress(current, total);
15984|  1.81k|      if (!ret) {
15985|  1.81k|        error = Error::Canceled;
15986|  1.81k|        output_error_log(error, &req);
15987|  1.81k|      }
15988|  1.81k|      return ret;
15989|  1.81k|    };
15990|       |
15991|  1.81k|    if (res.has_header("Content-Length")) {
  ------------------
  |  Branch (15991:9): [True: 625, False: 1.19k]
  ------------------
15992|    625|      if (!req.content_receiver) {
  ------------------
  |  Branch (15992:11): [True: 625, False: 0]
  ------------------
15993|    625|        auto len = res.get_header_value_u64("Content-Length");
15994|    625|        if (len > res.body.max_size()) {
  ------------------
  |  Branch (15994:13): [True: 65, False: 560]
  ------------------
15995|     65|          error = Error::Read;
15996|     65|          output_error_log(error, &req);
15997|     65|          return false;
15998|     65|        }
15999|       |        // Cap the reservation by payload_max_length_ to avoid OOM when a
16000|       |        // hostile or malformed server sends an enormous Content-Length.
16001|       |        // The actual body read below is bounded by payload_max_length_,
16002|       |        // so reserving more than that is never useful.
16003|    560|        auto reserve_len = static_cast<size_t>(len);
16004|    560|        if (payload_max_length_ > 0 && reserve_len > payload_max_length_) {
  ------------------
  |  Branch (16004:13): [True: 560, False: 0]
  |  Branch (16004:40): [True: 321, False: 239]
  ------------------
16005|    321|          reserve_len = payload_max_length_;
16006|    321|        }
16007|    560|        res.body.reserve(reserve_len);
16008|    560|      }
16009|    625|    }
16010|       |
16011|  1.75k|    if (res.status != StatusCode::NotModified_304) {
  ------------------
  |  Branch (16011:9): [True: 1.73k, False: 16]
  ------------------
16012|  1.73k|      auto content_status = 0;
16013|  1.73k|      auto max_length = (!has_payload_max_length_ && req.content_receiver)
  ------------------
  |  Branch (16013:26): [True: 1.73k, False: 0]
  |  Branch (16013:54): [True: 0, False: 1.73k]
  ------------------
16014|  1.73k|                            ? (std::numeric_limits<size_t>::max)()
16015|  1.73k|                            : payload_max_length_;
16016|  1.73k|      if (!detail::read_content(strm, res, max_length, content_status,
  ------------------
  |  Branch (16016:11): [True: 1.27k, False: 466]
  ------------------
16017|  1.73k|                                std::move(progress), std::move(out),
16018|  1.73k|                                decompress_)) {
16019|  1.27k|        if (error != Error::Canceled) {
  ------------------
  |  Branch (16019:13): [True: 1.27k, False: 0]
  ------------------
16020|       |          // Tell the caller apart from a plain read failure when the body could
16021|       |          // not be decoded because of its Content-Encoding.
16022|  1.27k|          switch (content_status) {
16023|      2|          case StatusCode::UnsupportedMediaType_415:
  ------------------
  |  Branch (16023:11): [True: 2, False: 1.27k]
  ------------------
16024|      2|            error = Error::UnsupportedContentEncoding;
16025|      2|            break;
16026|      0|          case StatusCode::InternalServerError_500:
  ------------------
  |  Branch (16026:11): [True: 0, False: 1.27k]
  ------------------
16027|      0|            error = Error::Compression;
16028|      0|            break;
16029|  1.27k|          default: error = Error::Read; break;
  ------------------
  |  Branch (16029:11): [True: 1.27k, False: 2]
  ------------------
16030|  1.27k|          }
16031|  1.27k|        }
16032|  1.27k|        output_error_log(error, &req);
16033|  1.27k|        return false;
16034|  1.27k|      }
16035|  1.73k|    }
16036|  1.75k|  }
16037|       |
16038|       |  // Log
16039|    492|  output_log(req, res);
16040|       |
16041|    492|  return true;
16042|  1.82k|}
_ZNK7httplib7Request10has_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
11310|  18.6k|inline bool Request::has_header(const std::string &key) const {
11311|  18.6k|  return detail::has_header(headers, key);
11312|  18.6k|}
_ZN7httplib6detail10has_headerERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_:
 7928|  19.6k|inline bool has_header(const Headers &headers, const std::string &key) {
 7929|  19.6k|  if (is_prohibited_header_name(key)) { return false; }
  ------------------
  |  Branch (7929:7): [True: 0, False: 19.6k]
  ------------------
 7930|  19.6k|  return headers.find(key) != headers.end();
 7931|  19.6k|}
_ZN7httplib6detail25is_prohibited_header_nameERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7916|  19.6k|inline bool is_prohibited_header_name(const std::string &name) {
 7917|  19.6k|  using udl::operator""_t;
 7918|       |
 7919|  19.6k|  switch (str2tag(name)) {
 7920|      0|  case "REMOTE_ADDR"_t:
  ------------------
  |  Branch (7920:3): [True: 0, False: 19.6k]
  ------------------
 7921|      0|  case "REMOTE_PORT"_t:
  ------------------
  |  Branch (7921:3): [True: 0, False: 19.6k]
  ------------------
 7922|      0|  case "LOCAL_ADDR"_t:
  ------------------
  |  Branch (7922:3): [True: 0, False: 19.6k]
  ------------------
 7923|      0|  case "LOCAL_PORT"_t: return true;
  ------------------
  |  Branch (7923:3): [True: 0, False: 19.6k]
  ------------------
 7924|  19.6k|  default: return false;
  ------------------
  |  Branch (7924:3): [True: 19.6k, False: 0]
  ------------------
 7925|  19.6k|  }
 7926|  19.6k|}
_ZN7httplib6detail7str2tagERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7300|  19.6k|inline unsigned int str2tag(const std::string &s) {
 7301|       |  // Iterative form of str2tag_core: the recursive constexpr version is kept
 7302|       |  // for compile-time UDL evaluation of short string literals, but at runtime
 7303|       |  // we may receive arbitrarily long inputs (e.g. fuzzed Content-Type) that
 7304|       |  // would blow the stack with one frame per character.
 7305|  19.6k|  unsigned int h = 0;
 7306|   178k|  for (auto c : s) {
  ------------------
  |  Branch (7306:15): [True: 178k, False: 19.6k]
  ------------------
 7307|   178k|    h = (((std::numeric_limits<unsigned int>::max)() >> 6) & h * 33) ^
 7308|   178k|        static_cast<unsigned char>(c);
 7309|   178k|  }
 7310|  19.6k|  return h;
 7311|  19.6k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE4findERKS8_:
 1178|  21.4k|  const_iterator find(const std::string &key) const {
 1179|  21.4k|    auto i = index_of(key);
 1180|  21.4k|    return i == npos() ? end() : make_citer(i, i);
  ------------------
  |  Branch (1180:12): [True: 20.3k, False: 1.16k]
  ------------------
 1181|  21.4k|  }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE8index_ofERKS8_:
 1263|  31.3k|  size_type index_of(const std::string &key) const {
 1264|  75.0k|    for (size_type i = 0; i < entries_.size(); i++) {
  ------------------
  |  Branch (1264:27): [True: 47.9k, False: 27.1k]
  ------------------
 1265|  47.9k|      if (keys_equal(entries_[i].first, key)) { return i; }
  ------------------
  |  Branch (1265:11): [True: 4.27k, False: 43.6k]
  ------------------
 1266|  47.9k|    }
 1267|  27.1k|    return npos();
 1268|  31.3k|  }
_ZN7httplib7Request10set_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
11324|  8.06k|                                const std::string &val) {
11325|  8.06k|  detail::set_header(headers, key, val);
11326|  8.06k|}
_ZN7httplib6detail10set_headerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_SE_:
 8007|  8.06k|                       const std::string &val) {
 8008|  8.06k|  if (fields::is_field_valid(key, val)) { headers.emplace(key, val); }
  ------------------
  |  Branch (8008:7): [True: 8.06k, False: 0]
  ------------------
 8009|  8.06k|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE7emplaceIJRKS8_SE_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1161|  18.2k|  template <typename... Args> iterator emplace(Args &&...args) {
 1162|  18.2k|    entries_.emplace_back(std::forward<Args>(args)...);
 1163|  18.2k|    return make_iter(entries_.size() - 1, npos());
 1164|  18.2k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE9make_iterEmm:
 1270|  40.8k|  iterator make_iter(size_type idx, size_type key_idx) {
 1271|  40.8k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1272|  40.8k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1116|  40.8k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail16has_header_tokenERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_SF_:
 7978|  3.10k|                             const std::string &token) {
 7979|       |  // RFC 9110 7.6.1: a comma-separated token list field such as Connection may
 7980|       |  // carry several tokens, and RFC 9110 5.3 lets that list be split across
 7981|       |  // several lines. Match complete tokens rather than searching the raw value,
 7982|       |  // so that a value such as "notupgrade" is not read as the token "upgrade".
 7983|  3.10k|  auto rng = headers.equal_range(key);
 7984|  3.10k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (7984:29): [True: 0, False: 3.10k]
  ------------------
 7985|      0|    const auto &value = it->second;
 7986|      0|    if (split_find(value.data(), value.data() + value.size(), ',',
  ------------------
  |  Branch (7986:9): [True: 0, False: 0]
  ------------------
 7987|      0|                   [&](const char *b, const char *e) {
 7988|      0|                     return case_ignore::equal(std::string(b, e), token);
 7989|      0|                   })) {
 7990|      0|      return true;
 7991|      0|    }
 7992|      0|  }
 7993|  3.10k|  return false;
 7994|  3.10k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE11equal_rangeERKS8_:
 1198|  7.90k|  equal_range(const std::string &key) const {
 1199|  7.90k|    auto i = index_of(key);
 1200|  7.90k|    return i == npos() ? std::make_pair(end(), end())
  ------------------
  |  Branch (1200:12): [True: 5.60k, False: 2.29k]
  ------------------
 1201|  7.90k|                       : std::make_pair(make_citer(i, i), end());
 1202|  7.90k|  }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEptEv:
 1064|  5.83k|    pointer operator->() const { return data_ + idx_; }
_ZN7httplib6detail4trimEPKcS2_mm:
 5863|  13.5k|                                      size_t right) {
 5864|  21.8k|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (5864:10): [True: 21.7k, False: 106]
  |  Branch (5864:26): [True: 8.30k, False: 13.4k]
  ------------------
 5865|  8.30k|    left++;
 5866|  8.30k|  }
 5867|  21.8k|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (5867:10): [True: 21.7k, False: 128]
  |  Branch (5867:23): [True: 8.29k, False: 13.4k]
  ------------------
 5868|  8.29k|    right--;
 5869|  8.29k|  }
 5870|  13.5k|  return std::make_pair(left, right);
 5871|  13.5k|}
_ZN7httplib6detail15is_space_or_tabEc:
 5726|  69.4k|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (5726:46): [True: 17.3k, False: 52.0k]
  |  Branch (5726:58): [True: 1.06k, False: 51.0k]
  ------------------
_ZN7httplib10ClientImpl13write_requestERNS_6StreamERNS_7RequestEbRNS_5ErrorEb:
15501|  3.10k|                                      bool skip_body) {
15502|       |  // Prepare additional headers
15503|  3.10k|  if (close_connection) {
  ------------------
  |  Branch (15503:7): [True: 0, False: 3.10k]
  ------------------
15504|      0|    if (!req.has_header("Connection")) {
  ------------------
  |  Branch (15504:9): [True: 0, False: 0]
  ------------------
15505|      0|      req.set_header("Connection", "close");
15506|      0|    }
15507|      0|  }
15508|       |
15509|  3.10k|  std::string ct_for_defaults;
15510|  3.10k|  if (!req.has_header("Content-Type") && !req.body.empty()) {
  ------------------
  |  Branch (15510:7): [True: 3.10k, False: 0]
  |  Branch (15510:7): [True: 0, False: 3.10k]
  |  Branch (15510:42): [True: 0, False: 3.10k]
  ------------------
15511|      0|    ct_for_defaults = "text/plain";
15512|      0|  }
15513|  3.10k|  prepare_default_headers(req, false, ct_for_defaults);
15514|       |
15515|  3.10k|  if (req.body.empty()) {
  ------------------
  |  Branch (15515:7): [True: 3.10k, False: 0]
  ------------------
15516|  3.10k|    if (req.content_provider_) {
  ------------------
  |  Branch (15516:9): [True: 0, False: 3.10k]
  ------------------
15517|      0|      if (!req.is_chunked_content_provider_) {
  ------------------
  |  Branch (15517:11): [True: 0, False: 0]
  ------------------
15518|      0|        if (!req.has_header("Content-Length")) {
  ------------------
  |  Branch (15518:13): [True: 0, False: 0]
  ------------------
15519|      0|          auto length = std::to_string(req.content_length_);
15520|      0|          req.set_header("Content-Length", length);
15521|      0|        }
15522|      0|      }
15523|  3.10k|    } else {
15524|  3.10k|      if (req.method == "POST" || req.method == "PUT" ||
  ------------------
  |  Branch (15524:11): [True: 647, False: 2.45k]
  |  Branch (15524:35): [True: 866, False: 1.59k]
  ------------------
15525|  1.85k|          req.method == "PATCH") {
  ------------------
  |  Branch (15525:11): [True: 339, False: 1.25k]
  ------------------
15526|  1.85k|        req.set_header("Content-Length", "0");
15527|  1.85k|      }
15528|  3.10k|    }
15529|  3.10k|  }
15530|       |
15531|  3.10k|  if (!basic_auth_password_.empty() || !basic_auth_username_.empty()) {
  ------------------
  |  Branch (15531:7): [True: 0, False: 3.10k]
  |  Branch (15531:40): [True: 0, False: 3.10k]
  ------------------
15532|      0|    if (!req.has_header("Authorization")) {
  ------------------
  |  Branch (15532:9): [True: 0, False: 0]
  ------------------
15533|      0|      req.headers.insert(make_basic_authentication_header(
15534|      0|          basic_auth_username_, basic_auth_password_, false));
15535|      0|    }
15536|      0|  }
15537|       |
15538|  3.10k|  if (!bearer_token_auth_token_.empty()) {
  ------------------
  |  Branch (15538:7): [True: 0, False: 3.10k]
  ------------------
15539|      0|    if (!req.has_header("Authorization")) {
  ------------------
  |  Branch (15539:9): [True: 0, False: 0]
  ------------------
15540|      0|      req.headers.insert(make_bearer_token_authentication_header(
15541|      0|          bearer_token_auth_token_, false));
15542|      0|    }
15543|      0|  }
15544|       |
15545|       |  // Proxy-Authorization is only sent when the proxy is actually used for
15546|       |  // this target — otherwise NO_PROXY-matched requests would leak proxy
15547|       |  // credentials directly to the destination server.
15548|  3.10k|  if (is_proxy_enabled_for_host(host_)) {
  ------------------
  |  Branch (15548:7): [True: 0, False: 3.10k]
  ------------------
15549|      0|    if (!proxy_basic_auth_username_.empty() &&
  ------------------
  |  Branch (15549:9): [True: 0, False: 0]
  |  Branch (15549:9): [True: 0, False: 0]
  ------------------
15550|      0|        !proxy_basic_auth_password_.empty() &&
  ------------------
  |  Branch (15550:9): [True: 0, False: 0]
  ------------------
15551|      0|        !req.has_header("Proxy-Authorization")) {
  ------------------
  |  Branch (15551:9): [True: 0, False: 0]
  ------------------
15552|      0|      req.headers.insert(make_basic_authentication_header(
15553|      0|          proxy_basic_auth_username_, proxy_basic_auth_password_, true));
15554|      0|    }
15555|      0|    if (!proxy_bearer_token_auth_token_.empty() &&
  ------------------
  |  Branch (15555:9): [True: 0, False: 0]
  |  Branch (15555:9): [True: 0, False: 0]
  ------------------
15556|      0|        !req.has_header("Proxy-Authorization")) {
  ------------------
  |  Branch (15556:9): [True: 0, False: 0]
  ------------------
15557|      0|      req.headers.insert(make_bearer_token_authentication_header(
15558|      0|          proxy_bearer_token_auth_token_, true));
15559|      0|    }
15560|      0|  }
15561|       |
15562|       |  // Request line and headers
15563|  3.10k|  {
15564|  3.10k|    detail::BufferStream bstrm;
15565|       |
15566|       |    // Extract the query from req.path. The encoding itself is delegated to
15567|       |    // `encode_request_target`; the raw query is still needed here to decide
15568|       |    // between populating `req.params` from it and falling back to building a
15569|       |    // query out of caller-supplied `req.params`.
15570|  3.10k|    auto query_pos = req.path.find('?');
15571|  3.10k|    auto query_part = query_pos == std::string::npos
  ------------------
  |  Branch (15571:23): [True: 3.10k, False: 0]
  ------------------
15572|  3.10k|                          ? std::string()
15573|  3.10k|                          : req.path.substr(query_pos + 1);
15574|       |
15575|  3.10k|    auto path_with_query =
15576|  3.10k|        detail::encode_request_target(req.path, path_encode_);
15577|       |
15578|  3.10k|    if (!query_part.empty()) {
  ------------------
  |  Branch (15578:9): [True: 0, False: 3.10k]
  ------------------
15579|       |      // The query already came in through `req.path`; still populate
15580|       |      // `req.params` for handlers/users who read them.
15581|      0|      detail::parse_query_text(query_part, req.params);
15582|  3.10k|    } else if (!req.params.empty()) {
  ------------------
  |  Branch (15582:16): [True: 0, False: 3.10k]
  ------------------
15583|       |      // No query in `req.path`; build one from `req.params` so existing
15584|       |      // callers that pass `Params` separately continue to work.
15585|      0|      path_with_query = append_query_params(path_with_query, req.params);
15586|      0|    }
15587|       |
15588|       |    // Write request line and headers
15589|  3.10k|    if (detail::write_request_line(bstrm, req.method, path_with_query) < 0) {
  ------------------
  |  Branch (15589:9): [True: 0, False: 3.10k]
  ------------------
15590|       |      // A rejected target (e.g. CR/LF smuggled in via a decoded redirect
15591|       |      // Location under set_path_encode(false)) must fail the request cleanly
15592|       |      // instead of emitting a request-line-less, header-injecting request.
15593|      0|      error = Error::Write;
15594|      0|      output_error_log(error, &req);
15595|      0|      return false;
15596|      0|    }
15597|  3.10k|    if (!detail::check_and_write_headers(bstrm, req.headers, header_writer_,
  ------------------
  |  Branch (15597:9): [True: 0, False: 3.10k]
  ------------------
15598|  3.10k|                                         error)) {
15599|      0|      output_error_log(error, &req);
15600|      0|      return false;
15601|      0|    }
15602|       |
15603|       |    // Flush buffer
15604|  3.10k|    auto &data = bstrm.get_buffer();
15605|  3.10k|    if (!detail::write_data(strm, data.data(), data.size())) {
  ------------------
  |  Branch (15605:9): [True: 0, False: 3.10k]
  ------------------
15606|      0|      error = Error::Write;
15607|      0|      output_error_log(error, &req);
15608|      0|      return false;
15609|      0|    }
15610|  3.10k|  }
15611|       |
15612|       |  // After sending request line and headers, wait briefly for an early server
15613|       |  // response (e.g. 4xx) and avoid sending a potentially large request body
15614|       |  // unnecessarily. This workaround is only enabled on Windows because Unix
15615|       |  // platforms surface write errors (EPIPE) earlier; on Windows kernel send
15616|       |  // buffering can accept large writes even when the peer already responded.
15617|       |  // Check the stream first (which covers SSL via `is_readable()`), then
15618|       |  // fall back to select on the socket. Only perform the wait for very large
15619|       |  // request bodies to avoid interfering with normal small requests and
15620|       |  // reduce side-effects. Poll briefly (up to 50ms as default) for an early
15621|       |  // response. Skip this check when using Expect: 100-continue, as the protocol
15622|       |  // handles early responses properly.
15623|       |#if defined(_WIN32)
15624|       |  if (!skip_body &&
15625|       |      req.body.size() > CPPHTTPLIB_WAIT_EARLY_SERVER_RESPONSE_THRESHOLD &&
15626|       |      req.path.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
15627|       |    auto start = std::chrono::high_resolution_clock::now();
15628|       |
15629|       |    for (;;) {
15630|       |      // Prefer socket-level readiness to avoid SSL_pending() false-positives
15631|       |      // from SSL internals. If the underlying socket is readable, assume an
15632|       |      // early response may be present.
15633|       |      auto sock = strm.socket();
15634|       |      if (sock != INVALID_SOCKET && detail::select_read(sock, 0, 0) > 0) {
15635|       |        return false;
15636|       |      }
15637|       |
15638|       |      // Fallback to stream-level check for non-socket streams or when the
15639|       |      // socket isn't reporting readable. Avoid using `is_readable()` for
15640|       |      // SSL, since `SSL_pending()` may report buffered records that do not
15641|       |      // indicate a complete application-level response yet.
15642|       |      if (!is_ssl() && strm.is_readable()) { return false; }
15643|       |
15644|       |      auto now = std::chrono::high_resolution_clock::now();
15645|       |      auto elapsed =
15646|       |          std::chrono::duration_cast<std::chrono::milliseconds>(now - start)
15647|       |              .count();
15648|       |      if (elapsed >= CPPHTTPLIB_WAIT_EARLY_SERVER_RESPONSE_TIMEOUT_MSECOND) {
15649|       |        break;
15650|       |      }
15651|       |
15652|       |      std::this_thread::sleep_for(std::chrono::milliseconds(1));
15653|       |    }
15654|       |  }
15655|       |#endif
15656|       |
15657|       |  // Body
15658|  3.10k|  if (skip_body) { return true; }
  ------------------
  |  Branch (15658:7): [True: 0, False: 3.10k]
  ------------------
15659|       |
15660|  3.10k|  return write_request_body(strm, req, error);
15661|  3.10k|}
_ZN7httplib10ClientImpl23prepare_default_headersERNS_7RequestEbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
14847|  3.10k|                                                const std::string &ct) {
14848|  3.10k|  (void)for_stream;
14849|  3.10k|  for (const auto &header : default_headers_) {
  ------------------
  |  Branch (14849:27): [True: 0, False: 3.10k]
  ------------------
14850|      0|    if (!r.has_header(header.first)) { r.headers.insert(header); }
  ------------------
  |  Branch (14850:9): [True: 0, False: 0]
  ------------------
14851|      0|  }
14852|       |
14853|       |  // RFC 9110 5.3 recommends sending control data such as Host first, so
14854|       |  // prepend it rather than appending it after the caller's own fields.
14855|  3.10k|  if (!r.has_header("Host")) {
  ------------------
  |  Branch (14855:7): [True: 3.10k, False: 0]
  ------------------
14856|  3.10k|    r.headers.emplace_front(
14857|  3.10k|        "Host", detail::make_default_host_header_value(host_, port_, is_ssl(),
14858|  3.10k|                                                       address_family_));
14859|  3.10k|  }
14860|       |
14861|  3.10k|  if (!r.has_header("Accept")) { r.headers.emplace("Accept", "*/*"); }
  ------------------
  |  Branch (14861:7): [True: 3.10k, False: 0]
  ------------------
14862|       |
14863|  3.10k|  if (!r.content_receiver) {
  ------------------
  |  Branch (14863:7): [True: 3.10k, False: 0]
  ------------------
14864|  3.10k|    if (!r.has_header("Accept-Encoding")) {
  ------------------
  |  Branch (14864:9): [True: 3.10k, False: 0]
  ------------------
14865|  3.10k|      std::string accept_encoding;
14866|       |#ifdef CPPHTTPLIB_BROTLI_SUPPORT
14867|       |      accept_encoding = "br";
14868|       |#endif
14869|  3.10k|#ifdef CPPHTTPLIB_ZLIB_SUPPORT
14870|  3.10k|      if (!accept_encoding.empty()) { accept_encoding += ", "; }
  ------------------
  |  Branch (14870:11): [True: 0, False: 3.10k]
  ------------------
14871|  3.10k|      accept_encoding += "gzip, deflate";
14872|  3.10k|#endif
14873|       |#ifdef CPPHTTPLIB_ZSTD_SUPPORT
14874|       |      if (!accept_encoding.empty()) { accept_encoding += ", "; }
14875|       |      accept_encoding += "zstd";
14876|       |#endif
14877|  3.10k|      r.set_header("Accept-Encoding", accept_encoding);
14878|  3.10k|    }
14879|       |
14880|  3.10k|    detail::add_default_user_agent_header(r);
14881|  3.10k|  }
14882|       |
14883|  3.10k|  if (!r.body.empty()) {
  ------------------
  |  Branch (14883:7): [True: 0, False: 3.10k]
  ------------------
14884|      0|    if (!ct.empty() && !r.has_header("Content-Type")) {
  ------------------
  |  Branch (14884:9): [True: 0, False: 0]
  |  Branch (14884:9): [True: 0, False: 0]
  |  Branch (14884:24): [True: 0, False: 0]
  ------------------
14885|      0|      r.headers.emplace("Content-Type", ct);
14886|      0|    }
14887|      0|    if (!r.has_header("Content-Length")) {
  ------------------
  |  Branch (14887:9): [True: 0, False: 0]
  ------------------
14888|      0|      r.headers.emplace("Content-Length", std::to_string(r.body.size()));
14889|      0|    }
14890|      0|  }
14891|  3.10k|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE5beginEv:
 1139|  6.21k|  iterator begin() { return make_iter(0, npos()); }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE3endEv:
 1140|  9.42k|  iterator end() { return make_iter(entries_.size(), npos()); }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEEneISE_EEbRKNSC_IT_EE:
 1107|  23.8k|    template <typename U> bool operator!=(const iterator_t<U> &rhs) const {
 1108|  23.8k|      return idx_ != rhs.idx_;
 1109|  23.8k|    }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEEdeEv:
 1063|  14.2k|    reference operator*() const { return data_[idx_]; }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEEppEv:
 1066|  15.6k|    iterator_t &operator++() {
 1067|       |      // Saturating, so that advancing past the last entry of a key (which
 1068|       |      // get_multimap_value() does when asked for an out-of-range id) stays at
 1069|       |      // end() instead of running off the container.
 1070|  15.6k|      if (idx_ >= size_) { return *this; }
  ------------------
  |  Branch (1070:11): [True: 0, False: 15.6k]
  ------------------
 1071|  15.6k|      ++idx_;
 1072|  15.6k|      if (key_idx_ != npos()) {
  ------------------
  |  Branch (1072:11): [True: 1.39k, False: 14.2k]
  ------------------
 1073|  2.21k|        while (idx_ < size_ && !matches(idx_)) {
  ------------------
  |  Branch (1073:16): [True: 1.58k, False: 626]
  |  Branch (1073:32): [True: 813, False: 772]
  ------------------
 1074|    813|          ++idx_;
 1075|    813|        }
 1076|  1.39k|      }
 1077|  15.6k|      return *this;
 1078|  15.6k|    }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEE7matchesEm:
 1118|  1.58k|    bool matches(size_type i) const {
 1119|  1.58k|      return keys_equal(data_[i].first, data_[key_idx_].first);
 1120|  1.58k|    }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE13emplace_frontIJRA5_KcS8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1168|  3.10k|  template <typename... Args> iterator emplace_front(Args &&...args) {
 1169|  3.10k|    entries_.emplace(entries_.begin(), std::forward<Args>(args)...);
 1170|  3.10k|    return make_iter(0, npos());
 1171|  3.10k|  }
_ZN7httplib6detail30make_default_host_header_valueERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEibi:
12181|  3.10k|                                                  int address_family) {
12182|  3.10k|  if (address_family == AF_UNIX) { return "localhost"; }
  ------------------
  |  Branch (12182:7): [True: 0, False: 3.10k]
  ------------------
12183|  3.10k|  return make_host_and_port_string(host, port, is_ssl);
12184|  3.10k|}
_ZN7httplib6detail25make_host_and_port_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEib:
12158|  3.10k|                                             bool is_ssl) {
12159|  3.10k|  auto result = prepare_host_string(host);
12160|       |
12161|       |  // Append port if not default
12162|  3.10k|  if ((!is_ssl && port == 80) || (is_ssl && port == 443)) {
  ------------------
  |  Branch (12162:8): [True: 3.10k, False: 0]
  |  Branch (12162:19): [True: 0, False: 3.10k]
  |  Branch (12162:35): [True: 0, False: 3.10k]
  |  Branch (12162:45): [True: 0, False: 0]
  ------------------
12163|      0|    ; // do nothing
12164|  3.10k|  } else {
12165|  3.10k|    result += ":" + std::to_string(port);
12166|  3.10k|  }
12167|       |
12168|  3.10k|  return result;
12169|  3.10k|}
_ZN7httplib6detail19prepare_host_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
12145|  3.10k|inline std::string prepare_host_string(const std::string &host) {
12146|       |  // Enclose IPv6 address in brackets (but not if already enclosed)
12147|  3.10k|  if (host.find(':') == std::string::npos ||
  ------------------
  |  Branch (12147:7): [True: 3.10k, False: 0]
  ------------------
12148|  3.10k|      (!host.empty() && host[0] == '[')) {
  ------------------
  |  Branch (12148:8): [True: 0, False: 0]
  |  Branch (12148:25): [True: 0, False: 0]
  ------------------
12149|       |    // IPv4, hostname, or already bracketed IPv6
12150|  3.10k|    return host;
12151|  3.10k|  } else {
12152|       |    // IPv6 address without brackets
12153|      0|    return "[" + host + "]";
12154|      0|  }
12155|  3.10k|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE7emplaceIJRA7_KcRA4_SD_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1161|  3.10k|  template <typename... Args> iterator emplace(Args &&...args) {
 1162|  3.10k|    entries_.emplace_back(std::forward<Args>(args)...);
 1163|  3.10k|    return make_iter(entries_.size() - 1, npos());
 1164|  3.10k|  }
_ZN7httplib6detail29add_default_user_agent_headerERNS_7RequestE:
12186|  3.10k|inline void add_default_user_agent_header(Request &req) {
12187|  3.10k|#ifndef CPPHTTPLIB_NO_DEFAULT_USER_AGENT
12188|  3.10k|  if (!req.has_header("User-Agent")) {
  ------------------
  |  Branch (12188:7): [True: 3.10k, False: 0]
  ------------------
12189|  3.10k|    req.set_header("User-Agent",
12190|  3.10k|                   std::string("cpp-httplib/") + CPPHTTPLIB_VERSION);
  ------------------
  |  |   11|  3.10k|#define CPPHTTPLIB_VERSION "0.54.1"
  ------------------
12191|  3.10k|  }
12192|       |#else
12193|       |  (void)req;
12194|       |#endif
12195|  3.10k|}
_ZNK7httplib10ClientImpl25is_proxy_enabled_for_hostERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
14603|  3.10k|ClientImpl::is_proxy_enabled_for_host(const std::string &host) const {
14604|  3.10k|  if (proxy_host_.empty() || proxy_port_ == -1) { return false; }
  ------------------
  |  Branch (14604:7): [True: 3.10k, False: 0]
  |  Branch (14604:30): [True: 0, False: 0]
  ------------------
14605|      0|  if (no_proxy_entries_.empty()) { return true; }
  ------------------
  |  Branch (14605:7): [True: 0, False: 0]
  ------------------
14606|       |  // host_ is const so its normalized form is invariant; cache it. The
14607|       |  // cross-host path (setup_redirect_client passing next_host) re-normalizes.
14608|      0|  if (host == host_) {
  ------------------
  |  Branch (14608:7): [True: 0, False: 0]
  ------------------
14609|      0|    if (!host_normalized_valid_) {
  ------------------
  |  Branch (14609:9): [True: 0, False: 0]
  ------------------
14610|      0|      host_normalized_ = detail::normalize_target(host_);
14611|      0|      host_normalized_valid_ = true;
14612|      0|    }
14613|      0|    return !detail::host_matches_no_proxy(host_normalized_, no_proxy_entries_);
14614|      0|  }
14615|      0|  auto target = detail::normalize_target(host);
14616|      0|  return !detail::host_matches_no_proxy(target, no_proxy_entries_);
14617|      0|}
_ZN7httplib6detail12BufferStreamC2Ev:
 3676|  3.10k|  BufferStream() = default;
_ZN7httplib6detail21encode_request_targetERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEb:
 8880|  3.10k|                                         bool path_encode) {
 8881|       |  // `substr(0, npos)` yields the whole string, which is what the no-query
 8882|       |  // case needs.
 8883|  3.10k|  auto query_pos = target.find('?');
 8884|  3.10k|  auto path_part = target.substr(0, query_pos);
 8885|  3.10k|  std::string query_part;
 8886|  3.10k|  if (query_pos != std::string::npos) {
  ------------------
  |  Branch (8886:7): [True: 0, False: 3.10k]
  ------------------
 8887|      0|    query_part = target.substr(query_pos + 1);
 8888|      0|  }
 8889|       |
 8890|  3.10k|  auto result = path_encode ? encode_path(path_part) : std::move(path_part);
  ------------------
  |  Branch (8890:17): [True: 3.10k, False: 0]
  ------------------
 8891|       |
 8892|  3.10k|  if (!query_part.empty()) {
  ------------------
  |  Branch (8892:7): [True: 0, False: 3.10k]
  ------------------
 8893|       |    // When path encoding is disabled the caller has supplied an already-encoded
 8894|       |    // target and expects the exact bytes to be sent on the wire, so skip
 8895|       |    // normalization for the query too. Normalizing would decode-then-re-encode
 8896|       |    // it and corrupt pre-encoded binary payloads (e.g. turning `%20` into `+`,
 8897|       |    // which a strict RFC 3986 server decodes back as `+`, not a space).
 8898|      0|    if (path_encode) {
  ------------------
  |  Branch (8898:9): [True: 0, False: 0]
  ------------------
 8899|      0|      auto normalized = normalize_query_string(query_part);
 8900|      0|      if (!normalized.empty()) {
  ------------------
  |  Branch (8900:11): [True: 0, False: 0]
  ------------------
 8901|      0|        result += '?';
 8902|      0|        result += normalized;
 8903|      0|      }
 8904|      0|    } else {
 8905|      0|      result += '?';
 8906|      0|      result += query_part;
 8907|      0|    }
 8908|      0|  }
 8909|       |
 8910|  3.10k|  return result;
 8911|  3.10k|}
_ZN7httplib6detail11encode_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5687|  3.10k|inline std::string encode_path(const std::string &s) {
 5688|  3.10k|  std::string result;
 5689|  3.10k|  result.reserve(s.size());
 5690|       |
 5691|  6.21k|  for (size_t i = 0; s[i]; i++) {
  ------------------
  |  Branch (5691:22): [True: 3.10k, False: 3.10k]
  ------------------
 5692|  3.10k|    switch (s[i]) {
 5693|      0|    case ' ': result += "%20"; break;
  ------------------
  |  Branch (5693:5): [True: 0, False: 3.10k]
  ------------------
 5694|      0|    case '+': result += "%2B"; break;
  ------------------
  |  Branch (5694:5): [True: 0, False: 3.10k]
  ------------------
 5695|      0|    case '\r': result += "%0D"; break;
  ------------------
  |  Branch (5695:5): [True: 0, False: 3.10k]
  ------------------
 5696|      0|    case '\n': result += "%0A"; break;
  ------------------
  |  Branch (5696:5): [True: 0, False: 3.10k]
  ------------------
 5697|      0|    case '\'': result += "%27"; break;
  ------------------
  |  Branch (5697:5): [True: 0, False: 3.10k]
  ------------------
 5698|      0|    case ',': result += "%2C"; break;
  ------------------
  |  Branch (5698:5): [True: 0, False: 3.10k]
  ------------------
 5699|       |    // case ':': result += "%3A"; break; // ok? probably...
 5700|      0|    case ';': result += "%3B"; break;
  ------------------
  |  Branch (5700:5): [True: 0, False: 3.10k]
  ------------------
 5701|  3.10k|    default:
  ------------------
  |  Branch (5701:5): [True: 3.10k, False: 0]
  ------------------
 5702|  3.10k|      auto c = static_cast<uint8_t>(s[i]);
 5703|  3.10k|      if (c >= 0x80) {
  ------------------
  |  Branch (5703:11): [True: 0, False: 3.10k]
  ------------------
 5704|      0|        result += '%';
 5705|      0|        char hex[4];
 5706|      0|        auto len = snprintf(hex, sizeof(hex) - 1, "%02X", c);
 5707|      0|        assert(len == 2);
  ------------------
  |  Branch (5707:9): [True: 0, False: 0]
  ------------------
 5708|      0|        result.append(hex, static_cast<size_t>(len));
 5709|  3.10k|      } else {
 5710|  3.10k|        result += s[i];
 5711|  3.10k|      }
 5712|  3.10k|      break;
 5713|  3.10k|    }
 5714|  3.10k|  }
 5715|       |
 5716|  3.10k|  return result;
 5717|  3.10k|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 5907|  1.27k|                  std::function<void(const char *, const char *)> fn) {
 5908|  1.27k|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 5909|  1.27k|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 5912|  1.27k|                  std::function<void(const char *, const char *)> fn) {
 5913|  1.27k|  size_t i = 0;
 5914|  1.27k|  size_t beg = 0;
 5915|  1.27k|  size_t count = 1;
 5916|       |
 5917|   180k|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (5917:10): [True: 180k, False: 0]
  |  Branch (5917:10): [True: 178k, False: 1.27k]
  ------------------
 5918|   178k|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (5918:9): [True: 12.4k, False: 166k]
  |  Branch (5918:22): [True: 12.4k, False: 0]
  ------------------
 5919|  12.4k|      auto r = trim(b, e, beg, i);
 5920|  12.4k|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5920:11): [True: 3.62k, False: 8.85k]
  ------------------
 5921|  12.4k|      beg = i + 1;
 5922|  12.4k|      count++;
 5923|  12.4k|    }
 5924|   178k|    i++;
 5925|   178k|  }
 5926|       |
 5927|  1.27k|  if (i) {
  ------------------
  |  Branch (5927:7): [True: 1.10k, False: 171]
  ------------------
 5928|  1.10k|    auto r = trim(b, e, beg, i);
 5929|  1.10k|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5929:9): [True: 1.00k, False: 106]
  ------------------
 5930|  1.10k|  }
 5931|  1.27k|}
_ZN7httplib6detail6is_hexEcRi:
 5079|  15.8k|inline bool is_hex(char c, int &v) {
 5080|  15.8k|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5080:7): [True: 8.12k, False: 7.74k]
  ------------------
 5081|  8.12k|    v = c - '0';
 5082|  8.12k|    return true;
 5083|  8.12k|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5083:14): [True: 3.75k, False: 3.99k]
  |  Branch (5083:26): [True: 1.02k, False: 2.73k]
  ------------------
 5084|  1.02k|    v = c - 'A' + 10;
 5085|  1.02k|    return true;
 5086|  6.72k|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5086:14): [True: 2.72k, False: 3.99k]
  |  Branch (5086:26): [True: 2.70k, False: 17]
  ------------------
 5087|  2.70k|    v = c - 'a' + 10;
 5088|  2.70k|    return true;
 5089|  2.70k|  }
 5090|  4.01k|  return false;
 5091|  15.8k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE5emptyEv:
 1146|  3.10k|  bool empty() const { return entries_.empty(); }
_ZN7httplib6detail18write_request_lineERNS_6StreamERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_:
 8409|  3.10k|                                  const std::string &path) {
 8410|       |  // A request target must not carry CR/LF (or other control octets); otherwise
 8411|       |  // a value smuggled into it splits the request line and injects headers or a
 8412|       |  // whole request. The same field-value check already guards header values in
 8413|       |  // check_and_write_headers and the request target in
 8414|       |  // perform_websocket_handshake; apply it here too.
 8415|  3.10k|  if (!fields::is_field_value(path)) { return -1; }
  ------------------
  |  Branch (8415:7): [True: 0, False: 3.10k]
  ------------------
 8416|       |
 8417|  3.10k|  std::string s = method;
 8418|  3.10k|  s += ' ';
 8419|  3.10k|  s += path;
 8420|  3.10k|  s += " HTTP/1.1\r\n";
 8421|  3.10k|  return strm.write(s.data(), s.size());
 8422|  3.10k|}
_ZN7httplib6detail23check_and_write_headersINSt3__18functionIFlRNS_6StreamERNS0_26insertion_ordered_multimapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEEEEEEEbS5_SG_T_RNS_5ErrorE:
12369|  3.10k|                                    T header_writer, Error &error) {
12370|  14.2k|  for (const auto &h : headers) {
  ------------------
  |  Branch (12370:22): [True: 14.2k, False: 3.10k]
  ------------------
12371|  14.2k|    if (!detail::fields::is_field_valid(h.first, h.second)) {
  ------------------
  |  Branch (12371:9): [True: 0, False: 14.2k]
  ------------------
12372|      0|      error = Error::InvalidHeaders;
12373|      0|      return false;
12374|      0|    }
12375|  14.2k|  }
12376|  3.10k|  if (header_writer(strm, headers) <= 0) {
  ------------------
  |  Branch (12376:7): [True: 0, False: 3.10k]
  ------------------
12377|      0|    error = Error::Write;
12378|      0|    return false;
12379|      0|  }
12380|  3.10k|  return true;
12381|  3.10k|}
_ZNK7httplib6detail12BufferStream10get_bufferEv:
12036|  3.10k|inline const std::string &BufferStream::get_buffer() const { return buffer; }
_ZN7httplib6detail10write_dataERNS_6StreamEPKcm:
 8459|  3.10k|inline bool write_data(Stream &strm, const char *d, size_t l) {
 8460|  3.10k|  size_t offset = 0;
 8461|  6.21k|  while (offset < l) {
  ------------------
  |  Branch (8461:10): [True: 3.10k, False: 3.10k]
  ------------------
 8462|  3.10k|    auto length = strm.write(d + offset, l - offset);
 8463|  3.10k|    if (length < 0) { return false; }
  ------------------
  |  Branch (8463:9): [True: 0, False: 3.10k]
  ------------------
 8464|  3.10k|    offset += static_cast<size_t>(length);
 8465|  3.10k|  }
 8466|  3.10k|  return true;
 8467|  3.10k|}
_ZNK7httplib10ClientImpl18read_response_lineERNS_6StreamERKNS_7RequestERNS_8ResponseEb:
14700|  3.10k|                                           bool skip_100_continue) const {
14701|  3.10k|  std::array<char, 2048> buf{};
14702|       |
14703|  3.10k|  detail::stream_line_reader line_reader(strm, buf.data(), buf.size());
14704|       |
14705|  3.10k|  if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (14705:7): [True: 9, False: 3.09k]
  ------------------
14706|       |
14707|  3.09k|  if (!detail::parse_status_line(line_reader.ptr(), res.version, res.status,
  ------------------
  |  Branch (14707:7): [True: 230, False: 2.86k]
  ------------------
14708|  3.09k|                                 res.reason)) {
14709|    230|    return req.method == "CONNECT";
14710|    230|  }
14711|       |
14712|       |  // Ignore '100 Continue' (only when not using Expect: 100-continue explicitly)
14713|  8.48k|  while (skip_100_continue && res.status == StatusCode::Continue_100) {
  ------------------
  |  Branch (14713:10): [True: 8.48k, False: 0]
  |  Branch (14713:31): [True: 5.82k, False: 2.66k]
  ------------------
14714|  5.82k|    if (!line_reader.getline()) { return false; } // CRLF
  ------------------
  |  Branch (14714:9): [True: 66, False: 5.76k]
  ------------------
14715|  5.76k|    if (!line_reader.getline()) { return false; } // next response line
  ------------------
  |  Branch (14715:9): [True: 12, False: 5.74k]
  ------------------
14716|       |
14717|  5.74k|    if (!detail::parse_status_line(line_reader.ptr(), res.version, res.status,
  ------------------
  |  Branch (14717:9): [True: 127, False: 5.62k]
  ------------------
14718|  5.74k|                                   res.reason)) {
14719|    127|      return false;
14720|    127|    }
14721|  5.74k|  }
14722|       |
14723|  2.66k|  return true;
14724|  2.86k|}
_ZN7httplib6detail18stream_line_readerC2ERNS_6StreamEPcm:
 6020|  13.3k|    : strm_(strm), fixed_buffer_(fixed_buffer),
 6021|  13.3k|      fixed_buffer_size_(fixed_buffer_size) {}
_ZN7httplib6detail18stream_line_reader7getlineEv:
 6044|  38.9k|inline bool stream_line_reader::getline() {
 6045|  38.9k|  fixed_buffer_used_size_ = 0;
 6046|  38.9k|  growable_buffer_.clear();
 6047|       |
 6048|  38.9k|#ifndef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6049|  38.9k|  char prev_byte = 0;
 6050|  38.9k|#endif
 6051|       |
 6052|  3.57M|  for (size_t i = 0;; i++) {
 6053|       |    // Fast path: whatever the stream has already buffered can be scanned for
 6054|       |    // the terminator in one pass. Asking for a byte at a time costs a virtual
 6055|       |    // call, a bounds check and a one-byte copy per character of the request.
 6056|  3.57M|    size_t buffered_size = 0;
 6057|  3.57M|    if (auto buffered = strm_.buffered_data(buffered_size)) {
  ------------------
  |  Branch (6057:14): [True: 0, False: 3.57M]
  ------------------
 6058|      0|      auto take = buffered_size;
 6059|      0|      auto terminated = false;
 6060|       |
 6061|      0|      for (size_t at = 0; at < buffered_size;) {
  ------------------
  |  Branch (6061:27): [True: 0, False: 0]
  ------------------
 6062|      0|        auto nl = static_cast<const char *>(
 6063|      0|            memchr(buffered + at, '\n', buffered_size - at));
 6064|      0|        if (!nl) { break; }
  ------------------
  |  Branch (6064:13): [True: 0, False: 0]
  ------------------
 6065|      0|        auto pos = static_cast<size_t>(nl - buffered);
 6066|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6067|       |        take = pos + 1;
 6068|       |        terminated = true;
 6069|       |        break;
 6070|       |#else
 6071|       |        // A bare LF does not end the line; keep looking for CRLF. The CR may
 6072|       |        // be the last byte of an earlier chunk, hence prev_byte.
 6073|      0|        if ((pos > 0 ? buffered[pos - 1] : prev_byte) == '\r') {
  ------------------
  |  Branch (6073:13): [True: 0, False: 0]
  |  Branch (6073:14): [True: 0, False: 0]
  ------------------
 6074|      0|          take = pos + 1;
 6075|      0|          terminated = true;
 6076|      0|          break;
 6077|      0|        }
 6078|      0|        at = pos + 1;
 6079|      0|#endif
 6080|      0|      }
 6081|       |
 6082|      0|      if (size() + take > CPPHTTPLIB_MAX_LINE_LENGTH) { return false; }
  ------------------
  |  |  211|      0|#define CPPHTTPLIB_MAX_LINE_LENGTH 32768
  ------------------
  |  Branch (6082:11): [True: 0, False: 0]
  ------------------
 6083|      0|#ifndef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6084|      0|      prev_byte = buffered[take - 1];
 6085|      0|#endif
 6086|      0|      append(buffered, take);
 6087|      0|      strm_.consume_buffered(take);
 6088|      0|      i += take;
 6089|      0|      if (terminated) { return true; }
  ------------------
  |  Branch (6089:11): [True: 0, False: 0]
  ------------------
 6090|      0|      continue;
 6091|      0|    }
 6092|       |
 6093|  3.57M|    if (size() >= CPPHTTPLIB_MAX_LINE_LENGTH) {
  ------------------
  |  |  211|  3.57M|#define CPPHTTPLIB_MAX_LINE_LENGTH 32768
  ------------------
  |  Branch (6093:9): [True: 3, False: 3.57M]
  ------------------
 6094|       |      // Treat exceptionally long lines as an error to
 6095|       |      // prevent infinite loops/memory exhaustion
 6096|      3|      return false;
 6097|      3|    }
 6098|  3.57M|    char byte;
 6099|  3.57M|    auto n = strm_.read(&byte, 1);
 6100|       |
 6101|  3.57M|    if (n < 0) {
  ------------------
  |  Branch (6101:9): [True: 0, False: 3.57M]
  ------------------
 6102|      0|      return false;
 6103|  3.57M|    } else if (n == 0) {
  ------------------
  |  Branch (6103:16): [True: 1.36k, False: 3.57M]
  ------------------
 6104|  1.36k|      if (i == 0) {
  ------------------
  |  Branch (6104:11): [True: 479, False: 890]
  ------------------
 6105|    479|        return false;
 6106|    890|      } else {
 6107|    890|        break;
 6108|    890|      }
 6109|  1.36k|    }
 6110|       |
 6111|  3.57M|    append(byte);
 6112|       |
 6113|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6114|       |    if (byte == '\n') { break; }
 6115|       |#else
 6116|  3.57M|    if (prev_byte == '\r' && byte == '\n') { break; }
  ------------------
  |  Branch (6116:9): [True: 38.1k, False: 3.53M]
  |  Branch (6116:30): [True: 37.5k, False: 571]
  ------------------
 6117|  3.53M|    prev_byte = byte;
 6118|  3.53M|#endif
 6119|  3.53M|  }
 6120|       |
 6121|  38.4k|  return true;
 6122|  38.9k|}
_ZNK7httplib6detail18stream_line_reader4sizeEv:
 6031|  3.64M|inline size_t stream_line_reader::size() const {
 6032|  3.64M|  if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6032:7): [True: 1.84M, False: 1.80M]
  ------------------
 6033|  1.84M|    return fixed_buffer_used_size_;
 6034|  1.84M|  } else {
 6035|  1.80M|    return growable_buffer_.size();
 6036|  1.80M|  }
 6037|  3.64M|}
_ZN7httplib6detail18stream_line_reader6appendEPKcm:
 6126|  3.57M|inline void stream_line_reader::append(const char *data, size_t size) {
 6127|       |  // Once the line has outgrown the fixed buffer everything must keep going to
 6128|       |  // the growable one, even if a later chunk would have fit. Without the
 6129|       |  // emptiness check a short append after a long one would land in the fixed
 6130|       |  // buffer, which ptr() and size() no longer look at, and be lost.
 6131|  3.57M|  if (growable_buffer_.empty() &&
  ------------------
  |  Branch (6131:7): [True: 1.77M, False: 1.79M]
  ------------------
 6132|  1.77M|      fixed_buffer_used_size_ + size < fixed_buffer_size_) {
  ------------------
  |  Branch (6132:7): [True: 1.77M, False: 943]
  ------------------
 6133|  1.77M|    memcpy(fixed_buffer_ + fixed_buffer_used_size_, data, size);
 6134|  1.77M|    fixed_buffer_used_size_ += size;
 6135|  1.77M|    fixed_buffer_[fixed_buffer_used_size_] = '\0';
 6136|  1.79M|  } else {
 6137|       |    // Unlike the per-character overload, this can be the very first append of
 6138|       |    // the line, so the fixed buffer may hold nothing and carry no terminator
 6139|       |    // yet. assign() takes an explicit length and does not need one.
 6140|  1.79M|    if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6140:9): [True: 943, False: 1.79M]
  ------------------
 6141|    943|      growable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_);
 6142|    943|    }
 6143|  1.79M|    growable_buffer_.append(data, size);
 6144|  1.79M|  }
 6145|  3.57M|}
_ZN7httplib6detail18stream_line_reader6appendEc:
 6124|  3.57M|inline void stream_line_reader::append(char c) { append(&c, 1); }
_ZN7httplib6detail17parse_status_lineEPKcRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERiSA_:
 8068|  8.84k|                              int &status, std::string &reason) {
 8069|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 8070|       |  thread_local const std::regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r?\n");
 8071|       |#else
 8072|  8.84k|  thread_local const std::regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r\n");
 8073|  8.84k|#endif
 8074|       |
 8075|  8.84k|  std::cmatch m;
 8076|  8.84k|  if (!std::regex_match(line, m, re)) { return false; }
  ------------------
  |  Branch (8076:7): [True: 357, False: 8.48k]
  ------------------
 8077|  8.48k|  version = std::string(m[1]);
 8078|  8.48k|  status = std::stoi(std::string(m[2]));
 8079|  8.48k|  reason = std::string(m[3]);
 8080|  8.48k|  return true;
 8081|  8.84k|}
_ZNK7httplib6detail18stream_line_reader3ptrEv:
 6023|  61.5k|inline const char *stream_line_reader::ptr() const {
 6024|  61.5k|  if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6024:7): [True: 58.8k, False: 2.64k]
  ------------------
 6025|  58.8k|    return fixed_buffer_;
 6026|  58.8k|  } else {
 6027|  2.64k|    return growable_buffer_.data();
 6028|  2.64k|  }
 6029|  61.5k|}
_ZN7httplib10ClientImpl18write_request_bodyERNS_6StreamERNS_7RequestERNS_5ErrorE:
15664|  3.10k|                                           Error &error) {
15665|  3.10k|  if (req.body.empty()) {
  ------------------
  |  Branch (15665:7): [True: 3.10k, False: 0]
  ------------------
15666|  3.10k|    return write_content_with_provider(strm, req, error);
15667|  3.10k|  }
15668|       |
15669|      0|  if (req.upload_progress) {
  ------------------
  |  Branch (15669:7): [True: 0, False: 0]
  ------------------
15670|      0|    auto body_size = req.body.size();
15671|      0|    size_t written = 0;
15672|      0|    auto data = req.body.data();
15673|       |
15674|      0|    while (written < body_size) {
  ------------------
  |  Branch (15674:12): [True: 0, False: 0]
  ------------------
15675|      0|      size_t to_write = (std::min)(CPPHTTPLIB_SEND_BUFSIZ, body_size - written);
  ------------------
  |  |  176|      0|#define CPPHTTPLIB_SEND_BUFSIZ size_t(16384u)
  ------------------
15676|      0|      if (!detail::write_data(strm, data + written, to_write)) {
  ------------------
  |  Branch (15676:11): [True: 0, False: 0]
  ------------------
15677|      0|        error = Error::Write;
15678|      0|        output_error_log(error, &req);
15679|      0|        return false;
15680|      0|      }
15681|      0|      written += to_write;
15682|       |
15683|      0|      if (!req.upload_progress(written, body_size)) {
  ------------------
  |  Branch (15683:11): [True: 0, False: 0]
  ------------------
15684|      0|        error = Error::Canceled;
15685|      0|        output_error_log(error, &req);
15686|      0|        return false;
15687|      0|      }
15688|      0|    }
15689|      0|  } else {
15690|      0|    if (!detail::write_data(strm, req.body.data(), req.body.size())) {
  ------------------
  |  Branch (15690:9): [True: 0, False: 0]
  ------------------
15691|      0|      error = Error::Write;
15692|      0|      output_error_log(error, &req);
15693|      0|      return false;
15694|      0|    }
15695|      0|  }
15696|       |
15697|      0|  return true;
15698|      0|}
_ZNK7httplib10ClientImpl27write_content_with_providerERNS_6StreamERKNS_7RequestERNS_5ErrorE:
15480|  3.10k|                                                    Error &error) const {
15481|  3.10k|  auto is_shutting_down = []() { return false; };
15482|       |
15483|  3.10k|  if (req.is_chunked_content_provider_) {
  ------------------
  |  Branch (15483:7): [True: 0, False: 3.10k]
  ------------------
15484|      0|    auto compressor = compress_ ? detail::create_compressor().first
  ------------------
  |  Branch (15484:23): [True: 0, False: 0]
  ------------------
15485|      0|                                : std::unique_ptr<detail::compressor>();
15486|      0|    if (!compressor) {
  ------------------
  |  Branch (15486:9): [True: 0, False: 0]
  ------------------
15487|      0|      compressor = detail::make_unique<detail::nocompressor>();
15488|      0|    }
15489|       |
15490|      0|    return detail::write_content_chunked(strm, req.content_provider_,
15491|      0|                                         is_shutting_down, *compressor, error);
15492|  3.10k|  } else {
15493|  3.10k|    return detail::write_content_with_progress(
15494|  3.10k|        strm, req.content_provider_, 0, req.content_length_, is_shutting_down,
15495|  3.10k|        req.upload_progress, error);
15496|  3.10k|  }
15497|  3.10k|}
_ZN7httplib8DataSinkC2Ev:
 1434|  3.10k|  DataSink() : os(&sb_), sb_(*this) {}
_ZN7httplib8DataSink19data_sink_streambufC2ERS0_:
 1457|  3.10k|    explicit data_sink_streambuf(DataSink &sink) : sink_(sink) {}
_ZN7httplib6detail27write_content_with_progressIZNKS_10ClientImpl27write_content_with_providerERNS_6StreamERKNS_7RequestERNS_5ErrorEEUlvE_EEbS4_RKNSt3__18functionIFbmmRNS_8DataSinkEEEEmmT_RKNSC_IFbmmEEES9_:
 8475|  3.10k|                                        Error &error) {
 8476|  3.10k|  size_t end_offset = offset + length;
 8477|  3.10k|  size_t start_offset = offset;
 8478|  3.10k|  auto ok = true;
 8479|  3.10k|  auto finished = false;
 8480|  3.10k|  DataSink data_sink;
 8481|       |
 8482|  3.10k|  data_sink.write = [&](const char *d, size_t l) -> bool {
 8483|  3.10k|    if (ok) {
 8484|  3.10k|      if (write_data(strm, d, l)) {
 8485|  3.10k|        offset += l;
 8486|       |
 8487|  3.10k|        if (upload_progress && length > 0) {
 8488|  3.10k|          size_t current_written = offset - start_offset;
 8489|  3.10k|          if (!upload_progress(current_written, length)) {
 8490|  3.10k|            ok = false;
 8491|  3.10k|            return false;
 8492|  3.10k|          }
 8493|  3.10k|        }
 8494|  3.10k|      } else {
 8495|  3.10k|        ok = false;
 8496|  3.10k|      }
 8497|  3.10k|    }
 8498|  3.10k|    return ok;
 8499|  3.10k|  };
 8500|       |
 8501|  3.10k|  data_sink.is_writable = [&]() -> bool { return strm.is_peer_alive(); };
 8502|       |
 8503|       |  // The body is framed by `length`, so a provider that reports itself done
 8504|       |  // early has truncated it. Record that and let the short-body check below
 8505|       |  // fail the write, rather than calling the provider again forever.
 8506|  3.10k|  data_sink.done = [&]() { finished = true; };
 8507|       |
 8508|  3.10k|  while (offset < end_offset && !finished && !is_shutting_down()) {
  ------------------
  |  Branch (8508:10): [True: 0, False: 3.10k]
  |  Branch (8508:33): [True: 0, False: 0]
  |  Branch (8508:46): [True: 0, False: 0]
  ------------------
 8509|      0|    auto last_offset = offset;
 8510|       |
 8511|      0|    if (!strm.wait_writable() || !strm.is_peer_alive()) {
  ------------------
  |  Branch (8511:9): [True: 0, False: 0]
  |  Branch (8511:34): [True: 0, False: 0]
  ------------------
 8512|      0|      error = Error::Write;
 8513|      0|      return false;
 8514|      0|    } else if (!content_provider(offset, end_offset - offset, data_sink)) {
  ------------------
  |  Branch (8514:16): [True: 0, False: 0]
  ------------------
 8515|      0|      error = Error::Canceled;
 8516|      0|      return false;
 8517|      0|    } else if (!ok) {
  ------------------
  |  Branch (8517:16): [True: 0, False: 0]
  ------------------
 8518|      0|      error = Error::Write;
 8519|      0|      return false;
 8520|      0|    }
 8521|       |
 8522|       |    // A provider that reports success without writing anything and without
 8523|       |    // reporting itself done gets handed the same offset and length again on
 8524|       |    // the next pass, so it would spin here for as long as the peer stays
 8525|       |    // connected. Treat making no progress as a short body, like done() early.
 8526|      0|    if (!finished && offset == last_offset) {
  ------------------
  |  Branch (8526:9): [True: 0, False: 0]
  |  Branch (8526:22): [True: 0, False: 0]
  ------------------
 8527|      0|      error = Error::Write;
 8528|      0|      return false;
 8529|      0|    }
 8530|      0|  }
 8531|       |
 8532|  3.10k|  if (offset < end_offset) { // done() called early, or is_shutting_down()
  ------------------
  |  Branch (8532:7): [True: 0, False: 3.10k]
  ------------------
 8533|      0|    error = Error::Write;
 8534|      0|    return false;
 8535|      0|  }
 8536|       |
 8537|  3.10k|  error = Error::Success;
 8538|  3.10k|  return true;
 8539|  3.10k|}
_ZN7httplib6detail12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEE:
 8011|  2.66k|inline bool read_headers(Stream &strm, Headers &headers) {
 8012|  2.66k|  const auto bufsiz = 2048;
 8013|  2.66k|  char buf[bufsiz];
 8014|  2.66k|  stream_line_reader line_reader(strm, buf, bufsiz);
 8015|       |
 8016|  2.66k|  size_t header_count = 0;
 8017|       |
 8018|  12.9k|  for (;;) {
 8019|  12.9k|    if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (8019:9): [True: 295, False: 12.6k]
  ------------------
 8020|       |
 8021|       |    // Check if the line ends with CRLF.
 8022|  12.6k|    auto line_terminator_len = 2;
 8023|  12.6k|    if (line_reader.end_with_crlf()) {
  ------------------
  |  Branch (8023:9): [True: 12.5k, False: 68]
  ------------------
 8024|       |      // Blank line indicates end of headers.
 8025|  12.5k|      if (line_reader.size() == 2) { break; }
  ------------------
  |  Branch (8025:11): [True: 2.00k, False: 10.5k]
  ------------------
 8026|  12.5k|    } else {
 8027|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 8028|       |      // Blank line indicates end of headers.
 8029|       |      if (line_reader.size() == 1) { break; }
 8030|       |      line_terminator_len = 1;
 8031|       |#else
 8032|     68|      continue; // Skip invalid line.
 8033|     68|#endif
 8034|     68|    }
 8035|       |
 8036|  10.5k|    if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; }
  ------------------
  |  |  114|  10.5k|#define CPPHTTPLIB_HEADER_MAX_LENGTH 8192
  ------------------
  |  Branch (8036:9): [True: 4, False: 10.5k]
  ------------------
 8037|       |
 8038|       |    // Check header count limit
 8039|  10.5k|    if (header_count >= CPPHTTPLIB_HEADER_MAX_COUNT) { return false; }
  ------------------
  |  |  118|  10.5k|#define CPPHTTPLIB_HEADER_MAX_COUNT 100
  ------------------
  |  Branch (8039:9): [True: 1, False: 10.5k]
  ------------------
 8040|       |
 8041|       |    // Exclude line terminator
 8042|  10.5k|    auto end = line_reader.ptr() + line_reader.size() - line_terminator_len;
 8043|       |
 8044|  10.5k|    if (!parse_header(line_reader.ptr(), end,
  ------------------
  |  Branch (8044:9): [True: 352, False: 10.1k]
  ------------------
 8045|  10.5k|                      [&](const std::string &key, const std::string &val) {
 8046|  10.5k|                        headers.emplace(key, val);
 8047|  10.5k|                      })) {
 8048|    352|      return false;
 8049|    352|    }
 8050|       |
 8051|  10.1k|    header_count++;
 8052|  10.1k|  }
 8053|       |
 8054|       |  // RFC 9110 Section 8.6: Reject requests with multiple Content-Length
 8055|       |  // headers that have different values to prevent request smuggling.
 8056|  2.00k|  auto cl_range = headers.equal_range("Content-Length");
 8057|  2.00k|  if (cl_range.first != cl_range.second) {
  ------------------
  |  Branch (8057:7): [True: 806, False: 1.20k]
  ------------------
 8058|    806|    const auto &first_val = cl_range.first->second;
 8059|  1.39k|    for (auto it = std::next(cl_range.first); it != cl_range.second; ++it) {
  ------------------
  |  Branch (8059:47): [True: 772, False: 626]
  ------------------
 8060|    772|      if (it->second != first_val) { return false; }
  ------------------
  |  Branch (8060:11): [True: 180, False: 592]
  ------------------
 8061|    772|    }
 8062|    806|  }
 8063|       |
 8064|  1.82k|  return true;
 8065|  2.00k|}
_ZNK7httplib6detail18stream_line_reader13end_with_crlfEv:
 6039|  12.6k|inline bool stream_line_reader::end_with_crlf() const {
 6040|  12.6k|  auto end = ptr() + size();
 6041|  12.6k|  return size() >= 2 && end[-2] == '\r' && end[-1] == '\n';
  ------------------
  |  Branch (6041:10): [True: 12.5k, False: 31]
  |  Branch (6041:25): [True: 12.5k, False: 20]
  |  Branch (6041:44): [True: 12.5k, False: 17]
  ------------------
 6042|  12.6k|}
_ZN7httplib6detail12parse_headerIZNS0_12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS0_11case_ignore8equal_toEEEEUlRKSB_SH_E_EEbPKcSK_T_:
 5732|  10.5k|inline bool parse_header(const char *beg, const char *end, T fn) {
 5733|       |  // Skip trailing spaces and tabs.
 5734|  10.8k|  while (beg < end && is_space_or_tab(end[-1])) {
  ------------------
  |  Branch (5734:10): [True: 10.7k, False: 15]
  |  Branch (5734:23): [True: 264, False: 10.5k]
  ------------------
 5735|    264|    end--;
 5736|    264|  }
 5737|       |
 5738|  10.5k|  auto p = beg;
 5739|   213k|  while (p < end && *p != ':') {
  ------------------
  |  Branch (5739:10): [True: 213k, False: 280]
  |  Branch (5739:21): [True: 203k, False: 10.2k]
  ------------------
 5740|   203k|    p++;
 5741|   203k|  }
 5742|       |
 5743|  10.5k|  auto name = std::string(beg, p);
 5744|  10.5k|  if (!detail::fields::is_field_name(name)) { return false; }
  ------------------
  |  Branch (5744:7): [True: 125, False: 10.4k]
  ------------------
 5745|       |
 5746|  10.4k|  if (p == end) { return false; }
  ------------------
  |  Branch (5746:7): [True: 182, False: 10.2k]
  ------------------
 5747|       |
 5748|  10.2k|  auto key_end = p;
 5749|       |
 5750|  10.2k|  if (*p++ != ':') { return false; }
  ------------------
  |  Branch (5750:7): [True: 0, False: 10.2k]
  ------------------
 5751|       |
 5752|  10.6k|  while (p < end && is_space_or_tab(*p)) {
  ------------------
  |  Branch (5752:10): [True: 4.39k, False: 6.21k]
  |  Branch (5752:21): [True: 371, False: 4.01k]
  ------------------
 5753|    371|    p++;
 5754|    371|  }
 5755|       |
 5756|  10.2k|  if (p <= end) {
  ------------------
  |  Branch (5756:7): [True: 10.2k, False: 0]
  ------------------
 5757|  10.2k|    auto key_len = key_end - beg;
 5758|  10.2k|    if (!key_len) { return false; }
  ------------------
  |  Branch (5758:9): [True: 0, False: 10.2k]
  ------------------
 5759|       |
 5760|  10.2k|    auto key = std::string(beg, key_end);
 5761|  10.2k|    auto val = std::string(p, end);
 5762|       |
 5763|  10.2k|    if (!detail::fields::is_field_value(val)) { return false; }
  ------------------
  |  Branch (5763:9): [True: 45, False: 10.1k]
  ------------------
 5764|       |
 5765|       |    // RFC 9110 §5.5: header field values are opaque octets and MUST NOT be
 5766|       |    // percent-decoded by the recipient. Applications that need to interpret a
 5767|       |    // value as a URI component should call httplib::decode_uri_component()
 5768|       |    // (or decode_path_component()) explicitly.
 5769|  10.1k|    fn(key, val);
 5770|       |
 5771|  10.1k|    return true;
 5772|  10.2k|  }
 5773|       |
 5774|      0|  return false;
 5775|  10.2k|}
_ZZN7httplib6detail12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEEENKUlRKSA_SG_E_clESG_SG_:
 8045|  10.1k|                      [&](const std::string &key, const std::string &val) {
 8046|  10.1k|                        headers.emplace(key, val);
 8047|  10.1k|                      })) {
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE11equal_rangeERKS8_:
 1191|  2.00k|  std::pair<iterator, iterator> equal_range(const std::string &key) {
 1192|  2.00k|    auto i = index_of(key);
 1193|  2.00k|    return i == npos() ? std::make_pair(end(), end())
  ------------------
  |  Branch (1193:12): [True: 1.20k, False: 806]
  ------------------
 1194|  2.00k|                       : std::make_pair(make_iter(i, i), end());
 1195|  2.00k|  }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tINS2_4pairIS8_S8_EEEptEv:
 1064|  1.57k|    pointer operator->() const { return data_ + idx_; }
_ZNK7httplib10ClientImpl16output_error_logERKNS_5ErrorEPKNS_7RequestE:
15844|  2.61k|                                         const Request *req) const {
15845|  2.61k|  if (error_logger_) {
  ------------------
  |  Branch (15845:7): [True: 0, False: 2.61k]
  ------------------
15846|      0|    std::lock_guard<std::mutex> guard(logger_mutex_);
15847|      0|    error_logger_(err, req);
15848|      0|  }
15849|  2.61k|}
_ZZN7httplib10ClientImpl15process_requestERNS_6StreamERNS_7RequestERNS_8ResponseEbRNS_5ErrorEENKUlPKcmmmE0_clESA_mmm:
15970|   131k|                      size_t /*len*/) {
15971|   131k|                    assert(res.body.size() + n <= res.body.max_size());
  ------------------
  |  Branch (15971:21): [True: 131k, False: 0]
  ------------------
15972|   131k|                    if (payload_max_length_ > 0 &&
  ------------------
  |  Branch (15972:25): [True: 131k, False: 0]
  ------------------
15973|   131k|                        (res.body.size() >= payload_max_length_ ||
  ------------------
  |  Branch (15973:26): [True: 0, False: 131k]
  ------------------
15974|   131k|                         n > payload_max_length_ - res.body.size())) {
  ------------------
  |  Branch (15974:26): [True: 0, False: 131k]
  ------------------
15975|      0|                      return false;
15976|      0|                    }
15977|   131k|                    res.body.append(buf, n);
15978|   131k|                    return true;
15979|   131k|                  });
_ZNK7httplib8Response10has_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
11469|  1.81k|inline bool Response::has_header(const std::string &key) const {
11470|  1.81k|  return headers.find(key) != headers.end();
11471|  1.81k|}
_ZNK7httplib8Response20get_header_value_u64ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmm:
11465|    625|                                             size_t id) const {
11466|    625|  return detail::get_header_value_u64(headers, key, def, id);
11467|    625|}
_ZN7httplib6detail20get_header_value_u64ERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_mm:
 3428|    625|                                   size_t id) {
 3429|    625|  auto dummy = false;
 3430|    625|  return get_header_value_u64(headers, key, def, id, dummy);
 3431|    625|}
_ZN7httplib6detail20get_header_value_u64ERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_mmRb:
 3400|  1.16k|                                   size_t id, bool &is_invalid_value) {
 3401|  1.16k|  is_invalid_value = false;
 3402|  1.16k|  auto rng = headers.equal_range(key);
 3403|  1.16k|  auto it = rng.first;
 3404|  1.16k|  std::advance(it, static_cast<ssize_t>(id));
 3405|  1.16k|  if (it != rng.second) {
  ------------------
  |  Branch (3405:7): [True: 1.16k, False: 0]
  ------------------
 3406|  1.16k|    if (is_numeric(it->second)) {
  ------------------
  |  Branch (3406:9): [True: 1.00k, False: 162]
  ------------------
 3407|       |      // Parse at size_t width so an out-of-range Content-Length is reported
 3408|       |      // rather than silently saturated/truncated (a value above 2^32 would
 3409|       |      // otherwise wrap to a small framing length on 32-bit builds). Flag it
 3410|       |      // and return SIZE_MAX so the existing oversized-value guards reject it.
 3411|  1.00k|      size_t val = 0;
 3412|  1.00k|      const auto &s = it->second;
 3413|  1.00k|      auto r = from_chars(s.data(), s.data() + s.size(), val);
 3414|  1.00k|      if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (3414:11): [True: 62, False: 942]
  ------------------
 3415|     62|        is_invalid_value = true;
 3416|     62|        return (std::numeric_limits<size_t>::max)();
 3417|     62|      }
 3418|    942|      return val;
 3419|  1.00k|    } else {
 3420|    162|      is_invalid_value = true;
 3421|    162|    }
 3422|  1.16k|  }
 3423|    162|  return def;
 3424|  1.16k|}
_ZN7httplib6detail10is_numericERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 3394|  1.16k|inline bool is_numeric(const std::string &str) {
 3395|  1.16k|  return !str.empty() && std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
  ------------------
  |  Branch (3395:10): [True: 1.02k, False: 140]
  |  Branch (3395:26): [True: 1.00k, False: 22]
  ------------------
 3396|  1.16k|}
_ZN7httplib6detail10from_charsImEENS0_17from_chars_resultIT_EEPKcS6_RS3_i:
  700|  1.00k|                                       T &value, int base = 10) {
  701|  1.00k|  value = 0;
  702|  1.00k|  const char *p = first;
  703|  1.00k|  bool negative = false;
  704|       |
  705|  1.00k|  if (p != last && *p == '-') {
  ------------------
  |  Branch (705:7): [True: 1.00k, False: 0]
  |  Branch (705:20): [True: 0, False: 1.00k]
  ------------------
  706|      0|    negative = true;
  707|      0|    ++p;
  708|      0|  }
  709|  1.00k|  if (p == last) { return {first, std::errc::invalid_argument}; }
  ------------------
  |  Branch (709:7): [True: 0, False: 1.00k]
  ------------------
  710|       |
  711|  1.00k|  T result = 0;
  712|  14.6k|  for (; p != last; ++p) {
  ------------------
  |  Branch (712:10): [True: 13.7k, False: 942]
  ------------------
  713|  13.7k|    char c = *p;
  714|  13.7k|    int digit = -1;
  715|  13.7k|    if (is_ascii_digit(c)) {
  ------------------
  |  Branch (715:9): [True: 13.7k, False: 0]
  ------------------
  716|  13.7k|      digit = c - '0';
  717|  13.7k|    } else if ('a' <= c && c <= 'z') {
  ------------------
  |  Branch (717:16): [True: 0, False: 0]
  |  Branch (717:28): [True: 0, False: 0]
  ------------------
  718|      0|      digit = c - 'a' + 10;
  719|      0|    } else if ('A' <= c && c <= 'Z') {
  ------------------
  |  Branch (719:16): [True: 0, False: 0]
  |  Branch (719:28): [True: 0, False: 0]
  ------------------
  720|      0|      digit = c - 'A' + 10;
  721|      0|    } else {
  722|      0|      break;
  723|      0|    }
  724|       |
  725|  13.7k|    if (digit < 0 || digit >= base) { break; }
  ------------------
  |  Branch (725:9): [True: 0, False: 13.7k]
  |  Branch (725:22): [True: 0, False: 13.7k]
  ------------------
  726|  13.7k|    if (result > ((std::numeric_limits<T>::max)() - digit) / base) {
  ------------------
  |  Branch (726:9): [True: 62, False: 13.6k]
  ------------------
  727|     62|      return {p, std::errc::result_out_of_range};
  728|     62|    }
  729|  13.6k|    result = result * base + digit;
  730|  13.6k|  }
  731|       |
  732|    942|  if (p == first || (negative && p == first + 1)) {
  ------------------
  |  Branch (732:7): [True: 0, False: 942]
  |  Branch (732:22): [True: 0, False: 942]
  |  Branch (732:34): [True: 0, False: 0]
  ------------------
  733|      0|    return {first, std::errc::invalid_argument};
  734|      0|  }
  735|       |
  736|    942|  value = negative ? T(0) - result : result;
  ------------------
  |  Branch (736:11): [True: 0, False: 942]
  ------------------
  737|    942|  return {p, std::errc{}};
  738|    942|}
_ZN7httplib6detail12read_contentINS_8ResponseEEEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENS9_IFbPKcmmmEEEb:
 8351|  1.73k|                  ContentReceiverWithProgress receiver, bool decompress) {
 8352|  1.73k|  bool exceed_payload_max_length = false;
 8353|  1.73k|  return prepare_content_receiver(
 8354|  1.73k|      x, status, std::move(receiver), decompress, payload_max_length,
 8355|  1.73k|      exceed_payload_max_length, [&](const ContentReceiverWithProgress &out) {
 8356|  1.73k|        auto ret = true;
 8357|       |        // Note: exceed_payload_max_length may also be set by the decompressor
 8358|       |        // wrapper in prepare_content_receiver when the decompressed payload
 8359|       |        // size exceeds the limit.
 8360|       |
 8361|  1.73k|        if (is_chunked_transfer_encoding(x.headers)) {
 8362|  1.73k|          auto result = read_content_chunked(strm, x, payload_max_length, out);
 8363|  1.73k|          if (result == ReadContentResult::Success) {
 8364|  1.73k|            ret = true;
 8365|  1.73k|          } else if (result == ReadContentResult::PayloadTooLarge) {
 8366|  1.73k|            exceed_payload_max_length = true;
 8367|  1.73k|            ret = false;
 8368|  1.73k|          } else {
 8369|  1.73k|            ret = false;
 8370|  1.73k|          }
 8371|  1.73k|        } else if (!has_header(x.headers, "Content-Length")) {
 8372|  1.73k|          auto result =
 8373|  1.73k|              read_content_without_length(strm, payload_max_length, out);
 8374|  1.73k|          if (result == ReadContentResult::Success) {
 8375|  1.73k|            ret = true;
 8376|  1.73k|          } else if (result == ReadContentResult::PayloadTooLarge) {
 8377|  1.73k|            exceed_payload_max_length = true;
 8378|  1.73k|            ret = false;
 8379|  1.73k|          } else {
 8380|  1.73k|            ret = false;
 8381|  1.73k|          }
 8382|  1.73k|        } else {
 8383|  1.73k|          auto is_invalid_value = false;
 8384|  1.73k|          auto len = get_header_value_u64(x.headers, "Content-Length",
 8385|  1.73k|                                          (std::numeric_limits<size_t>::max)(),
 8386|  1.73k|                                          0, is_invalid_value);
 8387|       |
 8388|  1.73k|          if (is_invalid_value) {
 8389|  1.73k|            ret = false;
 8390|  1.73k|          } else if (len > 0) {
 8391|  1.73k|            auto result = read_content_with_length(
 8392|  1.73k|                strm, len, std::move(progress), out, payload_max_length);
 8393|  1.73k|            ret = (result == ReadContentResult::Success);
 8394|  1.73k|            if (result == ReadContentResult::PayloadTooLarge) {
 8395|  1.73k|              exceed_payload_max_length = true;
 8396|  1.73k|            }
 8397|  1.73k|          }
 8398|  1.73k|        }
 8399|       |
 8400|  1.73k|        if (!ret) {
 8401|  1.73k|          status = exceed_payload_max_length ? StatusCode::PayloadTooLarge_413
 8402|  1.73k|                                             : StatusCode::BadRequest_400;
 8403|  1.73k|        }
 8404|  1.73k|        return ret;
 8405|  1.73k|      });
 8406|  1.73k|}
_ZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_:
 8297|  1.73k|                              bool &exceed_payload_max_length, U callback) {
 8298|  1.73k|  if (decompress) {
  ------------------
  |  Branch (8298:7): [True: 1.73k, False: 0]
  ------------------
 8299|  1.73k|    auto encoding = get_combined_header_value(x.headers, "Content-Encoding");
 8300|  1.73k|    std::unique_ptr<decompressor> decompressor;
 8301|       |
 8302|  1.73k|    if (!encoding.empty()) {
  ------------------
  |  Branch (8302:9): [True: 182, False: 1.55k]
  ------------------
 8303|       |      // A coding we know about but were not built with is an error. An
 8304|       |      // unrecognized coding (including "identity") is left alone and the
 8305|       |      // payload is passed through as-is, since some servers misuse the header,
 8306|       |      // e.g. by sending a character set such as "Content-Encoding: UTF-8".
 8307|    182|      decompressor = detail::create_decompressor(encoding);
 8308|    182|      if (!decompressor && detail::is_known_content_encoding(encoding)) {
  ------------------
  |  Branch (8308:11): [True: 43, False: 139]
  |  Branch (8308:28): [True: 2, False: 41]
  ------------------
 8309|      2|        status = StatusCode::UnsupportedMediaType_415;
 8310|      2|        return false;
 8311|      2|      }
 8312|    182|    }
 8313|       |
 8314|  1.73k|    if (decompressor) {
  ------------------
  |  Branch (8314:9): [True: 139, False: 1.59k]
  ------------------
 8315|    139|      if (decompressor->is_valid()) {
  ------------------
  |  Branch (8315:11): [True: 139, False: 0]
  ------------------
 8316|    139|        size_t decompressed_size = 0;
 8317|    139|        ContentReceiverWithProgress out = [&](const char *buf, size_t n,
 8318|    139|                                              size_t off, size_t len) {
 8319|    139|          return decompressor->decompress(
 8320|    139|              buf, n, [&](const char *buf2, size_t n2) {
 8321|       |                // Guard against zip-bomb: check
 8322|       |                // decompressed size against limit.
 8323|    139|                if (payload_max_length > 0 &&
 8324|    139|                    (decompressed_size >= payload_max_length ||
 8325|    139|                     n2 > payload_max_length - decompressed_size)) {
 8326|    139|                  exceed_payload_max_length = true;
 8327|    139|                  return false;
 8328|    139|                }
 8329|    139|                decompressed_size += n2;
 8330|    139|                return receiver(buf2, n2, off, len);
 8331|    139|              });
 8332|    139|        };
 8333|    139|        return callback(std::move(out));
 8334|    139|      } else {
 8335|      0|        status = StatusCode::InternalServerError_500;
 8336|      0|        return false;
 8337|      0|      }
 8338|    139|    }
 8339|  1.73k|  }
 8340|       |
 8341|  1.59k|  ContentReceiverWithProgress out = [&](const char *buf, size_t n, size_t off,
 8342|  1.59k|                                        size_t len) {
 8343|  1.59k|    return receiver(buf, n, off, len);
 8344|  1.59k|  };
 8345|  1.59k|  return callback(std::move(out));
 8346|  1.73k|}
_ZN7httplib6detail25get_combined_header_valueERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_:
 7963|  1.89k|                                             const std::string &key) {
 7964|  1.89k|  std::string combined;
 7965|  1.89k|  auto rng = headers.equal_range(key);
 7966|  3.14k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (7966:29): [True: 1.24k, False: 1.89k]
  ------------------
 7967|       |    // RFC 9110 Section 5.6.1.2: a recipient has to parse and ignore empty list
 7968|       |    // elements, so an empty field line must not contribute a bare comma to the
 7969|       |    // combined value.
 7970|  1.24k|    if (it->second.empty()) { continue; }
  ------------------
  |  Branch (7970:9): [True: 100, False: 1.14k]
  ------------------
 7971|  1.14k|    if (!combined.empty()) { combined += ", "; }
  ------------------
  |  Branch (7971:9): [True: 963, False: 182]
  ------------------
 7972|  1.14k|    combined += it->second;
 7973|  1.14k|  }
 7974|  1.89k|  return combined;
 7975|  1.89k|}
_ZN7httplib6detail19create_decompressorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7881|    182|create_decompressor(const std::string &encoding) {
 7882|    182|  std::unique_ptr<decompressor> decompressor;
 7883|       |
 7884|    182|  if (is_zlib_encoding(encoding)) {
  ------------------
  |  Branch (7884:7): [True: 139, False: 43]
  ------------------
 7885|    139|#ifdef CPPHTTPLIB_ZLIB_SUPPORT
 7886|    139|    decompressor = detail::make_unique<gzip_decompressor>();
 7887|    139|#endif
 7888|    139|  } else if (is_brotli_encoding(encoding)) {
  ------------------
  |  Branch (7888:14): [True: 1, False: 42]
  ------------------
 7889|       |#ifdef CPPHTTPLIB_BROTLI_SUPPORT
 7890|       |    decompressor = detail::make_unique<brotli_decompressor>();
 7891|       |#endif
 7892|     42|  } else if (is_zstd_encoding(encoding)) {
  ------------------
  |  Branch (7892:14): [True: 1, False: 41]
  ------------------
 7893|       |#ifdef CPPHTTPLIB_ZSTD_SUPPORT
 7894|       |    decompressor = detail::make_unique<zstd_decompressor>();
 7895|       |#endif
 7896|      1|  }
 7897|       |
 7898|    182|  return decompressor;
 7899|    182|}
_ZN7httplib6detail16is_zlib_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7860|    225|inline bool is_zlib_encoding(const std::string &encoding) {
 7861|    225|  return case_ignore::equal(encoding, "gzip") ||
  ------------------
  |  Branch (7861:10): [True: 16, False: 209]
  ------------------
 7862|    209|         case_ignore::equal(encoding, "deflate");
  ------------------
  |  Branch (7862:10): [True: 123, False: 86]
  ------------------
 7863|    225|}
_ZN7httplib6detail11make_uniqueINS0_17gzip_decompressorEJEEENSt3__19enable_ifIXntsr3std8is_arrayIT_EE5valueENS3_10unique_ptrIS5_NS3_14default_deleteIS5_EEEEE4typeEDpOT0_:
  568|    139|make_unique(Args &&...args) {
  569|    139|  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
  570|    139|}
_ZN7httplib6detail17gzip_decompressorC2Ev:
 7655|    139|inline gzip_decompressor::gzip_decompressor() {
 7656|    139|  std::memset(&strm_, 0, sizeof(strm_));
 7657|    139|  strm_.zalloc = Z_NULL;
 7658|    139|  strm_.zfree = Z_NULL;
 7659|    139|  strm_.opaque = Z_NULL;
 7660|       |
 7661|       |  // 15 is the value of wbits, which should be at the maximum possible value
 7662|       |  // to ensure that any gzip stream can be decoded. The offset of 32 specifies
 7663|       |  // that the stream type should be automatically detected either gzip or
 7664|       |  // deflate.
 7665|    139|  is_valid_ = inflateInit2(&strm_, 32 + 15) == Z_OK;
 7666|    139|}
_ZN7httplib6detail18is_brotli_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7865|     86|inline bool is_brotli_encoding(const std::string &encoding) {
 7866|     86|  return case_ignore::equal(encoding, "br");
 7867|     86|}
_ZN7httplib6detail16is_zstd_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7869|     84|inline bool is_zstd_encoding(const std::string &encoding) {
 7870|     84|  return case_ignore::equal(encoding, "zstd");
 7871|     84|}
_ZN7httplib6detail25is_known_content_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7875|     43|inline bool is_known_content_encoding(const std::string &encoding) {
 7876|     43|  return is_zlib_encoding(encoding) || is_brotli_encoding(encoding) ||
  ------------------
  |  Branch (7876:10): [True: 0, False: 43]
  |  Branch (7876:40): [True: 1, False: 42]
  ------------------
 7877|     42|         is_zstd_encoding(encoding);
  ------------------
  |  Branch (7877:10): [True: 1, False: 41]
  ------------------
 7878|     43|}
_ZZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_ENKUlSE_mmmE_clESE_mmm:
 8318|  1.99k|                                              size_t off, size_t len) {
 8319|  1.99k|          return decompressor->decompress(
 8320|  1.99k|              buf, n, [&](const char *buf2, size_t n2) {
 8321|       |                // Guard against zip-bomb: check
 8322|       |                // decompressed size against limit.
 8323|  1.99k|                if (payload_max_length > 0 &&
 8324|  1.99k|                    (decompressed_size >= payload_max_length ||
 8325|  1.99k|                     n2 > payload_max_length - decompressed_size)) {
 8326|  1.99k|                  exceed_payload_max_length = true;
 8327|  1.99k|                  return false;
 8328|  1.99k|                }
 8329|  1.99k|                decompressed_size += n2;
 8330|  1.99k|                return receiver(buf2, n2, off, len);
 8331|  1.99k|              });
 8332|  1.99k|        };
_ZZZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_ENKUlSE_mmmE_clESE_mmmENKUlSE_mE_clESE_m:
 8320|   127k|              buf, n, [&](const char *buf2, size_t n2) {
 8321|       |                // Guard against zip-bomb: check
 8322|       |                // decompressed size against limit.
 8323|   127k|                if (payload_max_length > 0 &&
  ------------------
  |  Branch (8323:21): [True: 127k, False: 0]
  ------------------
 8324|   127k|                    (decompressed_size >= payload_max_length ||
  ------------------
  |  Branch (8324:22): [True: 1, False: 127k]
  ------------------
 8325|   127k|                     n2 > payload_max_length - decompressed_size)) {
  ------------------
  |  Branch (8325:22): [True: 14, False: 127k]
  ------------------
 8326|     15|                  exceed_payload_max_length = true;
 8327|     15|                  return false;
 8328|     15|                }
 8329|   127k|                decompressed_size += n2;
 8330|   127k|                return receiver(buf2, n2, off, len);
 8331|   127k|              });
_ZZN7httplib6detail12read_contentINS_8ResponseEEEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENS9_IFbPKcmmmEEEbENKUlRKSF_E_clESH_:
 8355|  1.73k|      exceed_payload_max_length, [&](const ContentReceiverWithProgress &out) {
 8356|  1.73k|        auto ret = true;
 8357|       |        // Note: exceed_payload_max_length may also be set by the decompressor
 8358|       |        // wrapper in prepare_content_receiver when the decompressed payload
 8359|       |        // size exceeds the limit.
 8360|       |
 8361|  1.73k|        if (is_chunked_transfer_encoding(x.headers)) {
  ------------------
  |  Branch (8361:13): [True: 705, False: 1.03k]
  ------------------
 8362|    705|          auto result = read_content_chunked(strm, x, payload_max_length, out);
 8363|    705|          if (result == ReadContentResult::Success) {
  ------------------
  |  Branch (8363:15): [True: 1, False: 704]
  ------------------
 8364|      1|            ret = true;
 8365|    704|          } else if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8365:22): [True: 0, False: 704]
  ------------------
 8366|      0|            exceed_payload_max_length = true;
 8367|      0|            ret = false;
 8368|    704|          } else {
 8369|    704|            ret = false;
 8370|    704|          }
 8371|  1.03k|        } else if (!has_header(x.headers, "Content-Length")) {
  ------------------
  |  Branch (8371:20): [True: 490, False: 541]
  ------------------
 8372|    490|          auto result =
 8373|    490|              read_content_without_length(strm, payload_max_length, out);
 8374|    490|          if (result == ReadContentResult::Success) {
  ------------------
  |  Branch (8374:15): [True: 454, False: 36]
  ------------------
 8375|    454|            ret = true;
 8376|    454|          } else if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8376:22): [True: 0, False: 36]
  ------------------
 8377|      0|            exceed_payload_max_length = true;
 8378|      0|            ret = false;
 8379|     36|          } else {
 8380|     36|            ret = false;
 8381|     36|          }
 8382|    541|        } else {
 8383|    541|          auto is_invalid_value = false;
 8384|    541|          auto len = get_header_value_u64(x.headers, "Content-Length",
 8385|    541|                                          (std::numeric_limits<size_t>::max)(),
 8386|    541|                                          0, is_invalid_value);
 8387|       |
 8388|    541|          if (is_invalid_value) {
  ------------------
  |  Branch (8388:15): [True: 74, False: 467]
  ------------------
 8389|     74|            ret = false;
 8390|    467|          } else if (len > 0) {
  ------------------
  |  Branch (8390:22): [True: 457, False: 10]
  ------------------
 8391|    457|            auto result = read_content_with_length(
 8392|    457|                strm, len, std::move(progress), out, payload_max_length);
 8393|    457|            ret = (result == ReadContentResult::Success);
 8394|    457|            if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8394:17): [True: 0, False: 457]
  ------------------
 8395|      0|              exceed_payload_max_length = true;
 8396|      0|            }
 8397|    457|          }
 8398|    541|        }
 8399|       |
 8400|  1.73k|        if (!ret) {
  ------------------
  |  Branch (8400:13): [True: 1.27k, False: 466]
  ------------------
 8401|  1.27k|          status = exceed_payload_max_length ? StatusCode::PayloadTooLarge_413
  ------------------
  |  Branch (8401:20): [True: 15, False: 1.25k]
  ------------------
 8402|  1.27k|                                             : StatusCode::BadRequest_400;
 8403|  1.27k|        }
 8404|  1.73k|        return ret;
 8405|  1.73k|      });
_ZN7httplib6detail28is_chunked_transfer_encodingERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEE:
 8261|  1.73k|inline bool is_chunked_transfer_encoding(const Headers &headers) {
 8262|       |  // RFC 9112 6.1: a message is framed with the chunked coding when "chunked"
 8263|       |  // is the final transfer coding. A single field value may list several
 8264|       |  // codings ("gzip, chunked"), and RFC 9110 5.3 lets that list be split across
 8265|       |  // several Transfer-Encoding lines, which combine into one comma-separated
 8266|       |  // list in the order the lines were received. Headers preserves that order,
 8267|       |  // so the final coding is the last token of the last line. Match it
 8268|       |  // case-insensitively rather than comparing the whole value against
 8269|       |  // "chunked".
 8270|       |  //
 8271|       |  // Security: reading a chunked message as unframed leaves its body in the
 8272|       |  // socket, where a keep-alive connection parses it as a smuggled request.
 8273|       |  // Server::process_request() answers 400 and closes when the final coding is
 8274|       |  // not chunked, so a request whose framing cannot be determined never
 8275|       |  // reaches the "no body" path.
 8276|  1.73k|  auto rng = headers.equal_range("Transfer-Encoding");
 8277|  1.73k|  if (rng.first == rng.second) { return false; }
  ------------------
  |  Branch (8277:7): [True: 799, False: 937]
  ------------------
 8278|       |
 8279|       |  // Cleared per line, so a trailing line carrying no coding at all leaves the
 8280|       |  // combined list ending in nothing rather than inheriting the line before it.
 8281|    937|  std::string last_coding;
 8282|       |
 8283|  2.21k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (8283:29): [True: 1.27k, False: 937]
  ------------------
 8284|  1.27k|    const auto &value = it->second;
 8285|  1.27k|    last_coding.clear();
 8286|  1.27k|    split(value.data(), value.data() + value.size(), ',',
 8287|  1.27k|          [&](const char *b, const char *e) { last_coding.assign(b, e); });
 8288|  1.27k|  }
 8289|       |
 8290|    937|  return case_ignore::equal(last_coding, "chunked");
 8291|  1.73k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEeqISF_EEbRKNSC_IT_EE:
 1103|  1.73k|    template <typename U> bool operator==(const iterator_t<U> &rhs) const {
 1104|  1.73k|      return idx_ == rhs.idx_;
 1105|  1.73k|    }
_ZZN7httplib6detail28is_chunked_transfer_encodingERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEEENKUlPKcSF_E_clESF_SF_:
 8287|  4.62k|          [&](const char *b, const char *e) { last_coding.assign(b, e); });
_ZN7httplib6detail20read_content_chunkedINS_8ResponseEEENS0_17ReadContentResultERNS_6StreamERT_mNSt3__18functionIFbPKcmmmEEE:
 8229|    705|                                              ContentReceiverWithProgress out) {
 8230|    705|  detail::ChunkedDecoder dec(strm);
 8231|       |
 8232|    705|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8233|    705|  size_t total_len = 0;
 8234|       |
 8235|  4.64k|  for (;;) {
 8236|  4.64k|    size_t chunk_offset = 0;
 8237|  4.64k|    size_t chunk_total = 0;
 8238|  4.64k|    auto n = dec.read_payload(buf, sizeof(buf), chunk_offset, chunk_total);
 8239|  4.64k|    if (n < 0) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8239:9): [True: 527, False: 4.12k]
  ------------------
 8240|       |
 8241|  4.12k|    if (n == 0) {
  ------------------
  |  Branch (8241:9): [True: 175, False: 3.94k]
  ------------------
 8242|    175|      if (!dec.parse_trailers_into(x.trailers, x.headers)) {
  ------------------
  |  Branch (8242:11): [True: 174, False: 1]
  ------------------
 8243|    174|        return ReadContentResult::Error;
 8244|    174|      }
 8245|      1|      return ReadContentResult::Success;
 8246|    175|    }
 8247|       |
 8248|  3.94k|    if (total_len > payload_max_length ||
  ------------------
  |  Branch (8248:9): [True: 0, False: 3.94k]
  ------------------
 8249|  3.94k|        payload_max_length - total_len < static_cast<size_t>(n)) {
  ------------------
  |  Branch (8249:9): [True: 0, False: 3.94k]
  ------------------
 8250|      0|      return ReadContentResult::PayloadTooLarge;
 8251|      0|    }
 8252|       |
 8253|  3.94k|    if (!out(buf, static_cast<size_t>(n), chunk_offset, chunk_total)) {
  ------------------
  |  Branch (8253:9): [True: 3, False: 3.94k]
  ------------------
 8254|      3|      return ReadContentResult::Error;
 8255|      3|    }
 8256|       |
 8257|  3.94k|    total_len += static_cast<size_t>(n);
 8258|  3.94k|  }
 8259|    705|}
_ZN7httplib6detail14ChunkedDecoderC2ERNS_6StreamE:
15135|    705|inline ChunkedDecoder::ChunkedDecoder(Stream &s) : strm(s) {}
_ZN7httplib6detail14ChunkedDecoder12read_payloadEPcmRmS3_:
15139|  4.64k|                                            size_t &out_chunk_total) {
15140|  4.64k|  if (finished) { return 0; }
  ------------------
  |  Branch (15140:7): [True: 0, False: 4.64k]
  ------------------
15141|       |
15142|  4.64k|  if (chunk_remaining == 0) {
  ------------------
  |  Branch (15142:7): [True: 4.05k, False: 598]
  ------------------
15143|  4.05k|    stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15144|  4.05k|    if (!lr.getline()) { return -1; }
  ------------------
  |  Branch (15144:9): [True: 27, False: 4.02k]
  ------------------
15145|       |
15146|       |    // RFC 9112 §7.1: chunk-size = 1*HEXDIG
15147|  4.02k|    const char *p = lr.ptr();
15148|  4.02k|    int v = 0;
15149|  4.02k|    if (!is_hex(*p, v)) { return -1; }
  ------------------
  |  Branch (15149:9): [True: 31, False: 3.99k]
  ------------------
15150|       |
15151|  3.99k|    size_t chunk_len = 0;
15152|  3.99k|    constexpr size_t chunk_len_max = (std::numeric_limits<size_t>::max)();
15153|  11.8k|    for (; is_hex(*p, v); ++p) {
  ------------------
  |  Branch (15153:12): [True: 7.86k, False: 3.98k]
  ------------------
15154|  7.86k|      if (chunk_len > (chunk_len_max >> 4)) { return -1; }
  ------------------
  |  Branch (15154:11): [True: 9, False: 7.85k]
  ------------------
15155|  7.85k|      chunk_len = (chunk_len << 4) | static_cast<size_t>(v);
15156|  7.85k|    }
15157|       |
15158|  4.44k|    while (is_space_or_tab(*p)) {
  ------------------
  |  Branch (15158:12): [True: 463, False: 3.98k]
  ------------------
15159|    463|      ++p;
15160|    463|    }
15161|  3.98k|    if (*p != '\0' && *p != ';' && *p != '\r' && *p != '\n') { return -1; }
  ------------------
  |  Branch (15161:9): [True: 3.55k, False: 432]
  |  Branch (15161:23): [True: 3.35k, False: 200]
  |  Branch (15161:36): [True: 257, False: 3.09k]
  |  Branch (15161:50): [True: 43, False: 214]
  ------------------
15162|       |
15163|  3.94k|    if (chunk_len == 0) {
  ------------------
  |  Branch (15163:9): [True: 175, False: 3.76k]
  ------------------
15164|    175|      chunk_remaining = 0;
15165|    175|      finished = true;
15166|    175|      out_chunk_offset = 0;
15167|    175|      out_chunk_total = 0;
15168|    175|      return 0;
15169|    175|    }
15170|       |
15171|  3.76k|    chunk_remaining = chunk_len;
15172|  3.76k|    last_chunk_total = chunk_remaining;
15173|  3.76k|    last_chunk_offset = 0;
15174|  3.76k|  }
15175|       |
15176|  4.36k|  auto to_read = (std::min)(chunk_remaining, len);
15177|  4.36k|  auto n = strm.read(buf, to_read);
15178|  4.36k|  if (n <= 0) { return -1; }
  ------------------
  |  Branch (15178:7): [True: 384, False: 3.98k]
  ------------------
15179|       |
15180|  3.98k|  auto offset_before = last_chunk_offset;
15181|  3.98k|  last_chunk_offset += static_cast<size_t>(n);
15182|  3.98k|  chunk_remaining -= static_cast<size_t>(n);
15183|       |
15184|  3.98k|  out_chunk_offset = offset_before;
15185|  3.98k|  out_chunk_total = last_chunk_total;
15186|       |
15187|  3.98k|  if (chunk_remaining == 0) {
  ------------------
  |  Branch (15187:7): [True: 3.38k, False: 600]
  ------------------
15188|  3.38k|    stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15189|  3.38k|    if (!lr.getline()) { return -1; }
  ------------------
  |  Branch (15189:9): [True: 5, False: 3.37k]
  ------------------
15190|  3.37k|    if (std::strcmp(lr.ptr(), "\r\n") != 0) { return -1; }
  ------------------
  |  Branch (15190:9): [True: 28, False: 3.34k]
  ------------------
15191|  3.37k|  }
15192|       |
15193|  3.94k|  return n;
15194|  3.98k|}
_ZN7httplib6detail14ChunkedDecoder19parse_trailers_intoERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSC_:
15197|    175|                                                const Headers &src_headers) {
15198|    175|  stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15199|    175|  if (!lr.getline()) { return false; }
  ------------------
  |  Branch (15199:7): [True: 18, False: 157]
  ------------------
15200|    157|  return parse_trailers(lr, dest, src_headers);
15201|    175|}
_ZN7httplib6detail14parse_trailersERNS0_18stream_line_readerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSD_:
 5778|    157|                           const Headers &src_headers) {
 5779|       |  // NOTE: In RFC 9112, '7.1 Chunked Transfer Coding' mentions "The chunked
 5780|       |  // transfer coding is complete when a chunk with a chunk-size of zero is
 5781|       |  // received, possibly followed by a trailer section, and finally terminated by
 5782|       |  // an empty line". https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1
 5783|       |  //
 5784|       |  // In '7.1.3. Decoding Chunked', however, the pseudo-code in the section
 5785|       |  // doesn't care for the existence of the final CRLF. In other words, it seems
 5786|       |  // to be ok whether the final CRLF exists or not in the chunked data.
 5787|       |  // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1.3
 5788|       |  //
 5789|       |  // According to the reference code in RFC 9112, cpp-httplib now allows
 5790|       |  // chunked transfer coding data without the final CRLF.
 5791|       |
 5792|       |  // RFC 7230 Section 4.1.2 - Headers prohibited in trailers
 5793|    157|  thread_local case_ignore::unordered_set<std::string> prohibited_trailers = {
 5794|    157|      "transfer-encoding",
 5795|    157|      "content-length",
 5796|    157|      "host",
 5797|    157|      "authorization",
 5798|    157|      "www-authenticate",
 5799|    157|      "proxy-authenticate",
 5800|    157|      "proxy-authorization",
 5801|    157|      "cookie",
 5802|    157|      "set-cookie",
 5803|    157|      "cache-control",
 5804|    157|      "expect",
 5805|    157|      "max-forwards",
 5806|    157|      "pragma",
 5807|    157|      "range",
 5808|    157|      "te",
 5809|    157|      "age",
 5810|    157|      "expires",
 5811|    157|      "date",
 5812|    157|      "location",
 5813|    157|      "retry-after",
 5814|    157|      "vary",
 5815|    157|      "warning",
 5816|    157|      "content-encoding",
 5817|    157|      "content-type",
 5818|    157|      "content-range",
 5819|    157|      "trailer"};
 5820|       |
 5821|    157|  case_ignore::unordered_set<std::string> declared_trailers;
 5822|    157|  auto trailer_header = get_combined_header_value(src_headers, "Trailer");
 5823|    157|  if (!trailer_header.empty()) {
  ------------------
  |  Branch (5823:7): [True: 0, False: 157]
  ------------------
 5824|       |    // split() trims each token and skips empty ones, so the name arrives ready
 5825|       |    // to look up.
 5826|      0|    split(trailer_header.data(), trailer_header.data() + trailer_header.size(),
 5827|      0|          ',', [&](const char *b, const char *e) {
 5828|      0|            std::string key(b, e);
 5829|      0|            if (prohibited_trailers.find(key) == prohibited_trailers.end()) {
 5830|      0|              declared_trailers.insert(key);
 5831|      0|            }
 5832|      0|          });
 5833|      0|  }
 5834|       |
 5835|    157|  size_t trailer_header_count = 0;
 5836|  3.85k|  while (strcmp(line_reader.ptr(), "\r\n") != 0) {
  ------------------
  |  Branch (5836:10): [True: 3.85k, False: 1]
  ------------------
 5837|  3.85k|    if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; }
  ------------------
  |  |  114|  3.85k|#define CPPHTTPLIB_HEADER_MAX_LENGTH 8192
  ------------------
  |  Branch (5837:9): [True: 2, False: 3.85k]
  ------------------
 5838|  3.85k|    if (trailer_header_count >= CPPHTTPLIB_HEADER_MAX_COUNT) { return false; }
  ------------------
  |  |  118|  3.85k|#define CPPHTTPLIB_HEADER_MAX_COUNT 100
  ------------------
  |  Branch (5838:9): [True: 0, False: 3.85k]
  ------------------
 5839|       |
 5840|  3.85k|    constexpr auto line_terminator_len = 2;
 5841|  3.85k|    auto line_beg = line_reader.ptr();
 5842|  3.85k|    auto line_end =
 5843|  3.85k|        line_reader.ptr() + line_reader.size() - line_terminator_len;
 5844|       |
 5845|  3.85k|    if (!parse_header(line_beg, line_end,
  ------------------
  |  Branch (5845:9): [True: 104, False: 3.74k]
  ------------------
 5846|  3.85k|                      [&](const std::string &key, const std::string &val) {
 5847|  3.85k|                        if (declared_trailers.find(key) !=
 5848|  3.85k|                            declared_trailers.end()) {
 5849|  3.85k|                          dest.emplace(key, val);
 5850|  3.85k|                          trailer_header_count++;
 5851|  3.85k|                        }
 5852|  3.85k|                      })) {
 5853|    104|      return false;
 5854|    104|    }
 5855|       |
 5856|  3.74k|    if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (5856:9): [True: 50, False: 3.69k]
  ------------------
 5857|  3.74k|  }
 5858|       |
 5859|      1|  return true;
 5860|    157|}
_ZNK7httplib6detail11case_ignore4hashclERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  642|     26|  size_t operator()(const std::string &key) const {
  643|     26|    return hash_core(key.data(), key.size(), 0);
  644|     26|  }
_ZNK7httplib6detail11case_ignore4hash9hash_coreEPKcmm:
  646|    279|  size_t hash_core(const char *s, size_t l, size_t h) const {
  647|    279|    return (l == 0) ? h
  ------------------
  |  Branch (647:12): [True: 26, False: 253]
  ------------------
  648|    279|                    : hash_core(s + 1, l - 1,
  649|       |                                // Unsets the 6 high bits of h, therefore no
  650|       |                                // overflow happens
  651|    253|                                (((std::numeric_limits<size_t>::max)() >> 6) &
  652|    253|                                 h * 33) ^
  653|    253|                                    static_cast<unsigned char>(to_lower(*s)));
  654|    279|  }
_ZN7httplib6detail12parse_headerIZNS0_14parse_trailersERNS0_18stream_line_readerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSE_EUlRKSB_SJ_E_EEbPKcSM_T_:
 5732|  3.85k|inline bool parse_header(const char *beg, const char *end, T fn) {
 5733|       |  // Skip trailing spaces and tabs.
 5734|  4.10k|  while (beg < end && is_space_or_tab(end[-1])) {
  ------------------
  |  Branch (5734:10): [True: 4.06k, False: 42]
  |  Branch (5734:23): [True: 257, False: 3.80k]
  ------------------
 5735|    257|    end--;
 5736|    257|  }
 5737|       |
 5738|  3.85k|  auto p = beg;
 5739|  88.8k|  while (p < end && *p != ':') {
  ------------------
  |  Branch (5739:10): [True: 88.7k, False: 81]
  |  Branch (5739:21): [True: 85.0k, False: 3.76k]
  ------------------
 5740|  85.0k|    p++;
 5741|  85.0k|  }
 5742|       |
 5743|  3.85k|  auto name = std::string(beg, p);
 5744|  3.85k|  if (!detail::fields::is_field_name(name)) { return false; }
  ------------------
  |  Branch (5744:7): [True: 77, False: 3.77k]
  ------------------
 5745|       |
 5746|  3.77k|  if (p == end) { return false; }
  ------------------
  |  Branch (5746:7): [True: 12, False: 3.76k]
  ------------------
 5747|       |
 5748|  3.76k|  auto key_end = p;
 5749|       |
 5750|  3.76k|  if (*p++ != ':') { return false; }
  ------------------
  |  Branch (5750:7): [True: 0, False: 3.76k]
  ------------------
 5751|       |
 5752|  4.25k|  while (p < end && is_space_or_tab(*p)) {
  ------------------
  |  Branch (5752:10): [True: 2.25k, False: 1.99k]
  |  Branch (5752:21): [True: 493, False: 1.76k]
  ------------------
 5753|    493|    p++;
 5754|    493|  }
 5755|       |
 5756|  3.76k|  if (p <= end) {
  ------------------
  |  Branch (5756:7): [True: 3.76k, False: 0]
  ------------------
 5757|  3.76k|    auto key_len = key_end - beg;
 5758|  3.76k|    if (!key_len) { return false; }
  ------------------
  |  Branch (5758:9): [True: 0, False: 3.76k]
  ------------------
 5759|       |
 5760|  3.76k|    auto key = std::string(beg, key_end);
 5761|  3.76k|    auto val = std::string(p, end);
 5762|       |
 5763|  3.76k|    if (!detail::fields::is_field_value(val)) { return false; }
  ------------------
  |  Branch (5763:9): [True: 15, False: 3.74k]
  ------------------
 5764|       |
 5765|       |    // RFC 9110 §5.5: header field values are opaque octets and MUST NOT be
 5766|       |    // percent-decoded by the recipient. Applications that need to interpret a
 5767|       |    // value as a URI component should call httplib::decode_uri_component()
 5768|       |    // (or decode_path_component()) explicitly.
 5769|  3.74k|    fn(key, val);
 5770|       |
 5771|  3.74k|    return true;
 5772|  3.76k|  }
 5773|       |
 5774|      0|  return false;
 5775|  3.76k|}
_ZZN7httplib6detail14parse_trailersERNS0_18stream_line_readerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSD_ENKUlRKSA_SI_E_clESI_SI_:
 5846|  3.74k|                      [&](const std::string &key, const std::string &val) {
 5847|  3.74k|                        if (declared_trailers.find(key) !=
  ------------------
  |  Branch (5847:29): [True: 0, False: 3.74k]
  ------------------
 5848|  3.74k|                            declared_trailers.end()) {
 5849|      0|                          dest.emplace(key, val);
 5850|      0|                          trailer_header_count++;
 5851|      0|                        }
 5852|  3.74k|                      })) {
_ZN7httplib6detail27read_content_without_lengthERNS_6StreamEmNSt3__18functionIFbPKcmmmEEE:
 8203|    490|                            ContentReceiverWithProgress out) {
 8204|    490|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8205|    490|  size_t r = 0;
 8206|  1.85k|  for (;;) {
 8207|  1.85k|    auto n = strm.read(buf, CPPHTTPLIB_RECV_BUFSIZ);
  ------------------
  |  |  172|  1.85k|#define CPPHTTPLIB_RECV_BUFSIZ size_t(16384u)
  ------------------
 8208|  1.85k|    if (n == 0) { return ReadContentResult::Success; }
  ------------------
  |  Branch (8208:9): [True: 454, False: 1.40k]
  ------------------
 8209|  1.40k|    if (n < 0) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8209:9): [True: 0, False: 1.40k]
  ------------------
 8210|       |
 8211|       |    // Check if adding this data would exceed the payload limit
 8212|  1.40k|    if (r > payload_max_length ||
  ------------------
  |  Branch (8212:9): [True: 0, False: 1.40k]
  ------------------
 8213|  1.40k|        payload_max_length - r < static_cast<size_t>(n)) {
  ------------------
  |  Branch (8213:9): [True: 0, False: 1.40k]
  ------------------
 8214|      0|      return ReadContentResult::PayloadTooLarge;
 8215|      0|    }
 8216|       |
 8217|  1.40k|    if (!out(buf, static_cast<size_t>(n), r, 0)) {
  ------------------
  |  Branch (8217:9): [True: 36, False: 1.36k]
  ------------------
 8218|     36|      return ReadContentResult::Error;
 8219|     36|    }
 8220|  1.36k|    r += static_cast<size_t>(n);
 8221|  1.36k|  }
 8222|       |
 8223|      0|  return ReadContentResult::Success;
 8224|    490|}
_ZN7httplib6detail24read_content_with_lengthERNS_6StreamEmNSt3__18functionIFbmmEEENS4_IFbPKcmmmEEEm:
 8163|    457|    size_t payload_max_length = (std::numeric_limits<size_t>::max)()) {
 8164|    457|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8165|       |
 8166|    457|  detail::BodyReader br;
 8167|    457|  br.stream = &strm;
 8168|    457|  br.has_content_length = true;
 8169|    457|  br.content_length = len;
 8170|    457|  br.payload_max_length = payload_max_length;
 8171|    457|  br.chunked = false;
 8172|    457|  br.bytes_read = 0;
 8173|    457|  br.last_error = Error::Success;
 8174|       |
 8175|    457|  size_t r = 0;
 8176|    929|  while (r < len) {
  ------------------
  |  Branch (8176:10): [True: 928, False: 1]
  ------------------
 8177|    928|    auto read_len = static_cast<size_t>(len - r);
 8178|    928|    auto to_read = (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ);
  ------------------
  |  |  172|    928|#define CPPHTTPLIB_RECV_BUFSIZ size_t(16384u)
  ------------------
 8179|    928|    auto n = detail::read_body_content(&strm, br, buf, to_read);
 8180|    928|    if (n <= 0) {
  ------------------
  |  Branch (8180:9): [True: 453, False: 475]
  ------------------
 8181|       |      // Check if it was a payload size error
 8182|    453|      if (br.last_error == Error::ExceedMaxPayloadSize) {
  ------------------
  |  Branch (8182:11): [True: 0, False: 453]
  ------------------
 8183|      0|        return ReadContentResult::PayloadTooLarge;
 8184|      0|      }
 8185|    453|      return ReadContentResult::Error;
 8186|    453|    }
 8187|       |
 8188|    475|    if (!out(buf, static_cast<size_t>(n), r, len)) {
  ------------------
  |  Branch (8188:9): [True: 3, False: 472]
  ------------------
 8189|      3|      return ReadContentResult::Error;
 8190|      3|    }
 8191|    472|    r += static_cast<size_t>(n);
 8192|       |
 8193|    472|    if (progress) {
  ------------------
  |  Branch (8193:9): [True: 472, False: 0]
  ------------------
 8194|    472|      if (!progress(r, len)) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8194:11): [True: 0, False: 472]
  ------------------
 8195|    472|    }
 8196|    472|  }
 8197|       |
 8198|      1|  return ReadContentResult::Success;
 8199|    457|}
_ZN7httplib6detail17read_body_contentEPNS_6StreamERNS0_10BodyReaderEPcm:
 2577|    928|                                 size_t len) {
 2578|    928|  (void)stream;
 2579|    928|  return br.read(buf, len);
 2580|    928|}
_ZN7httplib6detail10BodyReader4readEPcm:
11611|    928|inline ssize_t detail::BodyReader::read(char *buf, size_t len) {
11612|    928|  if (!stream) {
  ------------------
  |  Branch (11612:7): [True: 0, False: 928]
  ------------------
11613|      0|    last_error = Error::Connection;
11614|      0|    return -1;
11615|      0|  }
11616|    928|  if (eof) { return 0; }
  ------------------
  |  Branch (11616:7): [True: 0, False: 928]
  ------------------
11617|       |
11618|    928|  if (!chunked) {
  ------------------
  |  Branch (11618:7): [True: 928, False: 0]
  ------------------
11619|       |    // Content-Length based reading
11620|    928|    if (has_content_length && bytes_read >= content_length) {
  ------------------
  |  Branch (11620:9): [True: 928, False: 0]
  |  Branch (11620:31): [True: 0, False: 928]
  ------------------
11621|      0|      eof = true;
11622|      0|      return 0;
11623|      0|    }
11624|       |
11625|    928|    auto to_read = len;
11626|    928|    if (has_content_length) {
  ------------------
  |  Branch (11626:9): [True: 928, False: 0]
  ------------------
11627|    928|      auto remaining = content_length - bytes_read;
11628|    928|      to_read = (std::min)(len, remaining);
11629|    928|    }
11630|    928|    auto n = stream->read(buf, to_read);
11631|       |
11632|    928|    if (n < 0) {
  ------------------
  |  Branch (11632:9): [True: 0, False: 928]
  ------------------
11633|      0|      last_error = stream->get_error();
11634|      0|      if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11634:11): [True: 0, False: 0]
  ------------------
11635|      0|      eof = true;
11636|      0|      return n;
11637|      0|    }
11638|    928|    if (n == 0) {
  ------------------
  |  Branch (11638:9): [True: 453, False: 475]
  ------------------
11639|       |      // Unexpected EOF before content_length
11640|    453|      last_error = stream->get_error();
11641|    453|      if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11641:11): [True: 453, False: 0]
  ------------------
11642|    453|      eof = true;
11643|    453|      return 0;
11644|    453|    }
11645|       |
11646|    475|    bytes_read += static_cast<size_t>(n);
11647|    475|    if (has_content_length && bytes_read >= content_length) { eof = true; }
  ------------------
  |  Branch (11647:9): [True: 475, False: 0]
  |  Branch (11647:31): [True: 1, False: 474]
  ------------------
11648|    475|    if (payload_max_length > 0 && bytes_read > payload_max_length) {
  ------------------
  |  Branch (11648:9): [True: 475, False: 0]
  |  Branch (11648:35): [True: 0, False: 475]
  ------------------
11649|      0|      last_error = Error::ExceedMaxPayloadSize;
11650|      0|      eof = true;
11651|      0|      return -1;
11652|      0|    }
11653|    475|    return n;
11654|    475|  }
11655|       |
11656|       |  // Chunked transfer encoding: delegate to shared decoder instance.
11657|      0|  if (!chunked_decoder) { chunked_decoder.reset(new ChunkedDecoder(*stream)); }
  ------------------
  |  Branch (11657:7): [True: 0, False: 0]
  ------------------
11658|       |
11659|      0|  size_t chunk_offset = 0;
11660|      0|  size_t chunk_total = 0;
11661|      0|  auto n = chunked_decoder->read_payload(buf, len, chunk_offset, chunk_total);
11662|      0|  if (n < 0) {
  ------------------
  |  Branch (11662:7): [True: 0, False: 0]
  ------------------
11663|      0|    last_error = stream->get_error();
11664|      0|    if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11664:9): [True: 0, False: 0]
  ------------------
11665|      0|    eof = true;
11666|      0|    return n;
11667|      0|  }
11668|       |
11669|      0|  if (n == 0) {
  ------------------
  |  Branch (11669:7): [True: 0, False: 0]
  ------------------
11670|       |    // Final chunk observed. Leave trailer parsing to the caller (StreamHandle).
11671|      0|    eof = true;
11672|      0|    return 0;
11673|      0|  }
11674|       |
11675|      0|  bytes_read += static_cast<size_t>(n);
11676|      0|  if (payload_max_length > 0 && bytes_read > payload_max_length) {
  ------------------
  |  Branch (11676:7): [True: 0, False: 0]
  |  Branch (11676:33): [True: 0, False: 0]
  ------------------
11677|      0|    last_error = Error::ExceedMaxPayloadSize;
11678|      0|    eof = true;
11679|      0|    return -1;
11680|      0|  }
11681|      0|  return n;
11682|      0|}
_ZNK7httplib6Stream9get_errorEv:
 1912|    453|  Error get_error() const { return error_; }
_ZZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_ENKUlSE_mmmE0_clESE_mmm:
 8342|  3.82k|                                        size_t len) {
 8343|  3.82k|    return receiver(buf, n, off, len);
 8344|  3.82k|  };
_ZZN7httplib10ClientImpl15process_requestERNS_6StreamERNS_7RequestERNS_8ResponseEbRNS_5ErrorEENKUlmmE_clEmm:
15981|    472|    auto progress = [&](size_t current, size_t total) {
15982|    472|      if (!req.download_progress || redirect) { return true; }
  ------------------
  |  Branch (15982:11): [True: 472, False: 0]
  |  Branch (15982:37): [True: 0, False: 0]
  ------------------
15983|      0|      auto ret = req.download_progress(current, total);
15984|      0|      if (!ret) {
  ------------------
  |  Branch (15984:11): [True: 0, False: 0]
  ------------------
15985|      0|        error = Error::Canceled;
15986|      0|        output_error_log(error, &req);
15987|      0|      }
15988|      0|      return ret;
15989|    472|    };
_ZNK7httplib10ClientImpl10output_logERKNS_7RequestERKNS_8ResponseE:
15836|    492|                                   const Response &res) const {
15837|    492|  if (logger_) {
  ------------------
  |  Branch (15837:7): [True: 0, False: 492]
  ------------------
15838|      0|    std::lock_guard<std::mutex> guard(logger_mutex_);
15839|      0|    logger_(req, res);
15840|      0|  }
15841|    492|}
_ZN7httplib8ResponseD2Ev:
 1805|  3.10k|  ~Response() {
 1806|  3.10k|    if (content_provider_resource_releaser_) {
  ------------------
  |  Branch (1806:9): [True: 0, False: 3.10k]
  ------------------
 1807|      0|      content_provider_resource_releaser_(content_provider_success_);
 1808|      0|    }
 1809|  3.10k|  }
_ZNK7httplib6detail17gzip_decompressor8is_validEv:
 7670|    139|inline bool gzip_decompressor::is_valid() const { return is_valid_; }
_ZN7httplib6detail17gzip_decompressor10decompressEPKcmNSt3__18functionIFbS3_mEEE:
 7673|  1.99k|                                          Callback callback) {
 7674|  1.99k|  assert(is_valid_);
  ------------------
  |  Branch (7674:3): [True: 1.99k, False: 0]
  ------------------
 7675|       |
 7676|  1.99k|  auto ret = Z_OK;
 7677|       |
 7678|  1.99k|  do {
 7679|  1.99k|    constexpr size_t max_avail_in =
 7680|  1.99k|        (std::numeric_limits<decltype(strm_.avail_in)>::max)();
 7681|       |
 7682|  1.99k|    strm_.avail_in = static_cast<decltype(strm_.avail_in)>(
 7683|  1.99k|        (std::min)(data_length, max_avail_in));
 7684|  1.99k|    strm_.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>(data));
 7685|       |
 7686|  1.99k|    data_length -= strm_.avail_in;
 7687|  1.99k|    data += strm_.avail_in;
 7688|       |
 7689|  1.99k|    std::array<char, CPPHTTPLIB_COMPRESSION_BUFSIZ> buff{};
 7690|   129k|    while (strm_.avail_in > 0 && ret == Z_OK) {
  ------------------
  |  Branch (7690:12): [True: 127k, False: 1.69k]
  |  Branch (7690:34): [True: 127k, False: 258]
  ------------------
 7691|   127k|      strm_.avail_out = static_cast<uInt>(buff.size());
 7692|   127k|      strm_.next_out = reinterpret_cast<Bytef *>(buff.data());
 7693|       |
 7694|   127k|      ret = inflate(&strm_, Z_NO_FLUSH);
 7695|       |
 7696|   127k|      assert(ret != Z_STREAM_ERROR);
  ------------------
  |  Branch (7696:7): [True: 127k, False: 0]
  ------------------
 7697|   127k|      switch (ret) {
  ------------------
  |  Branch (7697:15): [True: 27, False: 127k]
  ------------------
 7698|      1|      case Z_NEED_DICT:
  ------------------
  |  Branch (7698:7): [True: 1, False: 127k]
  ------------------
 7699|     27|      case Z_DATA_ERROR:
  ------------------
  |  Branch (7699:7): [True: 26, False: 127k]
  ------------------
 7700|     27|      case Z_MEM_ERROR: inflateEnd(&strm_); return false;
  ------------------
  |  Branch (7700:7): [True: 0, False: 127k]
  ------------------
 7701|   127k|      }
 7702|       |
 7703|   127k|      if (!callback(buff.data(), buff.size() - strm_.avail_out)) {
  ------------------
  |  Branch (7703:11): [True: 15, False: 127k]
  ------------------
 7704|     15|        return false;
 7705|     15|      }
 7706|   127k|    }
 7707|       |
 7708|  1.95k|    if (ret != Z_OK && ret != Z_STREAM_END) { return false; }
  ------------------
  |  Branch (7708:9): [True: 259, False: 1.69k]
  |  Branch (7708:24): [True: 0, False: 259]
  ------------------
 7709|       |
 7710|  1.95k|  } while (data_length > 0);
  ------------------
  |  Branch (7710:12): [True: 0, False: 1.95k]
  ------------------
 7711|       |
 7712|  1.95k|  return true;
 7713|  1.99k|}
_ZN7httplib6detail12BufferStreamD2Ev:
 3677|  3.10k|  ~BufferStream() override = default;
_ZN7httplib6detail12BufferStream5writeEPKcm:
12021|  20.4k|inline ssize_t BufferStream::write(const char *ptr, size_t size) {
12022|  20.4k|  buffer.append(ptr, size);
12023|  20.4k|  return static_cast<ssize_t>(size);
12024|  20.4k|}
_ZNK7httplib6Stream13buffered_dataERm:
 1901|  3.57M|  virtual const char *buffered_data(size_t &size) const {
 1902|  3.57M|    size = 0;
 1903|  3.57M|    return nullptr;
 1904|  3.57M|  }
_ZNK7httplib10ClientImpl6is_sslEv:
16100|  3.10k|inline bool ClientImpl::is_ssl() const { return false; }

LLVMFuzzerTestOneInput:
   69|  3.10k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   70|  3.10k|  if (size < 1) return 0;
  ------------------
  |  Branch (70:7): [True: 0, False: 3.10k]
  ------------------
   71|       |
   72|  3.10k|  FuzzedStream stream{data + 1, size - 1};
   73|  3.10k|  FuzzableClient client;
   74|       |
   75|       |  // Use the first byte to select method
   76|  3.10k|  std::string method;
   77|  3.10k|  switch (data[0] % 6) {
  ------------------
  |  Branch (77:11): [True: 3.10k, False: 0]
  ------------------
   78|    149|  case 0: method = "GET"; break;
  ------------------
  |  Branch (78:3): [True: 149, False: 2.95k]
  ------------------
   79|    647|  case 1: method = "POST"; break;
  ------------------
  |  Branch (79:3): [True: 647, False: 2.45k]
  ------------------
   80|    866|  case 2: method = "PUT"; break;
  ------------------
  |  Branch (80:3): [True: 866, False: 2.23k]
  ------------------
   81|    339|  case 3: method = "PATCH"; break;
  ------------------
  |  Branch (81:3): [True: 339, False: 2.76k]
  ------------------
   82|    283|  case 4: method = "DELETE"; break;
  ------------------
  |  Branch (82:3): [True: 283, False: 2.82k]
  ------------------
   83|    821|  case 5: method = "OPTIONS"; break;
  ------------------
  |  Branch (83:3): [True: 821, False: 2.28k]
  ------------------
   84|  3.10k|  }
   85|       |
   86|  3.10k|  client.ProcessFuzzedResponse(stream, method);
   87|  3.10k|  return 0;
   88|  3.10k|}
_ZN12FuzzedStreamC2EPKhm:
    8|  3.10k|      : data_(data), size_(size), read_pos_(0) {}
_ZN12FuzzedStream4readEPcm:
   10|  3.58M|  ssize_t read(char *ptr, size_t size) override {
   11|  3.58M|    if (size + read_pos_ > size_) { size = size_ - read_pos_; }
  ------------------
  |  Branch (11:9): [True: 3.16k, False: 3.57M]
  ------------------
   12|  3.58M|    memcpy(ptr, data_ + read_pos_, size);
   13|  3.58M|    read_pos_ += size;
   14|  3.58M|    return static_cast<ssize_t>(size);
   15|  3.58M|  }
_ZN12FuzzedStream5writeEPKcm:
   17|  3.10k|  ssize_t write(const char *ptr, size_t size) override {
   18|  3.10k|    request_.append(ptr, size);
   19|  3.10k|    return static_cast<ssize_t>(size);
   20|  3.10k|  }
_ZN14FuzzableClientC2Ev:
   55|  3.10k|  FuzzableClient() : httplib::ClientImpl("localhost", 8080) {}
_ZN14FuzzableClient21ProcessFuzzedResponseER12FuzzedStreamRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   57|  3.10k|  void ProcessFuzzedResponse(FuzzedStream &stream, const std::string &method) {
   58|  3.10k|    httplib::Request req;
   59|  3.10k|    req.method = method;
   60|  3.10k|    req.path = "/";
   61|  3.10k|    httplib::Response res;
   62|  3.10k|    bool close_connection = false;
   63|  3.10k|    httplib::Error error = httplib::Error::Success;
   64|       |
   65|  3.10k|    process_request(stream, req, res, close_connection, error);
   66|  3.10k|  }

