_ZN7httplib6detail17gzip_decompressorD2Ev:
 7649|    139|inline gzip_decompressor::~gzip_decompressor() { inflateEnd(&strm_); }
_ZN7httplib10ClientImplD2Ev:
14514|  3.10k|inline ClientImpl::~ClientImpl() {
14515|       |  // Wait until all the requests in flight are handled.
14516|  3.10k|  size_t retry_count = 10;
14517|  3.10k|  while (retry_count-- > 0) {
  ------------------
  |  Branch (14517:10): [True: 3.10k, False: 0]
  ------------------
14518|  3.10k|    {
14519|  3.10k|      std::lock_guard<std::mutex> guard(socket_mutex_);
14520|  3.10k|      if (socket_requests_in_flight_ == 0) { break; }
  ------------------
  |  Branch (14520:11): [True: 3.10k, False: 0]
  ------------------
14521|  3.10k|    }
14522|      0|    std::this_thread::sleep_for(std::chrono::milliseconds{1});
14523|      0|  }
14524|       |
14525|  3.10k|  std::lock_guard<std::mutex> guard(socket_mutex_);
14526|  3.10k|  shutdown_socket(socket_);
14527|  3.10k|  close_socket(socket_);
14528|  3.10k|}
_ZN7httplib6detail12decompressorD2Ev:
 3701|    139|  virtual ~decompressor() = default;
_ZN7httplib6StreamD2Ev:
 1875|  6.21k|  virtual ~Stream() = default;
_ZNK7httplib10ClientImpl15shutdown_socketERNS0_6SocketE:
14643|  3.10k|inline void ClientImpl::shutdown_socket(Socket &socket) const {
14644|  3.10k|  if (socket.sock == INVALID_SOCKET) { return; }
  ------------------
  |  |  322|  3.10k|#define INVALID_SOCKET (-1)
  ------------------
  |  Branch (14644:7): [True: 3.10k, False: 0]
  ------------------
14645|      0|  detail::shutdown_socket(socket.sock);
14646|      0|}
_ZN7httplib10ClientImpl12close_socketERNS0_6SocketE:
14648|  3.10k|inline void ClientImpl::close_socket(Socket &socket) {
14649|       |  // If there are requests in flight in another thread, usually closing
14650|       |  // the socket will be fine and they will simply receive an error when
14651|       |  // using the closed socket, but it is still a bug since rarely the OS
14652|       |  // may reassign the socket id to be used for a new socket, and then
14653|       |  // suddenly they will be operating on a live socket that is different
14654|       |  // than the one they intended!
14655|  3.10k|  assert(socket_requests_in_flight_ == 0 ||
  ------------------
  |  Branch (14655:3): [True: 3.10k, False: 0]
  |  Branch (14655:3): [True: 0, False: 0]
  |  Branch (14655:3): [True: 3.10k, False: 0]
  ------------------
14656|  3.10k|         socket_requests_are_from_thread_ == std::this_thread::get_id());
14657|       |
14658|       |  // It is also a bug if this happens while SSL is still active
14659|       |#ifdef CPPHTTPLIB_SSL_ENABLED
14660|       |  assert(socket.ssl == nullptr);
14661|       |#endif
14662|       |
14663|  3.10k|  if (socket.sock == INVALID_SOCKET) { return; }
  ------------------
  |  |  322|  3.10k|#define INVALID_SOCKET (-1)
  ------------------
  |  Branch (14663:7): [True: 3.10k, False: 0]
  ------------------
14664|      0|  detail::close_socket(socket.sock);
14665|      0|  socket.sock = INVALID_SOCKET;
  ------------------
  |  |  322|      0|#define INVALID_SOCKET (-1)
  ------------------
14666|      0|}
_ZN7httplib10ClientImplC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi:
14506|  3.10k|    : ClientImpl(host, port, std::string(), std::string()) {}
_ZN7httplib10ClientImplC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEiS9_S9_:
14511|  3.10k|    : host_(detail::escape_abstract_namespace_unix_domain(host)), port_(port),
14512|  3.10k|      client_cert_path_(client_cert_path), client_key_path_(client_key_path) {}
_ZN7httplib6detail37escape_abstract_namespace_unix_domainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6545|  3.10k|inline std::string escape_abstract_namespace_unix_domain(const std::string &s) {
 6546|  3.10k|  if (s.size() > 1 && s[0] == '\0') {
  ------------------
  |  Branch (6546:7): [True: 3.10k, False: 0]
  |  Branch (6546:23): [True: 0, False: 3.10k]
  ------------------
 6547|      0|    auto ret = s;
 6548|      0|    ret[0] = '@';
 6549|      0|    return ret;
 6550|      0|  }
 6551|  3.10k|  return s;
 6552|  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:
 8414|  3.10k|inline ssize_t write_headers(Stream &strm, const Headers &headers) {
 8415|  3.10k|  ssize_t write_len = 0;
 8416|  14.2k|  for (const auto &x : headers) {
  ------------------
  |  Branch (8416:22): [True: 14.2k, False: 3.10k]
  ------------------
 8417|       |    // Skip fields with invalid names or values to prevent response splitting
 8418|       |    // via CR/LF injection, matching set_header(). The client validates request
 8419|       |    // headers up front in check_and_write_headers, but the server passes
 8420|       |    // res.headers straight to this writer, and res.headers is a public field
 8421|       |    // an application can populate directly with request-derived values.
 8422|  14.2k|    if (!fields::is_field_valid(x.first, x.second)) { continue; }
  ------------------
  |  Branch (8422:9): [True: 0, False: 14.2k]
  ------------------
 8423|       |
 8424|  14.2k|    std::string s;
 8425|  14.2k|    s = x.first;
 8426|  14.2k|    s += ": ";
 8427|  14.2k|    s += x.second;
 8428|  14.2k|    s += "\r\n";
 8429|       |
 8430|  14.2k|    auto len = strm.write(s.data(), s.size());
 8431|  14.2k|    if (len < 0) { return len; }
  ------------------
  |  Branch (8431:9): [True: 0, False: 14.2k]
  ------------------
 8432|  14.2k|    write_len += len;
 8433|  14.2k|  }
 8434|  3.10k|  auto len = strm.write("\r\n");
 8435|  3.10k|  if (len < 0) { return len; }
  ------------------
  |  Branch (8435:7): [True: 0, False: 3.10k]
  ------------------
 8436|  3.10k|  write_len += len;
 8437|  3.10k|  return write_len;
 8438|  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_:
10038|  36.6k|inline bool is_field_valid(const std::string &name, const std::string &value) {
10039|  36.6k|  return is_field_name(name) && is_field_value(value);
  ------------------
  |  Branch (10039:10): [True: 36.6k, False: 0]
  |  Branch (10039:33): [True: 36.6k, False: 0]
  ------------------
10040|  36.6k|}
_ZN7httplib6detail6fields13is_field_nameERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10003|  50.8k|inline bool is_field_name(const std::string &s) { return is_token(s); }
_ZN7httplib6detail6fields8is_tokenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 9995|  50.8k|inline bool is_token(const std::string &s) {
 9996|  50.8k|  if (s.empty()) { return false; }
  ------------------
  |  Branch (9996:7): [True: 68, False: 50.7k]
  ------------------
 9997|   524k|  for (auto c : s) {
  ------------------
  |  Branch (9997:15): [True: 524k, False: 50.6k]
  ------------------
 9998|   524k|    if (!is_token_char(c)) { return false; }
  ------------------
  |  Branch (9998:9): [True: 136, False: 524k]
  ------------------
 9999|   524k|  }
10000|  50.6k|  return true;
10001|  50.7k|}
_ZN7httplib6detail6fields13is_token_charEc:
 9989|   524k|inline bool is_token_char(char c) {
 9990|   524k|  return is_ascii_alnum(c) || c == '!' || c == '#' || c == '$' || c == '%' ||
  ------------------
  |  Branch (9990:10): [True: 478k, False: 45.8k]
  |  Branch (9990:31): [True: 675, False: 45.1k]
  |  Branch (9990:43): [True: 1.26k, False: 43.8k]
  |  Branch (9990:55): [True: 721, False: 43.1k]
  |  Branch (9990:67): [True: 316, False: 42.8k]
  ------------------
 9991|  42.8k|         c == '&' || c == '\'' || c == '*' || c == '+' || c == '-' ||
  ------------------
  |  Branch (9991:10): [True: 1.21k, False: 41.6k]
  |  Branch (9991:22): [True: 617, False: 40.9k]
  |  Branch (9991:35): [True: 2.37k, False: 38.6k]
  |  Branch (9991:47): [True: 357, False: 38.2k]
  |  Branch (9991:59): [True: 30.6k, False: 7.63k]
  ------------------
 9992|  7.63k|         c == '.' || c == '^' || c == '_' || c == '`' || c == '|' || c == '~';
  ------------------
  |  Branch (9992:10): [True: 518, False: 7.11k]
  |  Branch (9992:22): [True: 1.77k, False: 5.33k]
  |  Branch (9992:34): [True: 3.17k, False: 2.16k]
  |  Branch (9992:46): [True: 602, False: 1.56k]
  |  Branch (9992:58): [True: 558, False: 1.00k]
  |  Branch (9992:70): [True: 871, False: 136]
  ------------------
 9993|   524k|}
_ZN7httplib6detail14is_ascii_alnumEc:
  590|   524k|inline bool is_ascii_alnum(char c) {
  591|   524k|  return is_ascii_digit(c) || is_ascii_alpha(c);
  ------------------
  |  Branch (591:10): [True: 9.87k, False: 514k]
  |  Branch (591:31): [True: 469k, False: 45.8k]
  ------------------
  592|   524k|}
_ZN7httplib6detail14is_ascii_digitEc:
  584|   568k|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (584:45): [True: 525k, False: 42.6k]
  |  Branch (584:57): [True: 45.4k, False: 479k]
  ------------------
_ZN7httplib6detail14is_ascii_alphaEc:
  586|   514k|inline bool is_ascii_alpha(char c) {
  587|   514k|  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
  ------------------
  |  Branch (587:11): [True: 370k, False: 143k]
  |  Branch (587:23): [True: 369k, False: 1.43k]
  |  Branch (587:37): [True: 106k, False: 38.8k]
  |  Branch (587:49): [True: 99.6k, False: 6.98k]
  ------------------
  588|   514k|}
_ZN7httplib6detail6fields14is_field_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10036|  53.5k|inline bool is_field_value(const std::string &s) { return is_field_content(s); }
_ZN7httplib6detail6fields16is_field_contentERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
10011|  53.5k|inline bool is_field_content(const std::string &s) {
10012|  53.5k|  if (s.empty()) { return true; }
  ------------------
  |  Branch (10012:7): [True: 8.08k, False: 45.4k]
  ------------------
10013|       |
10014|  45.4k|  if (s.size() == 1) {
  ------------------
  |  Branch (10014:7): [True: 9.57k, False: 35.8k]
  ------------------
10015|  9.57k|    return is_field_vchar(s[0]);
10016|  35.8k|  } else if (s.size() == 2) {
  ------------------
  |  Branch (10016:14): [True: 397, False: 35.4k]
  ------------------
10017|    397|    return is_field_vchar(s[0]) && is_field_vchar(s[1]);
  ------------------
  |  Branch (10017:12): [True: 396, False: 1]
  |  Branch (10017:36): [True: 395, False: 1]
  ------------------
10018|  35.4k|  } else {
10019|  35.4k|    size_t i = 0;
10020|       |
10021|  35.4k|    if (!is_field_vchar(s[i])) { return false; }
  ------------------
  |  Branch (10021:9): [True: 3, False: 35.4k]
  ------------------
10022|  35.4k|    i++;
10023|       |
10024|  2.29M|    while (i < s.size() - 1) {
  ------------------
  |  Branch (10024:12): [True: 2.25M, False: 35.4k]
  ------------------
10025|  2.25M|      auto c = s[i++];
10026|  2.25M|      if (c == ' ' || c == '\t' || is_field_vchar(c)) {
  ------------------
  |  Branch (10026:11): [True: 88.1k, False: 2.16M]
  |  Branch (10026:23): [True: 507, False: 2.16M]
  |  Branch (10026:36): [True: 2.16M, False: 32]
  ------------------
10027|  2.25M|      } else {
10028|     32|        return false;
10029|     32|      }
10030|  2.25M|    }
10031|       |
10032|  35.4k|    return is_field_vchar(s[i]);
10033|  35.4k|  }
10034|  45.4k|}
_ZN7httplib6detail6fields14is_field_vcharEc:
10009|  2.24M|inline bool is_field_vchar(char c) { return is_vchar(c) || is_obs_text(c); }
  ------------------
  |  Branch (10009:45): [True: 1.37M, False: 877k]
  |  Branch (10009:60): [True: 877k, False: 67]
  ------------------
_ZN7httplib6detail6fields8is_vcharEc:
10005|  2.24M|inline bool is_vchar(char c) { return c >= 33 && c <= 126; }
  ------------------
  |  Branch (10005:39): [True: 1.37M, False: 877k]
  |  Branch (10005:50): [True: 1.37M, False: 4]
  ------------------
_ZN7httplib6detail6fields11is_obs_textEc:
10007|   877k|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.46k, False: 14.2k]
  ------------------
 1073|  2.83k|        while (idx_ < size_ && !matches(idx_)) {
  ------------------
  |  Branch (1073:16): [True: 1.69k, False: 1.14k]
  |  Branch (1073:32): [True: 369, False: 1.32k]
  ------------------
 1074|    369|          ++idx_;
 1075|    369|        }
 1076|  2.46k|      }
 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.69k|    bool matches(size_type i) const {
 1119|  1.69k|      return keys_equal(data_[i].first, data_[key_idx_].first);
 1120|  1.69k|    }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10keys_equalERKS8_SD_:
 1037|  50.8k|  static bool keys_equal(const std::string &a, const std::string &b) {
 1038|  50.8k|    return KeyEqual()(a, b);
 1039|  50.8k|  }
_ZNK7httplib6detail11case_ignore8equal_toclERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_:
  636|  50.8k|  bool operator()(const std::string &a, const std::string &b) const {
  637|  50.8k|    return equal(a, b);
  638|  50.8k|  }
_ZN7httplib6detail11case_ignore5equalERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  628|  52.4k|inline bool equal(const std::string &a, const std::string &b) {
  629|  52.4k|  return a.size() == b.size() &&
  ------------------
  |  Branch (629:10): [True: 9.95k, False: 42.4k]
  ------------------
  630|  9.95k|         std::equal(a.begin(), a.end(), b.begin(), [](char ca, char cb) {
  ------------------
  |  Branch (630:10): [True: 7.21k, False: 2.73k]
  ------------------
  631|  9.95k|           return to_lower(ca) == to_lower(cb);
  632|  9.95k|         });
  633|  52.4k|}
_ZZN7httplib6detail11case_ignore5equalERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_ENKUlccE_clEcc:
  630|   118k|         std::equal(a.begin(), a.end(), b.begin(), [](char ca, char cb) {
  631|   118k|           return to_lower(ca) == to_lower(cb);
  632|   118k|         });
_ZN7httplib6detail11case_ignore8to_lowerEi:
  596|   237k|inline unsigned char to_lower(int c) {
  597|   237k|  const static unsigned char table[256] = {
  598|   237k|      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  599|   237k|      15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  600|   237k|      30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  601|   237k|      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  602|   237k|      60,  61,  62,  63,  64,  97,  98,  99,  100, 101, 102, 103, 104, 105, 106,
  603|   237k|      107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  604|   237k|      122, 91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  605|   237k|      105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  606|   237k|      120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  607|   237k|      135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  608|   237k|      150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  609|   237k|      165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  610|   237k|      180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 224, 225, 226,
  611|   237k|      227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
  612|   237k|      242, 243, 244, 245, 246, 215, 248, 249, 250, 251, 252, 253, 254, 223, 224,
  613|   237k|      225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  614|   237k|      240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  615|   237k|      255,
  616|   237k|  };
  617|   237k|  return table[(unsigned char)(char)c];
  618|   237k|}
_ZN7httplib6Stream5writeEPKc:
11583|  3.10k|inline ssize_t Stream::write(const char *ptr) {
11584|  3.10k|  return write(ptr, strlen(ptr));
11585|  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:
15829|  3.10k|                                        Error &error) {
15830|       |  // Auto-add Expect: 100-continue for large bodies
15831|  3.10k|  if (CPPHTTPLIB_EXPECT_100_THRESHOLD > 0 && !req.has_header("Expect")) {
  ------------------
  |  |   82|  3.10k|#define CPPHTTPLIB_EXPECT_100_THRESHOLD 1024
  ------------------
  |  Branch (15831:7): [True: 3.10k, Folded]
  |  Branch (15831:7): [True: 3.10k, False: 0]
  |  Branch (15831:46): [True: 3.10k, False: 0]
  ------------------
15832|  3.10k|    auto body_size = req.body.empty() ? req.content_length_ : req.body.size();
  ------------------
  |  Branch (15832:22): [True: 3.10k, False: 0]
  ------------------
15833|  3.10k|    if (body_size >= CPPHTTPLIB_EXPECT_100_THRESHOLD) {
  ------------------
  |  |   82|  3.10k|#define CPPHTTPLIB_EXPECT_100_THRESHOLD 1024
  ------------------
  |  Branch (15833:9): [True: 0, False: 3.10k]
  ------------------
15834|      0|      req.set_header("Expect", "100-continue");
15835|      0|    }
15836|  3.10k|  }
15837|       |
15838|       |  // Check for Expect: 100-continue
15839|  3.10k|  auto expect_100_continue =
15840|  3.10k|      detail::has_header_token(req.headers, "Expect", "100-continue");
15841|       |
15842|       |  // Send request (skip body if using Expect: 100-continue)
15843|  3.10k|  auto write_request_success =
15844|  3.10k|      write_request(strm, req, close_connection, error, expect_100_continue);
15845|       |
15846|       |#ifdef CPPHTTPLIB_SSL_ENABLED
15847|       |  if (is_ssl() && !expect_100_continue) {
15848|       |    auto is_proxy_enabled = is_proxy_enabled_for_host(host_);
15849|       |    if (!is_proxy_enabled) {
15850|       |      if (tls::is_peer_closed(socket_.ssl, socket_.sock)) {
15851|       |        error = Error::SSLPeerCouldBeClosed_;
15852|       |        output_error_log(error, &req);
15853|       |        return false;
15854|       |      }
15855|       |    }
15856|       |  }
15857|       |#endif
15858|       |
15859|       |  // Handle Expect: 100-continue.
15860|       |  //
15861|       |  // Wait for an interim/early response by attempting to read the status line
15862|       |  // under a short timeout, instead of trusting raw socket readability. Over
15863|       |  // TLS, post-handshake records (e.g. session tickets) make the socket
15864|       |  // readable without any HTTP response being available; relying on
15865|       |  // `select_read` there caused the body to be withheld forever and the
15866|       |  // request to fail with `Read` (#2458). If no status line arrives within the
15867|       |  // timeout, send the body anyway (matching curl's behavior).
15868|  3.10k|  auto status_line_read = false;
15869|  3.10k|  if (expect_100_continue && write_request_success) {
  ------------------
  |  Branch (15869:7): [True: 0, False: 3.10k]
  |  Branch (15869:30): [True: 0, False: 0]
  ------------------
15870|      0|    if (CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND > 0) {
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
  |  Branch (15870:9): [True: 0, Folded]
  ------------------
15871|      0|      time_t sec = CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND / 1000;
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
15872|      0|      time_t usec = (CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND % 1000) * 1000;
  ------------------
  |  |   86|      0|#define CPPHTTPLIB_EXPECT_100_TIMEOUT_MSECOND 1000
  ------------------
15873|      0|      strm.set_read_timeout(sec, usec);
15874|      0|      status_line_read = read_response_line(strm, req, res, false);
15875|      0|      strm.set_read_timeout(read_timeout_sec_, read_timeout_usec_);
15876|      0|    }
15877|       |
15878|      0|    if (!status_line_read) {
  ------------------
  |  Branch (15878:9): [True: 0, False: 0]
  ------------------
15879|       |      // No interim response within the timeout: send the body and handle the
15880|       |      // response as usual.
15881|      0|      if (!write_request_body(strm, req, error)) { return false; }
  ------------------
  |  Branch (15881:11): [True: 0, False: 0]
  ------------------
15882|      0|      expect_100_continue = false; // Switch to normal response handling
15883|      0|    }
15884|      0|  }
15885|       |
15886|       |  // Receive response and headers
15887|       |  // When using Expect: 100-continue, don't auto-skip `100 Continue` response
15888|  3.10k|  if ((!status_line_read &&
  ------------------
  |  Branch (15888:8): [True: 3.10k, False: 0]
  ------------------
15889|  3.10k|       !read_response_line(strm, req, res, !expect_100_continue)) ||
  ------------------
  |  Branch (15889:8): [True: 448, False: 2.66k]
  ------------------
15890|  2.66k|      !detail::read_headers(strm, res.headers)) {
  ------------------
  |  Branch (15890:7): [True: 838, False: 1.82k]
  ------------------
15891|  1.28k|    if (write_request_success) { error = Error::Read; }
  ------------------
  |  Branch (15891:9): [True: 1.28k, False: 0]
  ------------------
15892|  1.28k|    output_error_log(error, &req);
15893|  1.28k|    return false;
15894|  1.28k|  }
15895|       |
15896|  1.82k|  if (!write_request_success) { return false; }
  ------------------
  |  Branch (15896:7): [True: 0, False: 1.82k]
  ------------------
15897|       |
15898|       |  // Handle Expect: 100-continue response
15899|  1.82k|  if (expect_100_continue) {
  ------------------
  |  Branch (15899:7): [True: 0, False: 1.82k]
  ------------------
15900|      0|    if (res.status == StatusCode::Continue_100) {
  ------------------
  |  Branch (15900:9): [True: 0, False: 0]
  ------------------
15901|       |      // Server accepted, send the body
15902|      0|      if (!write_request_body(strm, req, error)) { return false; }
  ------------------
  |  Branch (15902:11): [True: 0, False: 0]
  ------------------
15903|       |
15904|       |      // Read the actual response
15905|      0|      res.headers.clear();
15906|      0|      res.body.clear();
15907|      0|      if (!read_response_line(strm, req, res) ||
  ------------------
  |  Branch (15907:11): [True: 0, False: 0]
  ------------------
15908|      0|          !detail::read_headers(strm, res.headers)) {
  ------------------
  |  Branch (15908:11): [True: 0, False: 0]
  ------------------
15909|      0|        error = Error::Read;
15910|      0|        output_error_log(error, &req);
15911|      0|        return false;
15912|      0|      }
15913|      0|    }
15914|       |    // If not 100 Continue, server returned an error; proceed with that response
15915|      0|  }
15916|       |
15917|       |  // Body
15918|  1.82k|  if ((res.status != StatusCode::NoContent_204) && req.method != "HEAD" &&
  ------------------
  |  Branch (15918:7): [True: 1.81k, False: 10]
  |  Branch (15918:52): [True: 1.81k, False: 0]
  ------------------
15919|  1.81k|      req.method != "CONNECT") {
  ------------------
  |  Branch (15919:7): [True: 1.81k, False: 0]
  ------------------
15920|  1.81k|    auto redirect = 300 < res.status && res.status < 400 &&
  ------------------
  |  Branch (15920:21): [True: 799, False: 1.01k]
  |  Branch (15920:41): [True: 246, False: 553]
  ------------------
15921|    246|                    res.status != StatusCode::NotModified_304 &&
  ------------------
  |  Branch (15921:21): [True: 228, False: 18]
  ------------------
15922|    228|                    follow_location_;
  ------------------
  |  Branch (15922:21): [True: 0, False: 228]
  ------------------
15923|       |
15924|  1.81k|    if (req.response_handler && !redirect) {
  ------------------
  |  Branch (15924:9): [True: 0, False: 1.81k]
  |  Branch (15924:33): [True: 0, False: 0]
  ------------------
15925|      0|      if (!req.response_handler(res)) {
  ------------------
  |  Branch (15925:11): [True: 0, False: 0]
  ------------------
15926|      0|        error = Error::Canceled;
15927|      0|        output_error_log(error, &req);
15928|      0|        return false;
15929|      0|      }
15930|      0|    }
15931|       |
15932|  1.81k|    auto out =
15933|  1.81k|        req.content_receiver
  ------------------
  |  Branch (15933:9): [True: 0, False: 1.81k]
  ------------------
15934|  1.81k|            ? static_cast<ContentReceiverWithProgress>(
15935|      0|                  [&](const char *buf, size_t n, size_t off, size_t len) {
15936|      0|                    if (redirect) { return true; }
15937|      0|                    auto ret = req.content_receiver(buf, n, off, len);
15938|      0|                    if (!ret) {
15939|      0|                      error = Error::Canceled;
15940|      0|                      output_error_log(error, &req);
15941|      0|                    }
15942|      0|                    return ret;
15943|      0|                  })
15944|  1.81k|            : static_cast<ContentReceiverWithProgress>(
15945|  1.81k|                  [&](const char *buf, size_t n, size_t /*off*/,
15946|  1.81k|                      size_t /*len*/) {
15947|  1.81k|                    assert(res.body.size() + n <= res.body.max_size());
15948|  1.81k|                    if (payload_max_length_ > 0 &&
15949|  1.81k|                        (res.body.size() >= payload_max_length_ ||
15950|  1.81k|                         n > payload_max_length_ - res.body.size())) {
15951|  1.81k|                      return false;
15952|  1.81k|                    }
15953|  1.81k|                    res.body.append(buf, n);
15954|  1.81k|                    return true;
15955|  1.81k|                  });
15956|       |
15957|  1.81k|    auto progress = [&](size_t current, size_t total) {
15958|  1.81k|      if (!req.download_progress || redirect) { return true; }
15959|  1.81k|      auto ret = req.download_progress(current, total);
15960|  1.81k|      if (!ret) {
15961|  1.81k|        error = Error::Canceled;
15962|  1.81k|        output_error_log(error, &req);
15963|  1.81k|      }
15964|  1.81k|      return ret;
15965|  1.81k|    };
15966|       |
15967|  1.81k|    if (res.has_header("Content-Length")) {
  ------------------
  |  Branch (15967:9): [True: 623, False: 1.19k]
  ------------------
15968|    623|      if (!req.content_receiver) {
  ------------------
  |  Branch (15968:11): [True: 623, False: 0]
  ------------------
15969|    623|        auto len = res.get_header_value_u64("Content-Length");
15970|    623|        if (len > res.body.max_size()) {
  ------------------
  |  Branch (15970:13): [True: 65, False: 558]
  ------------------
15971|     65|          error = Error::Read;
15972|     65|          output_error_log(error, &req);
15973|     65|          return false;
15974|     65|        }
15975|       |        // Cap the reservation by payload_max_length_ to avoid OOM when a
15976|       |        // hostile or malformed server sends an enormous Content-Length.
15977|       |        // The actual body read below is bounded by payload_max_length_,
15978|       |        // so reserving more than that is never useful.
15979|    558|        auto reserve_len = static_cast<size_t>(len);
15980|    558|        if (payload_max_length_ > 0 && reserve_len > payload_max_length_) {
  ------------------
  |  Branch (15980:13): [True: 558, False: 0]
  |  Branch (15980:40): [True: 323, False: 235]
  ------------------
15981|    323|          reserve_len = payload_max_length_;
15982|    323|        }
15983|    558|        res.body.reserve(reserve_len);
15984|    558|      }
15985|    623|    }
15986|       |
15987|  1.74k|    if (res.status != StatusCode::NotModified_304) {
  ------------------
  |  Branch (15987:9): [True: 1.73k, False: 18]
  ------------------
15988|  1.73k|      auto content_status = 0;
15989|  1.73k|      auto max_length = (!has_payload_max_length_ && req.content_receiver)
  ------------------
  |  Branch (15989:26): [True: 1.73k, False: 0]
  |  Branch (15989:54): [True: 0, False: 1.73k]
  ------------------
15990|  1.73k|                            ? (std::numeric_limits<size_t>::max)()
15991|  1.73k|                            : payload_max_length_;
15992|  1.73k|      if (!detail::read_content(strm, res, max_length, content_status,
  ------------------
  |  Branch (15992:11): [True: 1.26k, False: 461]
  ------------------
15993|  1.73k|                                std::move(progress), std::move(out),
15994|  1.73k|                                decompress_)) {
15995|  1.26k|        if (error != Error::Canceled) {
  ------------------
  |  Branch (15995:13): [True: 1.26k, False: 0]
  ------------------
15996|       |          // Tell the caller apart from a plain read failure when the body could
15997|       |          // not be decoded because of its Content-Encoding.
15998|  1.26k|          switch (content_status) {
15999|      2|          case StatusCode::UnsupportedMediaType_415:
  ------------------
  |  Branch (15999:11): [True: 2, False: 1.26k]
  ------------------
16000|      2|            error = Error::UnsupportedContentEncoding;
16001|      2|            break;
16002|      0|          case StatusCode::InternalServerError_500:
  ------------------
  |  Branch (16002:11): [True: 0, False: 1.26k]
  ------------------
16003|      0|            error = Error::Compression;
16004|      0|            break;
16005|  1.26k|          default: error = Error::Read; break;
  ------------------
  |  Branch (16005:11): [True: 1.26k, False: 2]
  ------------------
16006|  1.26k|          }
16007|  1.26k|        }
16008|  1.26k|        output_error_log(error, &req);
16009|  1.26k|        return false;
16010|  1.26k|      }
16011|  1.73k|    }
16012|  1.74k|  }
16013|       |
16014|       |  // Log
16015|    489|  output_log(req, res);
16016|       |
16017|    489|  return true;
16018|  1.82k|}
_ZNK7httplib7Request10has_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
11291|  18.6k|inline bool Request::has_header(const std::string &key) const {
11292|  18.6k|  return detail::has_header(headers, key);
11293|  18.6k|}
_ZN7httplib6detail10has_headerERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_:
 7909|  19.6k|inline bool has_header(const Headers &headers, const std::string &key) {
 7910|  19.6k|  if (is_prohibited_header_name(key)) { return false; }
  ------------------
  |  Branch (7910:7): [True: 0, False: 19.6k]
  ------------------
 7911|  19.6k|  return headers.find(key) != headers.end();
 7912|  19.6k|}
_ZN7httplib6detail25is_prohibited_header_nameERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7897|  19.6k|inline bool is_prohibited_header_name(const std::string &name) {
 7898|  19.6k|  using udl::operator""_t;
 7899|       |
 7900|  19.6k|  switch (str2tag(name)) {
 7901|      0|  case "REMOTE_ADDR"_t:
  ------------------
  |  Branch (7901:3): [True: 0, False: 19.6k]
  ------------------
 7902|      0|  case "REMOTE_PORT"_t:
  ------------------
  |  Branch (7902:3): [True: 0, False: 19.6k]
  ------------------
 7903|      0|  case "LOCAL_ADDR"_t:
  ------------------
  |  Branch (7903:3): [True: 0, False: 19.6k]
  ------------------
 7904|      0|  case "LOCAL_PORT"_t: return true;
  ------------------
  |  Branch (7904:3): [True: 0, False: 19.6k]
  ------------------
 7905|  19.6k|  default: return false;
  ------------------
  |  Branch (7905:3): [True: 19.6k, False: 0]
  ------------------
 7906|  19.6k|  }
 7907|  19.6k|}
_ZN7httplib6detail7str2tagERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7294|  19.6k|inline unsigned int str2tag(const std::string &s) {
 7295|       |  // Iterative form of str2tag_core: the recursive constexpr version is kept
 7296|       |  // for compile-time UDL evaluation of short string literals, but at runtime
 7297|       |  // we may receive arbitrarily long inputs (e.g. fuzzed Content-Type) that
 7298|       |  // would blow the stack with one frame per character.
 7299|  19.6k|  unsigned int h = 0;
 7300|   179k|  for (auto c : s) {
  ------------------
  |  Branch (7300:15): [True: 179k, False: 19.6k]
  ------------------
 7301|   179k|    h = (((std::numeric_limits<unsigned int>::max)() >> 6) & h * 33) ^
 7302|   179k|        static_cast<unsigned char>(c);
 7303|   179k|  }
 7304|  19.6k|  return h;
 7305|  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|  74.7k|    for (size_type i = 0; i < entries_.size(); i++) {
  ------------------
  |  Branch (1264:27): [True: 47.6k, False: 27.1k]
  ------------------
 1265|  47.6k|      if (keys_equal(entries_[i].first, key)) { return i; }
  ------------------
  |  Branch (1265:11): [True: 4.26k, False: 43.3k]
  ------------------
 1266|  47.6k|    }
 1267|  27.1k|    return npos();
 1268|  31.3k|  }
_ZN7httplib7Request10set_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
11305|  8.06k|                                const std::string &val) {
11306|  8.06k|  detail::set_header(headers, key, val);
11307|  8.06k|}
_ZN7httplib6detail10set_headerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_SE_:
 7988|  8.06k|                       const std::string &val) {
 7989|  8.06k|  if (fields::is_field_valid(key, val)) { headers.emplace(key, val); }
  ------------------
  |  Branch (7989:7): [True: 8.06k, False: 0]
  ------------------
 7990|  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_:
 7959|  3.10k|                             const std::string &token) {
 7960|       |  // RFC 9110 7.6.1: a comma-separated token list field such as Connection may
 7961|       |  // carry several tokens, and RFC 9110 5.3 lets that list be split across
 7962|       |  // several lines. Match complete tokens rather than searching the raw value,
 7963|       |  // so that a value such as "notupgrade" is not read as the token "upgrade".
 7964|  3.10k|  auto rng = headers.equal_range(key);
 7965|  3.10k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (7965:29): [True: 0, False: 3.10k]
  ------------------
 7966|      0|    const auto &value = it->second;
 7967|      0|    if (split_find(value.data(), value.data() + value.size(), ',',
  ------------------
  |  Branch (7967:9): [True: 0, False: 0]
  ------------------
 7968|      0|                   [&](const char *b, const char *e) {
 7969|      0|                     return case_ignore::equal(std::string(b, e), token);
 7970|      0|                   })) {
 7971|      0|      return true;
 7972|      0|    }
 7973|      0|  }
 7974|  3.10k|  return false;
 7975|  3.10k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE11equal_rangeERKS8_:
 1198|  7.88k|  equal_range(const std::string &key) const {
 1199|  7.88k|    auto i = index_of(key);
 1200|  7.88k|    return i == npos() ? std::make_pair(end(), end())
  ------------------
  |  Branch (1200:12): [True: 5.58k, False: 2.30k]
  ------------------
 1201|  7.88k|                       : std::make_pair(make_citer(i, i), end());
 1202|  7.88k|  }
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEptEv:
 1064|  5.70k|    pointer operator->() const { return data_ + idx_; }
_ZN7httplib6detail4trimEPKcS2_mm:
 5857|  14.5k|                                      size_t right) {
 5858|  24.5k|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (5858:10): [True: 24.4k, False: 113]
  |  Branch (5858:26): [True: 10.0k, False: 14.4k]
  ------------------
 5859|  10.0k|    left++;
 5860|  10.0k|  }
 5861|  25.0k|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (5861:10): [True: 24.8k, False: 131]
  |  Branch (5861:23): [True: 10.5k, False: 14.3k]
  ------------------
 5862|  10.5k|    right--;
 5863|  10.5k|  }
 5864|  14.5k|  return std::make_pair(left, right);
 5865|  14.5k|}
_ZN7httplib6detail15is_space_or_tabEc:
 5720|  75.2k|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (5720:46): [True: 21.6k, False: 53.6k]
  |  Branch (5720:58): [True: 961, False: 52.6k]
  ------------------
_ZN7httplib10ClientImpl13write_requestERNS_6StreamERNS_7RequestEbRNS_5ErrorEb:
15477|  3.10k|                                      bool skip_body) {
15478|       |  // Prepare additional headers
15479|  3.10k|  if (close_connection) {
  ------------------
  |  Branch (15479:7): [True: 0, False: 3.10k]
  ------------------
15480|      0|    if (!req.has_header("Connection")) {
  ------------------
  |  Branch (15480:9): [True: 0, False: 0]
  ------------------
15481|      0|      req.set_header("Connection", "close");
15482|      0|    }
15483|      0|  }
15484|       |
15485|  3.10k|  std::string ct_for_defaults;
15486|  3.10k|  if (!req.has_header("Content-Type") && !req.body.empty()) {
  ------------------
  |  Branch (15486:7): [True: 3.10k, False: 0]
  |  Branch (15486:7): [True: 0, False: 3.10k]
  |  Branch (15486:42): [True: 0, False: 3.10k]
  ------------------
15487|      0|    ct_for_defaults = "text/plain";
15488|      0|  }
15489|  3.10k|  prepare_default_headers(req, false, ct_for_defaults);
15490|       |
15491|  3.10k|  if (req.body.empty()) {
  ------------------
  |  Branch (15491:7): [True: 3.10k, False: 0]
  ------------------
15492|  3.10k|    if (req.content_provider_) {
  ------------------
  |  Branch (15492:9): [True: 0, False: 3.10k]
  ------------------
15493|      0|      if (!req.is_chunked_content_provider_) {
  ------------------
  |  Branch (15493:11): [True: 0, False: 0]
  ------------------
15494|      0|        if (!req.has_header("Content-Length")) {
  ------------------
  |  Branch (15494:13): [True: 0, False: 0]
  ------------------
15495|      0|          auto length = std::to_string(req.content_length_);
15496|      0|          req.set_header("Content-Length", length);
15497|      0|        }
15498|      0|      }
15499|  3.10k|    } else {
15500|  3.10k|      if (req.method == "POST" || req.method == "PUT" ||
  ------------------
  |  Branch (15500:11): [True: 612, False: 2.49k]
  |  Branch (15500:35): [True: 912, False: 1.58k]
  ------------------
15501|  1.84k|          req.method == "PATCH") {
  ------------------
  |  Branch (15501:11): [True: 322, False: 1.26k]
  ------------------
15502|  1.84k|        req.set_header("Content-Length", "0");
15503|  1.84k|      }
15504|  3.10k|    }
15505|  3.10k|  }
15506|       |
15507|  3.10k|  if (!basic_auth_password_.empty() || !basic_auth_username_.empty()) {
  ------------------
  |  Branch (15507:7): [True: 0, False: 3.10k]
  |  Branch (15507:40): [True: 0, False: 3.10k]
  ------------------
15508|      0|    if (!req.has_header("Authorization")) {
  ------------------
  |  Branch (15508:9): [True: 0, False: 0]
  ------------------
15509|      0|      req.headers.insert(make_basic_authentication_header(
15510|      0|          basic_auth_username_, basic_auth_password_, false));
15511|      0|    }
15512|      0|  }
15513|       |
15514|  3.10k|  if (!bearer_token_auth_token_.empty()) {
  ------------------
  |  Branch (15514:7): [True: 0, False: 3.10k]
  ------------------
15515|      0|    if (!req.has_header("Authorization")) {
  ------------------
  |  Branch (15515:9): [True: 0, False: 0]
  ------------------
15516|      0|      req.headers.insert(make_bearer_token_authentication_header(
15517|      0|          bearer_token_auth_token_, false));
15518|      0|    }
15519|      0|  }
15520|       |
15521|       |  // Proxy-Authorization is only sent when the proxy is actually used for
15522|       |  // this target — otherwise NO_PROXY-matched requests would leak proxy
15523|       |  // credentials directly to the destination server.
15524|  3.10k|  if (is_proxy_enabled_for_host(host_)) {
  ------------------
  |  Branch (15524:7): [True: 0, False: 3.10k]
  ------------------
15525|      0|    if (!proxy_basic_auth_username_.empty() &&
  ------------------
  |  Branch (15525:9): [True: 0, False: 0]
  |  Branch (15525:9): [True: 0, False: 0]
  ------------------
15526|      0|        !proxy_basic_auth_password_.empty() &&
  ------------------
  |  Branch (15526:9): [True: 0, False: 0]
  ------------------
15527|      0|        !req.has_header("Proxy-Authorization")) {
  ------------------
  |  Branch (15527:9): [True: 0, False: 0]
  ------------------
15528|      0|      req.headers.insert(make_basic_authentication_header(
15529|      0|          proxy_basic_auth_username_, proxy_basic_auth_password_, true));
15530|      0|    }
15531|      0|    if (!proxy_bearer_token_auth_token_.empty() &&
  ------------------
  |  Branch (15531:9): [True: 0, False: 0]
  |  Branch (15531:9): [True: 0, False: 0]
  ------------------
15532|      0|        !req.has_header("Proxy-Authorization")) {
  ------------------
  |  Branch (15532:9): [True: 0, False: 0]
  ------------------
15533|      0|      req.headers.insert(make_bearer_token_authentication_header(
15534|      0|          proxy_bearer_token_auth_token_, true));
15535|      0|    }
15536|      0|  }
15537|       |
15538|       |  // Request line and headers
15539|  3.10k|  {
15540|  3.10k|    detail::BufferStream bstrm;
15541|       |
15542|       |    // Extract the query from req.path. The encoding itself is delegated to
15543|       |    // `encode_request_target`; the raw query is still needed here to decide
15544|       |    // between populating `req.params` from it and falling back to building a
15545|       |    // query out of caller-supplied `req.params`.
15546|  3.10k|    auto query_pos = req.path.find('?');
15547|  3.10k|    auto query_part = query_pos == std::string::npos
  ------------------
  |  Branch (15547:23): [True: 3.10k, False: 0]
  ------------------
15548|  3.10k|                          ? std::string()
15549|  3.10k|                          : req.path.substr(query_pos + 1);
15550|       |
15551|  3.10k|    auto path_with_query =
15552|  3.10k|        detail::encode_request_target(req.path, path_encode_);
15553|       |
15554|  3.10k|    if (!query_part.empty()) {
  ------------------
  |  Branch (15554:9): [True: 0, False: 3.10k]
  ------------------
15555|       |      // The query already came in through `req.path`; still populate
15556|       |      // `req.params` for handlers/users who read them.
15557|      0|      detail::parse_query_text(query_part, req.params);
15558|  3.10k|    } else if (!req.params.empty()) {
  ------------------
  |  Branch (15558:16): [True: 0, False: 3.10k]
  ------------------
15559|       |      // No query in `req.path`; build one from `req.params` so existing
15560|       |      // callers that pass `Params` separately continue to work.
15561|      0|      path_with_query = append_query_params(path_with_query, req.params);
15562|      0|    }
15563|       |
15564|       |    // Write request line and headers
15565|  3.10k|    if (detail::write_request_line(bstrm, req.method, path_with_query) < 0) {
  ------------------
  |  Branch (15565:9): [True: 0, False: 3.10k]
  ------------------
15566|       |      // A rejected target (e.g. CR/LF smuggled in via a decoded redirect
15567|       |      // Location under set_path_encode(false)) must fail the request cleanly
15568|       |      // instead of emitting a request-line-less, header-injecting request.
15569|      0|      error = Error::Write;
15570|      0|      output_error_log(error, &req);
15571|      0|      return false;
15572|      0|    }
15573|  3.10k|    if (!detail::check_and_write_headers(bstrm, req.headers, header_writer_,
  ------------------
  |  Branch (15573:9): [True: 0, False: 3.10k]
  ------------------
15574|  3.10k|                                         error)) {
15575|      0|      output_error_log(error, &req);
15576|      0|      return false;
15577|      0|    }
15578|       |
15579|       |    // Flush buffer
15580|  3.10k|    auto &data = bstrm.get_buffer();
15581|  3.10k|    if (!detail::write_data(strm, data.data(), data.size())) {
  ------------------
  |  Branch (15581:9): [True: 0, False: 3.10k]
  ------------------
15582|      0|      error = Error::Write;
15583|      0|      output_error_log(error, &req);
15584|      0|      return false;
15585|      0|    }
15586|  3.10k|  }
15587|       |
15588|       |  // After sending request line and headers, wait briefly for an early server
15589|       |  // response (e.g. 4xx) and avoid sending a potentially large request body
15590|       |  // unnecessarily. This workaround is only enabled on Windows because Unix
15591|       |  // platforms surface write errors (EPIPE) earlier; on Windows kernel send
15592|       |  // buffering can accept large writes even when the peer already responded.
15593|       |  // Check the stream first (which covers SSL via `is_readable()`), then
15594|       |  // fall back to select on the socket. Only perform the wait for very large
15595|       |  // request bodies to avoid interfering with normal small requests and
15596|       |  // reduce side-effects. Poll briefly (up to 50ms as default) for an early
15597|       |  // response. Skip this check when using Expect: 100-continue, as the protocol
15598|       |  // handles early responses properly.
15599|       |#if defined(_WIN32)
15600|       |  if (!skip_body &&
15601|       |      req.body.size() > CPPHTTPLIB_WAIT_EARLY_SERVER_RESPONSE_THRESHOLD &&
15602|       |      req.path.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
15603|       |    auto start = std::chrono::high_resolution_clock::now();
15604|       |
15605|       |    for (;;) {
15606|       |      // Prefer socket-level readiness to avoid SSL_pending() false-positives
15607|       |      // from SSL internals. If the underlying socket is readable, assume an
15608|       |      // early response may be present.
15609|       |      auto sock = strm.socket();
15610|       |      if (sock != INVALID_SOCKET && detail::select_read(sock, 0, 0) > 0) {
15611|       |        return false;
15612|       |      }
15613|       |
15614|       |      // Fallback to stream-level check for non-socket streams or when the
15615|       |      // socket isn't reporting readable. Avoid using `is_readable()` for
15616|       |      // SSL, since `SSL_pending()` may report buffered records that do not
15617|       |      // indicate a complete application-level response yet.
15618|       |      if (!is_ssl() && strm.is_readable()) { return false; }
15619|       |
15620|       |      auto now = std::chrono::high_resolution_clock::now();
15621|       |      auto elapsed =
15622|       |          std::chrono::duration_cast<std::chrono::milliseconds>(now - start)
15623|       |              .count();
15624|       |      if (elapsed >= CPPHTTPLIB_WAIT_EARLY_SERVER_RESPONSE_TIMEOUT_MSECOND) {
15625|       |        break;
15626|       |      }
15627|       |
15628|       |      std::this_thread::sleep_for(std::chrono::milliseconds(1));
15629|       |    }
15630|       |  }
15631|       |#endif
15632|       |
15633|       |  // Body
15634|  3.10k|  if (skip_body) { return true; }
  ------------------
  |  Branch (15634:7): [True: 0, False: 3.10k]
  ------------------
15635|       |
15636|  3.10k|  return write_request_body(strm, req, error);
15637|  3.10k|}
_ZN7httplib10ClientImpl23prepare_default_headersERNS_7RequestEbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
14823|  3.10k|                                                const std::string &ct) {
14824|  3.10k|  (void)for_stream;
14825|  3.10k|  for (const auto &header : default_headers_) {
  ------------------
  |  Branch (14825:27): [True: 0, False: 3.10k]
  ------------------
14826|      0|    if (!r.has_header(header.first)) { r.headers.insert(header); }
  ------------------
  |  Branch (14826:9): [True: 0, False: 0]
  ------------------
14827|      0|  }
14828|       |
14829|       |  // RFC 9110 5.3 recommends sending control data such as Host first, so
14830|       |  // prepend it rather than appending it after the caller's own fields.
14831|  3.10k|  if (!r.has_header("Host")) {
  ------------------
  |  Branch (14831:7): [True: 3.10k, False: 0]
  ------------------
14832|  3.10k|    r.headers.emplace_front(
14833|  3.10k|        "Host", detail::make_default_host_header_value(host_, port_, is_ssl(),
14834|  3.10k|                                                       address_family_));
14835|  3.10k|  }
14836|       |
14837|  3.10k|  if (!r.has_header("Accept")) { r.headers.emplace("Accept", "*/*"); }
  ------------------
  |  Branch (14837:7): [True: 3.10k, False: 0]
  ------------------
14838|       |
14839|  3.10k|  if (!r.content_receiver) {
  ------------------
  |  Branch (14839:7): [True: 3.10k, False: 0]
  ------------------
14840|  3.10k|    if (!r.has_header("Accept-Encoding")) {
  ------------------
  |  Branch (14840:9): [True: 3.10k, False: 0]
  ------------------
14841|  3.10k|      std::string accept_encoding;
14842|       |#ifdef CPPHTTPLIB_BROTLI_SUPPORT
14843|       |      accept_encoding = "br";
14844|       |#endif
14845|  3.10k|#ifdef CPPHTTPLIB_ZLIB_SUPPORT
14846|  3.10k|      if (!accept_encoding.empty()) { accept_encoding += ", "; }
  ------------------
  |  Branch (14846:11): [True: 0, False: 3.10k]
  ------------------
14847|  3.10k|      accept_encoding += "gzip, deflate";
14848|  3.10k|#endif
14849|       |#ifdef CPPHTTPLIB_ZSTD_SUPPORT
14850|       |      if (!accept_encoding.empty()) { accept_encoding += ", "; }
14851|       |      accept_encoding += "zstd";
14852|       |#endif
14853|  3.10k|      r.set_header("Accept-Encoding", accept_encoding);
14854|  3.10k|    }
14855|       |
14856|  3.10k|    detail::add_default_user_agent_header(r);
14857|  3.10k|  }
14858|       |
14859|  3.10k|  if (!r.body.empty()) {
  ------------------
  |  Branch (14859:7): [True: 0, False: 3.10k]
  ------------------
14860|      0|    if (!ct.empty() && !r.has_header("Content-Type")) {
  ------------------
  |  Branch (14860:9): [True: 0, False: 0]
  |  Branch (14860:9): [True: 0, False: 0]
  |  Branch (14860:24): [True: 0, False: 0]
  ------------------
14861|      0|      r.headers.emplace("Content-Type", ct);
14862|      0|    }
14863|      0|    if (!r.has_header("Content-Length")) {
  ------------------
  |  Branch (14863:9): [True: 0, False: 0]
  ------------------
14864|      0|      r.headers.emplace("Content-Length", std::to_string(r.body.size()));
14865|      0|    }
14866|      0|  }
14867|  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.41k|  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.9k|    template <typename U> bool operator!=(const iterator_t<U> &rhs) const {
 1108|  23.9k|      return idx_ != rhs.idx_;
 1109|  23.9k|    }
_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.40k, False: 14.2k]
  ------------------
 1073|  2.21k|        while (idx_ < size_ && !matches(idx_)) {
  ------------------
  |  Branch (1073:16): [True: 1.59k, False: 625]
  |  Branch (1073:32): [True: 819, False: 775]
  ------------------
 1074|    819|          ++idx_;
 1075|    819|        }
 1076|  1.40k|      }
 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.59k|    bool matches(size_type i) const {
 1119|  1.59k|      return keys_equal(data_[i].first, data_[key_idx_].first);
 1120|  1.59k|    }
_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:
12162|  3.10k|                                                  int address_family) {
12163|  3.10k|  if (address_family == AF_UNIX) { return "localhost"; }
  ------------------
  |  Branch (12163:7): [True: 0, False: 3.10k]
  ------------------
12164|  3.10k|  return make_host_and_port_string(host, port, is_ssl);
12165|  3.10k|}
_ZN7httplib6detail25make_host_and_port_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEib:
12139|  3.10k|                                             bool is_ssl) {
12140|  3.10k|  auto result = prepare_host_string(host);
12141|       |
12142|       |  // Append port if not default
12143|  3.10k|  if ((!is_ssl && port == 80) || (is_ssl && port == 443)) {
  ------------------
  |  Branch (12143:8): [True: 3.10k, False: 0]
  |  Branch (12143:19): [True: 0, False: 3.10k]
  |  Branch (12143:35): [True: 0, False: 3.10k]
  |  Branch (12143:45): [True: 0, False: 0]
  ------------------
12144|      0|    ; // do nothing
12145|  3.10k|  } else {
12146|  3.10k|    result += ":" + std::to_string(port);
12147|  3.10k|  }
12148|       |
12149|  3.10k|  return result;
12150|  3.10k|}
_ZN7httplib6detail19prepare_host_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
12126|  3.10k|inline std::string prepare_host_string(const std::string &host) {
12127|       |  // Enclose IPv6 address in brackets (but not if already enclosed)
12128|  3.10k|  if (host.find(':') == std::string::npos ||
  ------------------
  |  Branch (12128:7): [True: 3.10k, False: 0]
  ------------------
12129|  3.10k|      (!host.empty() && host[0] == '[')) {
  ------------------
  |  Branch (12129:8): [True: 0, False: 0]
  |  Branch (12129:25): [True: 0, False: 0]
  ------------------
12130|       |    // IPv4, hostname, or already bracketed IPv6
12131|  3.10k|    return host;
12132|  3.10k|  } else {
12133|       |    // IPv6 address without brackets
12134|      0|    return "[" + host + "]";
12135|      0|  }
12136|  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:
12167|  3.10k|inline void add_default_user_agent_header(Request &req) {
12168|  3.10k|#ifndef CPPHTTPLIB_NO_DEFAULT_USER_AGENT
12169|  3.10k|  if (!req.has_header("User-Agent")) {
  ------------------
  |  Branch (12169:7): [True: 3.10k, False: 0]
  ------------------
12170|  3.10k|    req.set_header("User-Agent",
12171|  3.10k|                   std::string("cpp-httplib/") + CPPHTTPLIB_VERSION);
  ------------------
  |  |   11|  3.10k|#define CPPHTTPLIB_VERSION "0.54.1"
  ------------------
12172|  3.10k|  }
12173|       |#else
12174|       |  (void)req;
12175|       |#endif
12176|  3.10k|}
_ZNK7httplib10ClientImpl25is_proxy_enabled_for_hostERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
14579|  3.10k|ClientImpl::is_proxy_enabled_for_host(const std::string &host) const {
14580|  3.10k|  if (proxy_host_.empty() || proxy_port_ == -1) { return false; }
  ------------------
  |  Branch (14580:7): [True: 3.10k, False: 0]
  |  Branch (14580:30): [True: 0, False: 0]
  ------------------
14581|      0|  if (no_proxy_entries_.empty()) { return true; }
  ------------------
  |  Branch (14581:7): [True: 0, False: 0]
  ------------------
14582|       |  // host_ is const so its normalized form is invariant; cache it. The
14583|       |  // cross-host path (setup_redirect_client passing next_host) re-normalizes.
14584|      0|  if (host == host_) {
  ------------------
  |  Branch (14584:7): [True: 0, False: 0]
  ------------------
14585|      0|    if (!host_normalized_valid_) {
  ------------------
  |  Branch (14585:9): [True: 0, False: 0]
  ------------------
14586|      0|      host_normalized_ = detail::normalize_target(host_);
14587|      0|      host_normalized_valid_ = true;
14588|      0|    }
14589|      0|    return !detail::host_matches_no_proxy(host_normalized_, no_proxy_entries_);
14590|      0|  }
14591|      0|  auto target = detail::normalize_target(host);
14592|      0|  return !detail::host_matches_no_proxy(target, no_proxy_entries_);
14593|      0|}
_ZN7httplib6detail12BufferStreamC2Ev:
 3670|  3.10k|  BufferStream() = default;
_ZN7httplib6detail21encode_request_targetERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEb:
 8861|  3.10k|                                         bool path_encode) {
 8862|       |  // `substr(0, npos)` yields the whole string, which is what the no-query
 8863|       |  // case needs.
 8864|  3.10k|  auto query_pos = target.find('?');
 8865|  3.10k|  auto path_part = target.substr(0, query_pos);
 8866|  3.10k|  std::string query_part;
 8867|  3.10k|  if (query_pos != std::string::npos) {
  ------------------
  |  Branch (8867:7): [True: 0, False: 3.10k]
  ------------------
 8868|      0|    query_part = target.substr(query_pos + 1);
 8869|      0|  }
 8870|       |
 8871|  3.10k|  auto result = path_encode ? encode_path(path_part) : std::move(path_part);
  ------------------
  |  Branch (8871:17): [True: 3.10k, False: 0]
  ------------------
 8872|       |
 8873|  3.10k|  if (!query_part.empty()) {
  ------------------
  |  Branch (8873:7): [True: 0, False: 3.10k]
  ------------------
 8874|       |    // When path encoding is disabled the caller has supplied an already-encoded
 8875|       |    // target and expects the exact bytes to be sent on the wire, so skip
 8876|       |    // normalization for the query too. Normalizing would decode-then-re-encode
 8877|       |    // it and corrupt pre-encoded binary payloads (e.g. turning `%20` into `+`,
 8878|       |    // which a strict RFC 3986 server decodes back as `+`, not a space).
 8879|      0|    if (path_encode) {
  ------------------
  |  Branch (8879:9): [True: 0, False: 0]
  ------------------
 8880|      0|      auto normalized = normalize_query_string(query_part);
 8881|      0|      if (!normalized.empty()) {
  ------------------
  |  Branch (8881:11): [True: 0, False: 0]
  ------------------
 8882|      0|        result += '?';
 8883|      0|        result += normalized;
 8884|      0|      }
 8885|      0|    } else {
 8886|      0|      result += '?';
 8887|      0|      result += query_part;
 8888|      0|    }
 8889|      0|  }
 8890|       |
 8891|  3.10k|  return result;
 8892|  3.10k|}
_ZN7httplib6detail11encode_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5681|  3.10k|inline std::string encode_path(const std::string &s) {
 5682|  3.10k|  std::string result;
 5683|  3.10k|  result.reserve(s.size());
 5684|       |
 5685|  6.21k|  for (size_t i = 0; s[i]; i++) {
  ------------------
  |  Branch (5685:22): [True: 3.10k, False: 3.10k]
  ------------------
 5686|  3.10k|    switch (s[i]) {
 5687|      0|    case ' ': result += "%20"; break;
  ------------------
  |  Branch (5687:5): [True: 0, False: 3.10k]
  ------------------
 5688|      0|    case '+': result += "%2B"; break;
  ------------------
  |  Branch (5688:5): [True: 0, False: 3.10k]
  ------------------
 5689|      0|    case '\r': result += "%0D"; break;
  ------------------
  |  Branch (5689:5): [True: 0, False: 3.10k]
  ------------------
 5690|      0|    case '\n': result += "%0A"; break;
  ------------------
  |  Branch (5690:5): [True: 0, False: 3.10k]
  ------------------
 5691|      0|    case '\'': result += "%27"; break;
  ------------------
  |  Branch (5691:5): [True: 0, False: 3.10k]
  ------------------
 5692|      0|    case ',': result += "%2C"; break;
  ------------------
  |  Branch (5692:5): [True: 0, False: 3.10k]
  ------------------
 5693|       |    // case ':': result += "%3A"; break; // ok? probably...
 5694|      0|    case ';': result += "%3B"; break;
  ------------------
  |  Branch (5694:5): [True: 0, False: 3.10k]
  ------------------
 5695|  3.10k|    default:
  ------------------
  |  Branch (5695:5): [True: 3.10k, False: 0]
  ------------------
 5696|  3.10k|      auto c = static_cast<uint8_t>(s[i]);
 5697|  3.10k|      if (c >= 0x80) {
  ------------------
  |  Branch (5697:11): [True: 0, False: 3.10k]
  ------------------
 5698|      0|        result += '%';
 5699|      0|        char hex[4];
 5700|      0|        auto len = snprintf(hex, sizeof(hex) - 1, "%02X", c);
 5701|      0|        assert(len == 2);
  ------------------
  |  Branch (5701:9): [True: 0, False: 0]
  ------------------
 5702|      0|        result.append(hex, static_cast<size_t>(len));
 5703|  3.10k|      } else {
 5704|  3.10k|        result += s[i];
 5705|  3.10k|      }
 5706|  3.10k|      break;
 5707|  3.10k|    }
 5708|  3.10k|  }
 5709|       |
 5710|  3.10k|  return result;
 5711|  3.10k|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 5901|  1.28k|                  std::function<void(const char *, const char *)> fn) {
 5902|  1.28k|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 5903|  1.28k|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 5906|  1.28k|                  std::function<void(const char *, const char *)> fn) {
 5907|  1.28k|  size_t i = 0;
 5908|  1.28k|  size_t beg = 0;
 5909|  1.28k|  size_t count = 1;
 5910|       |
 5911|   183k|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (5911:10): [True: 183k, False: 0]
  |  Branch (5911:10): [True: 181k, False: 1.28k]
  ------------------
 5912|   181k|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (5912:9): [True: 13.3k, False: 168k]
  |  Branch (5912:22): [True: 13.3k, False: 0]
  ------------------
 5913|  13.3k|      auto r = trim(b, e, beg, i);
 5914|  13.3k|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5914:11): [True: 4.33k, False: 9.06k]
  ------------------
 5915|  13.3k|      beg = i + 1;
 5916|  13.3k|      count++;
 5917|  13.3k|    }
 5918|   181k|    i++;
 5919|   181k|  }
 5920|       |
 5921|  1.28k|  if (i) {
  ------------------
  |  Branch (5921:7): [True: 1.11k, False: 170]
  ------------------
 5922|  1.11k|    auto r = trim(b, e, beg, i);
 5923|  1.11k|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5923:9): [True: 1.00k, False: 113]
  ------------------
 5924|  1.11k|  }
 5925|  1.28k|}
_ZN7httplib6detail6is_hexEcRi:
 5073|  15.8k|inline bool is_hex(char c, int &v) {
 5074|  15.8k|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5074:7): [True: 8.09k, False: 7.75k]
  ------------------
 5075|  8.09k|    v = c - '0';
 5076|  8.09k|    return true;
 5077|  8.09k|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5077:14): [True: 3.76k, False: 3.98k]
  |  Branch (5077:26): [True: 1.17k, False: 2.59k]
  ------------------
 5078|  1.17k|    v = c - 'A' + 10;
 5079|  1.17k|    return true;
 5080|  6.57k|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5080:14): [True: 2.58k, False: 3.99k]
  |  Branch (5080:26): [True: 2.56k, False: 19]
  ------------------
 5081|  2.56k|    v = c - 'a' + 10;
 5082|  2.56k|    return true;
 5083|  2.56k|  }
 5084|  4.01k|  return false;
 5085|  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_:
 8390|  3.10k|                                  const std::string &path) {
 8391|       |  // A request target must not carry CR/LF (or other control octets); otherwise
 8392|       |  // a value smuggled into it splits the request line and injects headers or a
 8393|       |  // whole request. The same field-value check already guards header values in
 8394|       |  // check_and_write_headers and the request target in
 8395|       |  // perform_websocket_handshake; apply it here too.
 8396|  3.10k|  if (!fields::is_field_value(path)) { return -1; }
  ------------------
  |  Branch (8396:7): [True: 0, False: 3.10k]
  ------------------
 8397|       |
 8398|  3.10k|  std::string s = method;
 8399|  3.10k|  s += ' ';
 8400|  3.10k|  s += path;
 8401|  3.10k|  s += " HTTP/1.1\r\n";
 8402|  3.10k|  return strm.write(s.data(), s.size());
 8403|  3.10k|}
_ZN7httplib6detail23check_and_write_headersINSt3__18functionIFlRNS_6StreamERNS0_26insertion_ordered_multimapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEEEEEEEbS5_SG_T_RNS_5ErrorE:
12350|  3.10k|                                    T header_writer, Error &error) {
12351|  14.2k|  for (const auto &h : headers) {
  ------------------
  |  Branch (12351:22): [True: 14.2k, False: 3.10k]
  ------------------
12352|  14.2k|    if (!detail::fields::is_field_valid(h.first, h.second)) {
  ------------------
  |  Branch (12352:9): [True: 0, False: 14.2k]
  ------------------
12353|      0|      error = Error::InvalidHeaders;
12354|      0|      return false;
12355|      0|    }
12356|  14.2k|  }
12357|  3.10k|  if (header_writer(strm, headers) <= 0) {
  ------------------
  |  Branch (12357:7): [True: 0, False: 3.10k]
  ------------------
12358|      0|    error = Error::Write;
12359|      0|    return false;
12360|      0|  }
12361|  3.10k|  return true;
12362|  3.10k|}
_ZNK7httplib6detail12BufferStream10get_bufferEv:
12017|  3.10k|inline const std::string &BufferStream::get_buffer() const { return buffer; }
_ZN7httplib6detail10write_dataERNS_6StreamEPKcm:
 8440|  3.10k|inline bool write_data(Stream &strm, const char *d, size_t l) {
 8441|  3.10k|  size_t offset = 0;
 8442|  6.21k|  while (offset < l) {
  ------------------
  |  Branch (8442:10): [True: 3.10k, False: 3.10k]
  ------------------
 8443|  3.10k|    auto length = strm.write(d + offset, l - offset);
 8444|  3.10k|    if (length < 0) { return false; }
  ------------------
  |  Branch (8444:9): [True: 0, False: 3.10k]
  ------------------
 8445|  3.10k|    offset += static_cast<size_t>(length);
 8446|  3.10k|  }
 8447|  3.10k|  return true;
 8448|  3.10k|}
_ZNK7httplib10ClientImpl18read_response_lineERNS_6StreamERKNS_7RequestERNS_8ResponseEb:
14676|  3.10k|                                           bool skip_100_continue) const {
14677|  3.10k|  std::array<char, 2048> buf{};
14678|       |
14679|  3.10k|  detail::stream_line_reader line_reader(strm, buf.data(), buf.size());
14680|       |
14681|  3.10k|  if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (14681:7): [True: 9, False: 3.10k]
  ------------------
14682|       |
14683|  3.10k|  if (!detail::parse_status_line(line_reader.ptr(), res.version, res.status,
  ------------------
  |  Branch (14683:7): [True: 232, False: 2.86k]
  ------------------
14684|  3.10k|                                 res.reason)) {
14685|    232|    return req.method == "CONNECT";
14686|    232|  }
14687|       |
14688|       |  // Ignore '100 Continue' (only when not using Expect: 100-continue explicitly)
14689|  8.61k|  while (skip_100_continue && res.status == StatusCode::Continue_100) {
  ------------------
  |  Branch (14689:10): [True: 8.61k, False: 0]
  |  Branch (14689:31): [True: 5.95k, False: 2.66k]
  ------------------
14690|  5.95k|    if (!line_reader.getline()) { return false; } // CRLF
  ------------------
  |  Branch (14690:9): [True: 62, False: 5.89k]
  ------------------
14691|  5.89k|    if (!line_reader.getline()) { return false; } // next response line
  ------------------
  |  Branch (14691:9): [True: 14, False: 5.88k]
  ------------------
14692|       |
14693|  5.88k|    if (!detail::parse_status_line(line_reader.ptr(), res.version, res.status,
  ------------------
  |  Branch (14693:9): [True: 131, False: 5.75k]
  ------------------
14694|  5.88k|                                   res.reason)) {
14695|    131|      return false;
14696|    131|    }
14697|  5.88k|  }
14698|       |
14699|  2.66k|  return true;
14700|  2.86k|}
_ZN7httplib6detail18stream_line_readerC2ERNS_6StreamEPcm:
 6014|  13.3k|    : strm_(strm), fixed_buffer_(fixed_buffer),
 6015|  13.3k|      fixed_buffer_size_(fixed_buffer_size) {}
_ZN7httplib6detail18stream_line_reader7getlineEv:
 6038|  39.0k|inline bool stream_line_reader::getline() {
 6039|  39.0k|  fixed_buffer_used_size_ = 0;
 6040|  39.0k|  growable_buffer_.clear();
 6041|       |
 6042|  39.0k|#ifndef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6043|  39.0k|  char prev_byte = 0;
 6044|  39.0k|#endif
 6045|       |
 6046|  3.65M|  for (size_t i = 0;; i++) {
 6047|       |    // Fast path: whatever the stream has already buffered can be scanned for
 6048|       |    // the terminator in one pass. Asking for a byte at a time costs a virtual
 6049|       |    // call, a bounds check and a one-byte copy per character of the request.
 6050|  3.65M|    size_t buffered_size = 0;
 6051|  3.65M|    if (auto buffered = strm_.buffered_data(buffered_size)) {
  ------------------
  |  Branch (6051:14): [True: 0, False: 3.65M]
  ------------------
 6052|      0|      auto take = buffered_size;
 6053|      0|      auto terminated = false;
 6054|       |
 6055|      0|      for (size_t at = 0; at < buffered_size;) {
  ------------------
  |  Branch (6055:27): [True: 0, False: 0]
  ------------------
 6056|      0|        auto nl = static_cast<const char *>(
 6057|      0|            memchr(buffered + at, '\n', buffered_size - at));
 6058|      0|        if (!nl) { break; }
  ------------------
  |  Branch (6058:13): [True: 0, False: 0]
  ------------------
 6059|      0|        auto pos = static_cast<size_t>(nl - buffered);
 6060|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6061|       |        take = pos + 1;
 6062|       |        terminated = true;
 6063|       |        break;
 6064|       |#else
 6065|       |        // A bare LF does not end the line; keep looking for CRLF. The CR may
 6066|       |        // be the last byte of an earlier chunk, hence prev_byte.
 6067|      0|        if ((pos > 0 ? buffered[pos - 1] : prev_byte) == '\r') {
  ------------------
  |  Branch (6067:13): [True: 0, False: 0]
  |  Branch (6067:14): [True: 0, False: 0]
  ------------------
 6068|      0|          take = pos + 1;
 6069|      0|          terminated = true;
 6070|      0|          break;
 6071|      0|        }
 6072|      0|        at = pos + 1;
 6073|      0|#endif
 6074|      0|      }
 6075|       |
 6076|      0|      if (size() + take > CPPHTTPLIB_MAX_LINE_LENGTH) { return false; }
  ------------------
  |  |  211|      0|#define CPPHTTPLIB_MAX_LINE_LENGTH 32768
  ------------------
  |  Branch (6076:11): [True: 0, False: 0]
  ------------------
 6077|      0|#ifndef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6078|      0|      prev_byte = buffered[take - 1];
 6079|      0|#endif
 6080|      0|      append(buffered, take);
 6081|      0|      strm_.consume_buffered(take);
 6082|      0|      i += take;
 6083|      0|      if (terminated) { return true; }
  ------------------
  |  Branch (6083:11): [True: 0, False: 0]
  ------------------
 6084|      0|      continue;
 6085|      0|    }
 6086|       |
 6087|  3.65M|    if (size() >= CPPHTTPLIB_MAX_LINE_LENGTH) {
  ------------------
  |  |  211|  3.65M|#define CPPHTTPLIB_MAX_LINE_LENGTH 32768
  ------------------
  |  Branch (6087:9): [True: 3, False: 3.65M]
  ------------------
 6088|       |      // Treat exceptionally long lines as an error to
 6089|       |      // prevent infinite loops/memory exhaustion
 6090|      3|      return false;
 6091|      3|    }
 6092|  3.65M|    char byte;
 6093|  3.65M|    auto n = strm_.read(&byte, 1);
 6094|       |
 6095|  3.65M|    if (n < 0) {
  ------------------
  |  Branch (6095:9): [True: 0, False: 3.65M]
  ------------------
 6096|      0|      return false;
 6097|  3.65M|    } else if (n == 0) {
  ------------------
  |  Branch (6097:16): [True: 1.38k, False: 3.65M]
  ------------------
 6098|  1.38k|      if (i == 0) {
  ------------------
  |  Branch (6098:11): [True: 480, False: 900]
  ------------------
 6099|    480|        return false;
 6100|    900|      } else {
 6101|    900|        break;
 6102|    900|      }
 6103|  1.38k|    }
 6104|       |
 6105|  3.65M|    append(byte);
 6106|       |
 6107|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 6108|       |    if (byte == '\n') { break; }
 6109|       |#else
 6110|  3.65M|    if (prev_byte == '\r' && byte == '\n') { break; }
  ------------------
  |  Branch (6110:9): [True: 38.2k, False: 3.61M]
  |  Branch (6110:30): [True: 37.6k, False: 563]
  ------------------
 6111|  3.61M|    prev_byte = byte;
 6112|  3.61M|#endif
 6113|  3.61M|  }
 6114|       |
 6115|  38.5k|  return true;
 6116|  39.0k|}
_ZNK7httplib6detail18stream_line_reader4sizeEv:
 6025|  3.71M|inline size_t stream_line_reader::size() const {
 6026|  3.71M|  if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6026:7): [True: 1.89M, False: 1.82M]
  ------------------
 6027|  1.89M|    return fixed_buffer_used_size_;
 6028|  1.89M|  } else {
 6029|  1.82M|    return growable_buffer_.size();
 6030|  1.82M|  }
 6031|  3.71M|}
_ZN7httplib6detail18stream_line_reader6appendEPKcm:
 6120|  3.65M|inline void stream_line_reader::append(const char *data, size_t size) {
 6121|       |  // Once the line has outgrown the fixed buffer everything must keep going to
 6122|       |  // the growable one, even if a later chunk would have fit. Without the
 6123|       |  // emptiness check a short append after a long one would land in the fixed
 6124|       |  // buffer, which ptr() and size() no longer look at, and be lost.
 6125|  3.65M|  if (growable_buffer_.empty() &&
  ------------------
  |  Branch (6125:7): [True: 1.82M, False: 1.82M]
  ------------------
 6126|  1.82M|      fixed_buffer_used_size_ + size < fixed_buffer_size_) {
  ------------------
  |  Branch (6126:7): [True: 1.82M, False: 972]
  ------------------
 6127|  1.82M|    memcpy(fixed_buffer_ + fixed_buffer_used_size_, data, size);
 6128|  1.82M|    fixed_buffer_used_size_ += size;
 6129|  1.82M|    fixed_buffer_[fixed_buffer_used_size_] = '\0';
 6130|  1.82M|  } else {
 6131|       |    // Unlike the per-character overload, this can be the very first append of
 6132|       |    // the line, so the fixed buffer may hold nothing and carry no terminator
 6133|       |    // yet. assign() takes an explicit length and does not need one.
 6134|  1.82M|    if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6134:9): [True: 972, False: 1.82M]
  ------------------
 6135|    972|      growable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_);
 6136|    972|    }
 6137|  1.82M|    growable_buffer_.append(data, size);
 6138|  1.82M|  }
 6139|  3.65M|}
_ZN7httplib6detail18stream_line_reader6appendEc:
 6118|  3.65M|inline void stream_line_reader::append(char c) { append(&c, 1); }
_ZN7httplib6detail17parse_status_lineEPKcRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERiSA_:
 8049|  8.98k|                              int &status, std::string &reason) {
 8050|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 8051|       |  thread_local const std::regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r?\n");
 8052|       |#else
 8053|  8.98k|  thread_local const std::regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r\n");
 8054|  8.98k|#endif
 8055|       |
 8056|  8.98k|  std::cmatch m;
 8057|  8.98k|  if (!std::regex_match(line, m, re)) { return false; }
  ------------------
  |  Branch (8057:7): [True: 363, False: 8.61k]
  ------------------
 8058|  8.61k|  version = std::string(m[1]);
 8059|  8.61k|  status = std::stoi(std::string(m[2]));
 8060|  8.61k|  reason = std::string(m[3]);
 8061|  8.61k|  return true;
 8062|  8.98k|}
_ZNK7httplib6detail18stream_line_reader3ptrEv:
 6017|  61.0k|inline const char *stream_line_reader::ptr() const {
 6018|  61.0k|  if (growable_buffer_.empty()) {
  ------------------
  |  Branch (6018:7): [True: 58.3k, False: 2.73k]
  ------------------
 6019|  58.3k|    return fixed_buffer_;
 6020|  58.3k|  } else {
 6021|  2.73k|    return growable_buffer_.data();
 6022|  2.73k|  }
 6023|  61.0k|}
_ZN7httplib10ClientImpl18write_request_bodyERNS_6StreamERNS_7RequestERNS_5ErrorE:
15640|  3.10k|                                           Error &error) {
15641|  3.10k|  if (req.body.empty()) {
  ------------------
  |  Branch (15641:7): [True: 3.10k, False: 0]
  ------------------
15642|  3.10k|    return write_content_with_provider(strm, req, error);
15643|  3.10k|  }
15644|       |
15645|      0|  if (req.upload_progress) {
  ------------------
  |  Branch (15645:7): [True: 0, False: 0]
  ------------------
15646|      0|    auto body_size = req.body.size();
15647|      0|    size_t written = 0;
15648|      0|    auto data = req.body.data();
15649|       |
15650|      0|    while (written < body_size) {
  ------------------
  |  Branch (15650:12): [True: 0, False: 0]
  ------------------
15651|      0|      size_t to_write = (std::min)(CPPHTTPLIB_SEND_BUFSIZ, body_size - written);
  ------------------
  |  |  176|      0|#define CPPHTTPLIB_SEND_BUFSIZ size_t(16384u)
  ------------------
15652|      0|      if (!detail::write_data(strm, data + written, to_write)) {
  ------------------
  |  Branch (15652:11): [True: 0, False: 0]
  ------------------
15653|      0|        error = Error::Write;
15654|      0|        output_error_log(error, &req);
15655|      0|        return false;
15656|      0|      }
15657|      0|      written += to_write;
15658|       |
15659|      0|      if (!req.upload_progress(written, body_size)) {
  ------------------
  |  Branch (15659:11): [True: 0, False: 0]
  ------------------
15660|      0|        error = Error::Canceled;
15661|      0|        output_error_log(error, &req);
15662|      0|        return false;
15663|      0|      }
15664|      0|    }
15665|      0|  } else {
15666|      0|    if (!detail::write_data(strm, req.body.data(), req.body.size())) {
  ------------------
  |  Branch (15666:9): [True: 0, False: 0]
  ------------------
15667|      0|      error = Error::Write;
15668|      0|      output_error_log(error, &req);
15669|      0|      return false;
15670|      0|    }
15671|      0|  }
15672|       |
15673|      0|  return true;
15674|      0|}
_ZNK7httplib10ClientImpl27write_content_with_providerERNS_6StreamERKNS_7RequestERNS_5ErrorE:
15456|  3.10k|                                                    Error &error) const {
15457|  3.10k|  auto is_shutting_down = []() { return false; };
15458|       |
15459|  3.10k|  if (req.is_chunked_content_provider_) {
  ------------------
  |  Branch (15459:7): [True: 0, False: 3.10k]
  ------------------
15460|      0|    auto compressor = compress_ ? detail::create_compressor().first
  ------------------
  |  Branch (15460:23): [True: 0, False: 0]
  ------------------
15461|      0|                                : std::unique_ptr<detail::compressor>();
15462|      0|    if (!compressor) {
  ------------------
  |  Branch (15462:9): [True: 0, False: 0]
  ------------------
15463|      0|      compressor = detail::make_unique<detail::nocompressor>();
15464|      0|    }
15465|       |
15466|      0|    return detail::write_content_chunked(strm, req.content_provider_,
15467|      0|                                         is_shutting_down, *compressor, error);
15468|  3.10k|  } else {
15469|  3.10k|    return detail::write_content_with_progress(
15470|  3.10k|        strm, req.content_provider_, 0, req.content_length_, is_shutting_down,
15471|  3.10k|        req.upload_progress, error);
15472|  3.10k|  }
15473|  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_:
 8456|  3.10k|                                        Error &error) {
 8457|  3.10k|  size_t end_offset = offset + length;
 8458|  3.10k|  size_t start_offset = offset;
 8459|  3.10k|  auto ok = true;
 8460|  3.10k|  auto finished = false;
 8461|  3.10k|  DataSink data_sink;
 8462|       |
 8463|  3.10k|  data_sink.write = [&](const char *d, size_t l) -> bool {
 8464|  3.10k|    if (ok) {
 8465|  3.10k|      if (write_data(strm, d, l)) {
 8466|  3.10k|        offset += l;
 8467|       |
 8468|  3.10k|        if (upload_progress && length > 0) {
 8469|  3.10k|          size_t current_written = offset - start_offset;
 8470|  3.10k|          if (!upload_progress(current_written, length)) {
 8471|  3.10k|            ok = false;
 8472|  3.10k|            return false;
 8473|  3.10k|          }
 8474|  3.10k|        }
 8475|  3.10k|      } else {
 8476|  3.10k|        ok = false;
 8477|  3.10k|      }
 8478|  3.10k|    }
 8479|  3.10k|    return ok;
 8480|  3.10k|  };
 8481|       |
 8482|  3.10k|  data_sink.is_writable = [&]() -> bool { return strm.is_peer_alive(); };
 8483|       |
 8484|       |  // The body is framed by `length`, so a provider that reports itself done
 8485|       |  // early has truncated it. Record that and let the short-body check below
 8486|       |  // fail the write, rather than calling the provider again forever.
 8487|  3.10k|  data_sink.done = [&]() { finished = true; };
 8488|       |
 8489|  3.10k|  while (offset < end_offset && !finished && !is_shutting_down()) {
  ------------------
  |  Branch (8489:10): [True: 0, False: 3.10k]
  |  Branch (8489:33): [True: 0, False: 0]
  |  Branch (8489:46): [True: 0, False: 0]
  ------------------
 8490|      0|    auto last_offset = offset;
 8491|       |
 8492|      0|    if (!strm.wait_writable() || !strm.is_peer_alive()) {
  ------------------
  |  Branch (8492:9): [True: 0, False: 0]
  |  Branch (8492:34): [True: 0, False: 0]
  ------------------
 8493|      0|      error = Error::Write;
 8494|      0|      return false;
 8495|      0|    } else if (!content_provider(offset, end_offset - offset, data_sink)) {
  ------------------
  |  Branch (8495:16): [True: 0, False: 0]
  ------------------
 8496|      0|      error = Error::Canceled;
 8497|      0|      return false;
 8498|      0|    } else if (!ok) {
  ------------------
  |  Branch (8498:16): [True: 0, False: 0]
  ------------------
 8499|      0|      error = Error::Write;
 8500|      0|      return false;
 8501|      0|    }
 8502|       |
 8503|       |    // A provider that reports success without writing anything and without
 8504|       |    // reporting itself done gets handed the same offset and length again on
 8505|       |    // the next pass, so it would spin here for as long as the peer stays
 8506|       |    // connected. Treat making no progress as a short body, like done() early.
 8507|      0|    if (!finished && offset == last_offset) {
  ------------------
  |  Branch (8507:9): [True: 0, False: 0]
  |  Branch (8507:22): [True: 0, False: 0]
  ------------------
 8508|      0|      error = Error::Write;
 8509|      0|      return false;
 8510|      0|    }
 8511|      0|  }
 8512|       |
 8513|  3.10k|  if (offset < end_offset) { // done() called early, or is_shutting_down()
  ------------------
  |  Branch (8513:7): [True: 0, False: 3.10k]
  ------------------
 8514|      0|    error = Error::Write;
 8515|      0|    return false;
 8516|      0|  }
 8517|       |
 8518|  3.10k|  error = Error::Success;
 8519|  3.10k|  return true;
 8520|  3.10k|}
_ZN7httplib6detail12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEE:
 7992|  2.66k|inline bool read_headers(Stream &strm, Headers &headers) {
 7993|  2.66k|  const auto bufsiz = 2048;
 7994|  2.66k|  char buf[bufsiz];
 7995|  2.66k|  stream_line_reader line_reader(strm, buf, bufsiz);
 7996|       |
 7997|  2.66k|  size_t header_count = 0;
 7998|       |
 7999|  12.8k|  for (;;) {
 8000|  12.8k|    if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (8000:9): [True: 297, False: 12.5k]
  ------------------
 8001|       |
 8002|       |    // Check if the line ends with CRLF.
 8003|  12.5k|    auto line_terminator_len = 2;
 8004|  12.5k|    if (line_reader.end_with_crlf()) {
  ------------------
  |  Branch (8004:9): [True: 12.5k, False: 69]
  ------------------
 8005|       |      // Blank line indicates end of headers.
 8006|  12.5k|      if (line_reader.size() == 2) { break; }
  ------------------
  |  Branch (8006:11): [True: 2.00k, False: 10.5k]
  ------------------
 8007|  12.5k|    } else {
 8008|       |#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
 8009|       |      // Blank line indicates end of headers.
 8010|       |      if (line_reader.size() == 1) { break; }
 8011|       |      line_terminator_len = 1;
 8012|       |#else
 8013|     69|      continue; // Skip invalid line.
 8014|     69|#endif
 8015|     69|    }
 8016|       |
 8017|  10.5k|    if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; }
  ------------------
  |  |  114|  10.5k|#define CPPHTTPLIB_HEADER_MAX_LENGTH 8192
  ------------------
  |  Branch (8017:9): [True: 4, False: 10.5k]
  ------------------
 8018|       |
 8019|       |    // Check header count limit
 8020|  10.5k|    if (header_count >= CPPHTTPLIB_HEADER_MAX_COUNT) { return false; }
  ------------------
  |  |  118|  10.5k|#define CPPHTTPLIB_HEADER_MAX_COUNT 100
  ------------------
  |  Branch (8020:9): [True: 1, False: 10.5k]
  ------------------
 8021|       |
 8022|       |    // Exclude line terminator
 8023|  10.5k|    auto end = line_reader.ptr() + line_reader.size() - line_terminator_len;
 8024|       |
 8025|  10.5k|    if (!parse_header(line_reader.ptr(), end,
  ------------------
  |  Branch (8025:9): [True: 356, False: 10.1k]
  ------------------
 8026|  10.5k|                      [&](const std::string &key, const std::string &val) {
 8027|  10.5k|                        headers.emplace(key, val);
 8028|  10.5k|                      })) {
 8029|    356|      return false;
 8030|    356|    }
 8031|       |
 8032|  10.1k|    header_count++;
 8033|  10.1k|  }
 8034|       |
 8035|       |  // RFC 9110 Section 8.6: Reject requests with multiple Content-Length
 8036|       |  // headers that have different values to prevent request smuggling.
 8037|  2.00k|  auto cl_range = headers.equal_range("Content-Length");
 8038|  2.00k|  if (cl_range.first != cl_range.second) {
  ------------------
  |  Branch (8038:7): [True: 805, False: 1.19k]
  ------------------
 8039|    805|    const auto &first_val = cl_range.first->second;
 8040|  1.40k|    for (auto it = std::next(cl_range.first); it != cl_range.second; ++it) {
  ------------------
  |  Branch (8040:47): [True: 775, False: 625]
  ------------------
 8041|    775|      if (it->second != first_val) { return false; }
  ------------------
  |  Branch (8041:11): [True: 180, False: 595]
  ------------------
 8042|    775|    }
 8043|    805|  }
 8044|       |
 8045|  1.82k|  return true;
 8046|  2.00k|}
_ZNK7httplib6detail18stream_line_reader13end_with_crlfEv:
 6033|  12.5k|inline bool stream_line_reader::end_with_crlf() const {
 6034|  12.5k|  auto end = ptr() + size();
 6035|  12.5k|  return size() >= 2 && end[-2] == '\r' && end[-1] == '\n';
  ------------------
  |  Branch (6035:10): [True: 12.5k, False: 32]
  |  Branch (6035:25): [True: 12.5k, False: 20]
  |  Branch (6035:44): [True: 12.5k, False: 17]
  ------------------
 6036|  12.5k|}
_ZN7httplib6detail12parse_headerIZNS0_12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS0_11case_ignore8equal_toEEEEUlRKSB_SH_E_EEbPKcSK_T_:
 5726|  10.5k|inline bool parse_header(const char *beg, const char *end, T fn) {
 5727|       |  // Skip trailing spaces and tabs.
 5728|  10.9k|  while (beg < end && is_space_or_tab(end[-1])) {
  ------------------
  |  Branch (5728:10): [True: 10.8k, False: 16]
  |  Branch (5728:23): [True: 392, False: 10.4k]
  ------------------
 5729|    392|    end--;
 5730|    392|  }
 5731|       |
 5732|  10.5k|  auto p = beg;
 5733|   211k|  while (p < end && *p != ':') {
  ------------------
  |  Branch (5733:10): [True: 211k, False: 280]
  |  Branch (5733:21): [True: 201k, False: 10.2k]
  ------------------
 5734|   201k|    p++;
 5735|   201k|  }
 5736|       |
 5737|  10.5k|  auto name = std::string(beg, p);
 5738|  10.5k|  if (!detail::fields::is_field_name(name)) { return false; }
  ------------------
  |  Branch (5738:7): [True: 125, False: 10.3k]
  ------------------
 5739|       |
 5740|  10.3k|  if (p == end) { return false; }
  ------------------
  |  Branch (5740:7): [True: 180, False: 10.2k]
  ------------------
 5741|       |
 5742|  10.2k|  auto key_end = p;
 5743|       |
 5744|  10.2k|  if (*p++ != ':') { return false; }
  ------------------
  |  Branch (5744:7): [True: 0, False: 10.2k]
  ------------------
 5745|       |
 5746|  10.5k|  while (p < end && is_space_or_tab(*p)) {
  ------------------
  |  Branch (5746:10): [True: 4.39k, False: 6.18k]
  |  Branch (5746:21): [True: 362, False: 4.02k]
  ------------------
 5747|    362|    p++;
 5748|    362|  }
 5749|       |
 5750|  10.2k|  if (p <= end) {
  ------------------
  |  Branch (5750:7): [True: 10.2k, False: 0]
  ------------------
 5751|  10.2k|    auto key_len = key_end - beg;
 5752|  10.2k|    if (!key_len) { return false; }
  ------------------
  |  Branch (5752:9): [True: 0, False: 10.2k]
  ------------------
 5753|       |
 5754|  10.2k|    auto key = std::string(beg, key_end);
 5755|  10.2k|    auto val = std::string(p, end);
 5756|       |
 5757|  10.2k|    if (!detail::fields::is_field_value(val)) { return false; }
  ------------------
  |  Branch (5757:9): [True: 51, False: 10.1k]
  ------------------
 5758|       |
 5759|       |    // RFC 9110 §5.5: header field values are opaque octets and MUST NOT be
 5760|       |    // percent-decoded by the recipient. Applications that need to interpret a
 5761|       |    // value as a URI component should call httplib::decode_uri_component()
 5762|       |    // (or decode_path_component()) explicitly.
 5763|  10.1k|    fn(key, val);
 5764|       |
 5765|  10.1k|    return true;
 5766|  10.2k|  }
 5767|       |
 5768|      0|  return false;
 5769|  10.2k|}
_ZZN7httplib6detail12read_headersERNS_6StreamERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEEENKUlRKSA_SG_E_clESG_SG_:
 8026|  10.1k|                      [&](const std::string &key, const std::string &val) {
 8027|  10.1k|                        headers.emplace(key, val);
 8028|  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.19k, False: 805]
  ------------------
 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.58k|    pointer operator->() const { return data_ + idx_; }
_ZNK7httplib10ClientImpl16output_error_logERKNS_5ErrorEPKNS_7RequestE:
15820|  2.62k|                                         const Request *req) const {
15821|  2.62k|  if (error_logger_) {
  ------------------
  |  Branch (15821:7): [True: 0, False: 2.62k]
  ------------------
15822|      0|    std::lock_guard<std::mutex> guard(logger_mutex_);
15823|      0|    error_logger_(err, req);
15824|      0|  }
15825|  2.62k|}
_ZZN7httplib10ClientImpl15process_requestERNS_6StreamERNS_7RequestERNS_8ResponseEbRNS_5ErrorEENKUlPKcmmmE0_clESA_mmm:
15946|   130k|                      size_t /*len*/) {
15947|   130k|                    assert(res.body.size() + n <= res.body.max_size());
  ------------------
  |  Branch (15947:21): [True: 130k, False: 0]
  ------------------
15948|   130k|                    if (payload_max_length_ > 0 &&
  ------------------
  |  Branch (15948:25): [True: 130k, False: 0]
  ------------------
15949|   130k|                        (res.body.size() >= payload_max_length_ ||
  ------------------
  |  Branch (15949:26): [True: 0, False: 130k]
  ------------------
15950|   130k|                         n > payload_max_length_ - res.body.size())) {
  ------------------
  |  Branch (15950:26): [True: 0, False: 130k]
  ------------------
15951|      0|                      return false;
15952|      0|                    }
15953|   130k|                    res.body.append(buf, n);
15954|   130k|                    return true;
15955|   130k|                  });
_ZNK7httplib8Response10has_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
11450|  1.81k|inline bool Response::has_header(const std::string &key) const {
11451|  1.81k|  return headers.find(key) != headers.end();
11452|  1.81k|}
_ZNK7httplib8Response20get_header_value_u64ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmm:
11446|    623|                                             size_t id) const {
11447|    623|  return detail::get_header_value_u64(headers, key, def, id);
11448|    623|}
_ZN7httplib6detail20get_header_value_u64ERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_mm:
 3425|    623|                                   size_t id) {
 3426|    623|  auto dummy = false;
 3427|    623|  return get_header_value_u64(headers, key, def, id, dummy);
 3428|    623|}
_ZN7httplib6detail20get_header_value_u64ERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_mmRb:
 3397|  1.16k|                                   size_t id, bool &is_invalid_value) {
 3398|  1.16k|  is_invalid_value = false;
 3399|  1.16k|  auto rng = headers.equal_range(key);
 3400|  1.16k|  auto it = rng.first;
 3401|  1.16k|  std::advance(it, static_cast<ssize_t>(id));
 3402|  1.16k|  if (it != rng.second) {
  ------------------
  |  Branch (3402:7): [True: 1.16k, False: 0]
  ------------------
 3403|  1.16k|    if (is_numeric(it->second)) {
  ------------------
  |  Branch (3403:9): [True: 998, False: 163]
  ------------------
 3404|       |      // Parse at size_t width so an out-of-range Content-Length is reported
 3405|       |      // rather than silently saturated/truncated (a value above 2^32 would
 3406|       |      // otherwise wrap to a small framing length on 32-bit builds). Flag it
 3407|       |      // and return SIZE_MAX so the existing oversized-value guards reject it.
 3408|    998|      size_t val = 0;
 3409|    998|      const auto &s = it->second;
 3410|    998|      auto r = from_chars(s.data(), s.data() + s.size(), val);
 3411|    998|      if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (3411:11): [True: 62, False: 936]
  ------------------
 3412|     62|        is_invalid_value = true;
 3413|     62|        return (std::numeric_limits<size_t>::max)();
 3414|     62|      }
 3415|    936|      return val;
 3416|    998|    } else {
 3417|    163|      is_invalid_value = true;
 3418|    163|    }
 3419|  1.16k|  }
 3420|    163|  return def;
 3421|  1.16k|}
_ZN7httplib6detail10is_numericERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 3391|  1.16k|inline bool is_numeric(const std::string &str) {
 3392|  1.16k|  return !str.empty() && std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
  ------------------
  |  Branch (3392:10): [True: 1.02k, False: 141]
  |  Branch (3392:26): [True: 998, False: 22]
  ------------------
 3393|  1.16k|}
_ZN7httplib6detail10from_charsImEENS0_17from_chars_resultIT_EEPKcS6_RS3_i:
  700|    998|                                       T &value, int base = 10) {
  701|    998|  value = 0;
  702|    998|  const char *p = first;
  703|    998|  bool negative = false;
  704|       |
  705|    998|  if (p != last && *p == '-') {
  ------------------
  |  Branch (705:7): [True: 998, False: 0]
  |  Branch (705:20): [True: 0, False: 998]
  ------------------
  706|      0|    negative = true;
  707|      0|    ++p;
  708|      0|  }
  709|    998|  if (p == last) { return {first, std::errc::invalid_argument}; }
  ------------------
  |  Branch (709:7): [True: 0, False: 998]
  ------------------
  710|       |
  711|    998|  T result = 0;
  712|  14.6k|  for (; p != last; ++p) {
  ------------------
  |  Branch (712:10): [True: 13.7k, False: 936]
  ------------------
  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|    936|  if (p == first || (negative && p == first + 1)) {
  ------------------
  |  Branch (732:7): [True: 0, False: 936]
  |  Branch (732:22): [True: 0, False: 936]
  |  Branch (732:34): [True: 0, False: 0]
  ------------------
  733|      0|    return {first, std::errc::invalid_argument};
  734|      0|  }
  735|       |
  736|    936|  value = negative ? T(0) - result : result;
  ------------------
  |  Branch (736:11): [True: 0, False: 936]
  ------------------
  737|    936|  return {p, std::errc{}};
  738|    936|}
_ZN7httplib6detail12read_contentINS_8ResponseEEEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENS9_IFbPKcmmmEEEb:
 8332|  1.73k|                  ContentReceiverWithProgress receiver, bool decompress) {
 8333|  1.73k|  bool exceed_payload_max_length = false;
 8334|  1.73k|  return prepare_content_receiver(
 8335|  1.73k|      x, status, std::move(receiver), decompress, payload_max_length,
 8336|  1.73k|      exceed_payload_max_length, [&](const ContentReceiverWithProgress &out) {
 8337|  1.73k|        auto ret = true;
 8338|       |        // Note: exceed_payload_max_length may also be set by the decompressor
 8339|       |        // wrapper in prepare_content_receiver when the decompressed payload
 8340|       |        // size exceeds the limit.
 8341|       |
 8342|  1.73k|        if (is_chunked_transfer_encoding(x.headers)) {
 8343|  1.73k|          auto result = read_content_chunked(strm, x, payload_max_length, out);
 8344|  1.73k|          if (result == ReadContentResult::Success) {
 8345|  1.73k|            ret = true;
 8346|  1.73k|          } else if (result == ReadContentResult::PayloadTooLarge) {
 8347|  1.73k|            exceed_payload_max_length = true;
 8348|  1.73k|            ret = false;
 8349|  1.73k|          } else {
 8350|  1.73k|            ret = false;
 8351|  1.73k|          }
 8352|  1.73k|        } else if (!has_header(x.headers, "Content-Length")) {
 8353|  1.73k|          auto result =
 8354|  1.73k|              read_content_without_length(strm, payload_max_length, out);
 8355|  1.73k|          if (result == ReadContentResult::Success) {
 8356|  1.73k|            ret = true;
 8357|  1.73k|          } else if (result == ReadContentResult::PayloadTooLarge) {
 8358|  1.73k|            exceed_payload_max_length = true;
 8359|  1.73k|            ret = false;
 8360|  1.73k|          } else {
 8361|  1.73k|            ret = false;
 8362|  1.73k|          }
 8363|  1.73k|        } else {
 8364|  1.73k|          auto is_invalid_value = false;
 8365|  1.73k|          auto len = get_header_value_u64(x.headers, "Content-Length",
 8366|  1.73k|                                          (std::numeric_limits<size_t>::max)(),
 8367|  1.73k|                                          0, is_invalid_value);
 8368|       |
 8369|  1.73k|          if (is_invalid_value) {
 8370|  1.73k|            ret = false;
 8371|  1.73k|          } else if (len > 0) {
 8372|  1.73k|            auto result = read_content_with_length(
 8373|  1.73k|                strm, len, std::move(progress), out, payload_max_length);
 8374|  1.73k|            ret = (result == ReadContentResult::Success);
 8375|  1.73k|            if (result == ReadContentResult::PayloadTooLarge) {
 8376|  1.73k|              exceed_payload_max_length = true;
 8377|  1.73k|            }
 8378|  1.73k|          }
 8379|  1.73k|        }
 8380|       |
 8381|  1.73k|        if (!ret) {
 8382|  1.73k|          status = exceed_payload_max_length ? StatusCode::PayloadTooLarge_413
 8383|  1.73k|                                             : StatusCode::BadRequest_400;
 8384|  1.73k|        }
 8385|  1.73k|        return ret;
 8386|  1.73k|      });
 8387|  1.73k|}
_ZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_:
 8278|  1.73k|                              bool &exceed_payload_max_length, U callback) {
 8279|  1.73k|  if (decompress) {
  ------------------
  |  Branch (8279:7): [True: 1.73k, False: 0]
  ------------------
 8280|  1.73k|    auto encoding = get_combined_header_value(x.headers, "Content-Encoding");
 8281|  1.73k|    std::unique_ptr<decompressor> decompressor;
 8282|       |
 8283|  1.73k|    if (!encoding.empty()) {
  ------------------
  |  Branch (8283:9): [True: 181, False: 1.54k]
  ------------------
 8284|       |      // A coding we know about but were not built with is an error. An
 8285|       |      // unrecognized coding (including "identity") is left alone and the
 8286|       |      // payload is passed through as-is, since some servers misuse the header,
 8287|       |      // e.g. by sending a character set such as "Content-Encoding: UTF-8".
 8288|    181|      decompressor = detail::create_decompressor(encoding);
 8289|    181|      if (!decompressor && detail::is_known_content_encoding(encoding)) {
  ------------------
  |  Branch (8289:11): [True: 42, False: 139]
  |  Branch (8289:28): [True: 2, False: 40]
  ------------------
 8290|      2|        status = StatusCode::UnsupportedMediaType_415;
 8291|      2|        return false;
 8292|      2|      }
 8293|    181|    }
 8294|       |
 8295|  1.72k|    if (decompressor) {
  ------------------
  |  Branch (8295:9): [True: 139, False: 1.58k]
  ------------------
 8296|    139|      if (decompressor->is_valid()) {
  ------------------
  |  Branch (8296:11): [True: 139, False: 0]
  ------------------
 8297|    139|        size_t decompressed_size = 0;
 8298|    139|        ContentReceiverWithProgress out = [&](const char *buf, size_t n,
 8299|    139|                                              size_t off, size_t len) {
 8300|    139|          return decompressor->decompress(
 8301|    139|              buf, n, [&](const char *buf2, size_t n2) {
 8302|       |                // Guard against zip-bomb: check
 8303|       |                // decompressed size against limit.
 8304|    139|                if (payload_max_length > 0 &&
 8305|    139|                    (decompressed_size >= payload_max_length ||
 8306|    139|                     n2 > payload_max_length - decompressed_size)) {
 8307|    139|                  exceed_payload_max_length = true;
 8308|    139|                  return false;
 8309|    139|                }
 8310|    139|                decompressed_size += n2;
 8311|    139|                return receiver(buf2, n2, off, len);
 8312|    139|              });
 8313|    139|        };
 8314|    139|        return callback(std::move(out));
 8315|    139|      } else {
 8316|      0|        status = StatusCode::InternalServerError_500;
 8317|      0|        return false;
 8318|      0|      }
 8319|    139|    }
 8320|  1.72k|  }
 8321|       |
 8322|  1.58k|  ContentReceiverWithProgress out = [&](const char *buf, size_t n, size_t off,
 8323|  1.58k|                                        size_t len) {
 8324|  1.58k|    return receiver(buf, n, off, len);
 8325|  1.58k|  };
 8326|  1.58k|  return callback(std::move(out));
 8327|  1.73k|}
_ZN7httplib6detail25get_combined_header_valueERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKS8_:
 7944|  1.89k|                                             const std::string &key) {
 7945|  1.89k|  std::string combined;
 7946|  1.89k|  auto rng = headers.equal_range(key);
 7947|  3.07k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (7947:29): [True: 1.18k, False: 1.89k]
  ------------------
 7948|       |    // RFC 9110 Section 5.6.1.2: a recipient has to parse and ignore empty list
 7949|       |    // elements, so an empty field line must not contribute a bare comma to the
 7950|       |    // combined value.
 7951|  1.18k|    if (it->second.empty()) { continue; }
  ------------------
  |  Branch (7951:9): [True: 100, False: 1.08k]
  ------------------
 7952|  1.08k|    if (!combined.empty()) { combined += ", "; }
  ------------------
  |  Branch (7952:9): [True: 899, False: 181]
  ------------------
 7953|  1.08k|    combined += it->second;
 7954|  1.08k|  }
 7955|  1.89k|  return combined;
 7956|  1.89k|}
_ZN7httplib6detail19create_decompressorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7862|    181|create_decompressor(const std::string &encoding) {
 7863|    181|  std::unique_ptr<decompressor> decompressor;
 7864|       |
 7865|    181|  if (is_zlib_encoding(encoding)) {
  ------------------
  |  Branch (7865:7): [True: 139, False: 42]
  ------------------
 7866|    139|#ifdef CPPHTTPLIB_ZLIB_SUPPORT
 7867|    139|    decompressor = detail::make_unique<gzip_decompressor>();
 7868|    139|#endif
 7869|    139|  } else if (is_brotli_encoding(encoding)) {
  ------------------
  |  Branch (7869:14): [True: 1, False: 41]
  ------------------
 7870|       |#ifdef CPPHTTPLIB_BROTLI_SUPPORT
 7871|       |    decompressor = detail::make_unique<brotli_decompressor>();
 7872|       |#endif
 7873|     41|  } else if (is_zstd_encoding(encoding)) {
  ------------------
  |  Branch (7873:14): [True: 1, False: 40]
  ------------------
 7874|       |#ifdef CPPHTTPLIB_ZSTD_SUPPORT
 7875|       |    decompressor = detail::make_unique<zstd_decompressor>();
 7876|       |#endif
 7877|      1|  }
 7878|       |
 7879|    181|  return decompressor;
 7880|    181|}
_ZN7httplib6detail16is_zlib_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7841|    223|inline bool is_zlib_encoding(const std::string &encoding) {
 7842|    223|  return case_ignore::equal(encoding, "gzip") ||
  ------------------
  |  Branch (7842:10): [True: 16, False: 207]
  ------------------
 7843|    207|         case_ignore::equal(encoding, "deflate");
  ------------------
  |  Branch (7843:10): [True: 123, False: 84]
  ------------------
 7844|    223|}
_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:
 7636|    139|inline gzip_decompressor::gzip_decompressor() {
 7637|    139|  std::memset(&strm_, 0, sizeof(strm_));
 7638|    139|  strm_.zalloc = Z_NULL;
 7639|    139|  strm_.zfree = Z_NULL;
 7640|    139|  strm_.opaque = Z_NULL;
 7641|       |
 7642|       |  // 15 is the value of wbits, which should be at the maximum possible value
 7643|       |  // to ensure that any gzip stream can be decoded. The offset of 32 specifies
 7644|       |  // that the stream type should be automatically detected either gzip or
 7645|       |  // deflate.
 7646|    139|  is_valid_ = inflateInit2(&strm_, 32 + 15) == Z_OK;
 7647|    139|}
_ZN7httplib6detail18is_brotli_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7846|     84|inline bool is_brotli_encoding(const std::string &encoding) {
 7847|     84|  return case_ignore::equal(encoding, "br");
 7848|     84|}
_ZN7httplib6detail16is_zstd_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7850|     82|inline bool is_zstd_encoding(const std::string &encoding) {
 7851|     82|  return case_ignore::equal(encoding, "zstd");
 7852|     82|}
_ZN7httplib6detail25is_known_content_encodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7856|     42|inline bool is_known_content_encoding(const std::string &encoding) {
 7857|     42|  return is_zlib_encoding(encoding) || is_brotli_encoding(encoding) ||
  ------------------
  |  Branch (7857:10): [True: 0, False: 42]
  |  Branch (7857:40): [True: 1, False: 41]
  ------------------
 7858|     41|         is_zstd_encoding(encoding);
  ------------------
  |  Branch (7858:10): [True: 1, False: 40]
  ------------------
 7859|     42|}
_ZZN7httplib6detail24prepare_content_receiverINS_8ResponseEZNS0_12read_contentIS2_EEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENSA_IFbPKcmmmEEEbEUlRKSG_E_EEbS7_S8_SG_bmRbT0_ENKUlSE_mmmE_clESE_mmm:
 8299|  1.99k|                                              size_t off, size_t len) {
 8300|  1.99k|          return decompressor->decompress(
 8301|  1.99k|              buf, n, [&](const char *buf2, size_t n2) {
 8302|       |                // Guard against zip-bomb: check
 8303|       |                // decompressed size against limit.
 8304|  1.99k|                if (payload_max_length > 0 &&
 8305|  1.99k|                    (decompressed_size >= payload_max_length ||
 8306|  1.99k|                     n2 > payload_max_length - decompressed_size)) {
 8307|  1.99k|                  exceed_payload_max_length = true;
 8308|  1.99k|                  return false;
 8309|  1.99k|                }
 8310|  1.99k|                decompressed_size += n2;
 8311|  1.99k|                return receiver(buf2, n2, off, len);
 8312|  1.99k|              });
 8313|  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:
 8301|   127k|              buf, n, [&](const char *buf2, size_t n2) {
 8302|       |                // Guard against zip-bomb: check
 8303|       |                // decompressed size against limit.
 8304|   127k|                if (payload_max_length > 0 &&
  ------------------
  |  Branch (8304:21): [True: 127k, False: 0]
  ------------------
 8305|   127k|                    (decompressed_size >= payload_max_length ||
  ------------------
  |  Branch (8305:22): [True: 1, False: 127k]
  ------------------
 8306|   127k|                     n2 > payload_max_length - decompressed_size)) {
  ------------------
  |  Branch (8306:22): [True: 14, False: 127k]
  ------------------
 8307|     15|                  exceed_payload_max_length = true;
 8308|     15|                  return false;
 8309|     15|                }
 8310|   127k|                decompressed_size += n2;
 8311|   127k|                return receiver(buf2, n2, off, len);
 8312|   127k|              });
_ZZN7httplib6detail12read_contentINS_8ResponseEEEbRNS_6StreamERT_mRiNSt3__18functionIFbmmEEENS9_IFbPKcmmmEEEbENKUlRKSF_E_clESH_:
 8336|  1.72k|      exceed_payload_max_length, [&](const ContentReceiverWithProgress &out) {
 8337|  1.72k|        auto ret = true;
 8338|       |        // Note: exceed_payload_max_length may also be set by the decompressor
 8339|       |        // wrapper in prepare_content_receiver when the decompressed payload
 8340|       |        // size exceeds the limit.
 8341|       |
 8342|  1.72k|        if (is_chunked_transfer_encoding(x.headers)) {
  ------------------
  |  Branch (8342:13): [True: 706, False: 1.02k]
  ------------------
 8343|    706|          auto result = read_content_chunked(strm, x, payload_max_length, out);
 8344|    706|          if (result == ReadContentResult::Success) {
  ------------------
  |  Branch (8344:15): [True: 1, False: 705]
  ------------------
 8345|      1|            ret = true;
 8346|    705|          } else if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8346:22): [True: 0, False: 705]
  ------------------
 8347|      0|            exceed_payload_max_length = true;
 8348|      0|            ret = false;
 8349|    705|          } else {
 8350|    705|            ret = false;
 8351|    705|          }
 8352|  1.02k|        } else if (!has_header(x.headers, "Content-Length")) {
  ------------------
  |  Branch (8352:20): [True: 484, False: 538]
  ------------------
 8353|    484|          auto result =
 8354|    484|              read_content_without_length(strm, payload_max_length, out);
 8355|    484|          if (result == ReadContentResult::Success) {
  ------------------
  |  Branch (8355:15): [True: 449, False: 35]
  ------------------
 8356|    449|            ret = true;
 8357|    449|          } else if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8357:22): [True: 0, False: 35]
  ------------------
 8358|      0|            exceed_payload_max_length = true;
 8359|      0|            ret = false;
 8360|     35|          } else {
 8361|     35|            ret = false;
 8362|     35|          }
 8363|    538|        } else {
 8364|    538|          auto is_invalid_value = false;
 8365|    538|          auto len = get_header_value_u64(x.headers, "Content-Length",
 8366|    538|                                          (std::numeric_limits<size_t>::max)(),
 8367|    538|                                          0, is_invalid_value);
 8368|       |
 8369|    538|          if (is_invalid_value) {
  ------------------
  |  Branch (8369:15): [True: 75, False: 463]
  ------------------
 8370|     75|            ret = false;
 8371|    463|          } else if (len > 0) {
  ------------------
  |  Branch (8371:22): [True: 453, False: 10]
  ------------------
 8372|    453|            auto result = read_content_with_length(
 8373|    453|                strm, len, std::move(progress), out, payload_max_length);
 8374|    453|            ret = (result == ReadContentResult::Success);
 8375|    453|            if (result == ReadContentResult::PayloadTooLarge) {
  ------------------
  |  Branch (8375:17): [True: 0, False: 453]
  ------------------
 8376|      0|              exceed_payload_max_length = true;
 8377|      0|            }
 8378|    453|          }
 8379|    538|        }
 8380|       |
 8381|  1.72k|        if (!ret) {
  ------------------
  |  Branch (8381:13): [True: 1.26k, False: 461]
  ------------------
 8382|  1.26k|          status = exceed_payload_max_length ? StatusCode::PayloadTooLarge_413
  ------------------
  |  Branch (8382:20): [True: 15, False: 1.25k]
  ------------------
 8383|  1.26k|                                             : StatusCode::BadRequest_400;
 8384|  1.26k|        }
 8385|  1.72k|        return ret;
 8386|  1.72k|      });
_ZN7httplib6detail28is_chunked_transfer_encodingERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEE:
 8242|  1.72k|inline bool is_chunked_transfer_encoding(const Headers &headers) {
 8243|       |  // RFC 9112 6.1: a message is framed with the chunked coding when "chunked"
 8244|       |  // is the final transfer coding. A single field value may list several
 8245|       |  // codings ("gzip, chunked"), and RFC 9110 5.3 lets that list be split across
 8246|       |  // several Transfer-Encoding lines, which combine into one comma-separated
 8247|       |  // list in the order the lines were received. Headers preserves that order,
 8248|       |  // so the final coding is the last token of the last line. Match it
 8249|       |  // case-insensitively rather than comparing the whole value against
 8250|       |  // "chunked".
 8251|       |  //
 8252|       |  // Security: reading a chunked message as unframed leaves its body in the
 8253|       |  // socket, where a keep-alive connection parses it as a smuggled request.
 8254|       |  // Server::process_request() answers 400 and closes when the final coding is
 8255|       |  // not chunked, so a request whose framing cannot be determined never
 8256|       |  // reaches the "no body" path.
 8257|  1.72k|  auto rng = headers.equal_range("Transfer-Encoding");
 8258|  1.72k|  if (rng.first == rng.second) { return false; }
  ------------------
  |  Branch (8258:7): [True: 783, False: 945]
  ------------------
 8259|       |
 8260|       |  // Cleared per line, so a trailing line carrying no coding at all leaves the
 8261|       |  // combined list ending in nothing rather than inheriting the line before it.
 8262|    945|  std::string last_coding;
 8263|       |
 8264|  2.23k|  for (auto it = rng.first; it != rng.second; ++it) {
  ------------------
  |  Branch (8264:29): [True: 1.28k, False: 945]
  ------------------
 8265|  1.28k|    const auto &value = it->second;
 8266|  1.28k|    last_coding.clear();
 8267|  1.28k|    split(value.data(), value.data() + value.size(), ',',
 8268|  1.28k|          [&](const char *b, const char *e) { last_coding.assign(b, e); });
 8269|  1.28k|  }
 8270|       |
 8271|    945|  return case_ignore::equal(last_coding, "chunked");
 8272|  1.72k|}
_ZNK7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEE10iterator_tIKNS2_4pairIS8_S8_EEEeqISF_EEbRKNSC_IT_EE:
 1103|  1.72k|    template <typename U> bool operator==(const iterator_t<U> &rhs) const {
 1104|  1.72k|      return idx_ == rhs.idx_;
 1105|  1.72k|    }
_ZZN7httplib6detail28is_chunked_transfer_encodingERKNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_11case_ignore8equal_toEEEENKUlPKcSF_E_clESF_SF_:
 8268|  5.33k|          [&](const char *b, const char *e) { last_coding.assign(b, e); });
_ZN7httplib6detail20read_content_chunkedINS_8ResponseEEENS0_17ReadContentResultERNS_6StreamERT_mNSt3__18functionIFbPKcmmmEEE:
 8210|    706|                                              ContentReceiverWithProgress out) {
 8211|    706|  detail::ChunkedDecoder dec(strm);
 8212|       |
 8213|    706|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8214|    706|  size_t total_len = 0;
 8215|       |
 8216|  4.64k|  for (;;) {
 8217|  4.64k|    size_t chunk_offset = 0;
 8218|  4.64k|    size_t chunk_total = 0;
 8219|  4.64k|    auto n = dec.read_payload(buf, sizeof(buf), chunk_offset, chunk_total);
 8220|  4.64k|    if (n < 0) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8220:9): [True: 524, False: 4.12k]
  ------------------
 8221|       |
 8222|  4.12k|    if (n == 0) {
  ------------------
  |  Branch (8222:9): [True: 180, False: 3.94k]
  ------------------
 8223|    180|      if (!dec.parse_trailers_into(x.trailers, x.headers)) {
  ------------------
  |  Branch (8223:11): [True: 179, False: 1]
  ------------------
 8224|    179|        return ReadContentResult::Error;
 8225|    179|      }
 8226|      1|      return ReadContentResult::Success;
 8227|    180|    }
 8228|       |
 8229|  3.94k|    if (total_len > payload_max_length ||
  ------------------
  |  Branch (8229:9): [True: 0, False: 3.94k]
  ------------------
 8230|  3.94k|        payload_max_length - total_len < static_cast<size_t>(n)) {
  ------------------
  |  Branch (8230:9): [True: 0, False: 3.94k]
  ------------------
 8231|      0|      return ReadContentResult::PayloadTooLarge;
 8232|      0|    }
 8233|       |
 8234|  3.94k|    if (!out(buf, static_cast<size_t>(n), chunk_offset, chunk_total)) {
  ------------------
  |  Branch (8234:9): [True: 2, False: 3.94k]
  ------------------
 8235|      2|      return ReadContentResult::Error;
 8236|      2|    }
 8237|       |
 8238|  3.94k|    total_len += static_cast<size_t>(n);
 8239|  3.94k|  }
 8240|    706|}
_ZN7httplib6detail14ChunkedDecoderC2ERNS_6StreamE:
15111|    706|inline ChunkedDecoder::ChunkedDecoder(Stream &s) : strm(s) {}
_ZN7httplib6detail14ChunkedDecoder12read_payloadEPcmRmS3_:
15115|  4.64k|                                            size_t &out_chunk_total) {
15116|  4.64k|  if (finished) { return 0; }
  ------------------
  |  Branch (15116:7): [True: 0, False: 4.64k]
  ------------------
15117|       |
15118|  4.64k|  if (chunk_remaining == 0) {
  ------------------
  |  Branch (15118:7): [True: 4.05k, False: 598]
  ------------------
15119|  4.05k|    stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15120|  4.05k|    if (!lr.getline()) { return -1; }
  ------------------
  |  Branch (15120:9): [True: 27, False: 4.02k]
  ------------------
15121|       |
15122|       |    // RFC 9112 §7.1: chunk-size = 1*HEXDIG
15123|  4.02k|    const char *p = lr.ptr();
15124|  4.02k|    int v = 0;
15125|  4.02k|    if (!is_hex(*p, v)) { return -1; }
  ------------------
  |  Branch (15125:9): [True: 29, False: 3.99k]
  ------------------
15126|       |
15127|  3.99k|    size_t chunk_len = 0;
15128|  3.99k|    constexpr size_t chunk_len_max = (std::numeric_limits<size_t>::max)();
15129|  11.8k|    for (; is_hex(*p, v); ++p) {
  ------------------
  |  Branch (15129:12): [True: 7.84k, False: 3.98k]
  ------------------
15130|  7.84k|      if (chunk_len > (chunk_len_max >> 4)) { return -1; }
  ------------------
  |  Branch (15130:11): [True: 11, False: 7.83k]
  ------------------
15131|  7.83k|      chunk_len = (chunk_len << 4) | static_cast<size_t>(v);
15132|  7.83k|    }
15133|       |
15134|  4.38k|    while (is_space_or_tab(*p)) {
  ------------------
  |  Branch (15134:12): [True: 402, False: 3.98k]
  ------------------
15135|    402|      ++p;
15136|    402|    }
15137|  3.98k|    if (*p != '\0' && *p != ';' && *p != '\r' && *p != '\n') { return -1; }
  ------------------
  |  Branch (15137:9): [True: 3.55k, False: 430]
  |  Branch (15137:23): [True: 3.35k, False: 200]
  |  Branch (15137:36): [True: 257, False: 3.09k]
  |  Branch (15137:50): [True: 43, False: 214]
  ------------------
15138|       |
15139|  3.94k|    if (chunk_len == 0) {
  ------------------
  |  Branch (15139:9): [True: 180, False: 3.76k]
  ------------------
15140|    180|      chunk_remaining = 0;
15141|    180|      finished = true;
15142|    180|      out_chunk_offset = 0;
15143|    180|      out_chunk_total = 0;
15144|    180|      return 0;
15145|    180|    }
15146|       |
15147|  3.76k|    chunk_remaining = chunk_len;
15148|  3.76k|    last_chunk_total = chunk_remaining;
15149|  3.76k|    last_chunk_offset = 0;
15150|  3.76k|  }
15151|       |
15152|  4.35k|  auto to_read = (std::min)(chunk_remaining, len);
15153|  4.35k|  auto n = strm.read(buf, to_read);
15154|  4.35k|  if (n <= 0) { return -1; }
  ------------------
  |  Branch (15154:7): [True: 381, False: 3.97k]
  ------------------
15155|       |
15156|  3.97k|  auto offset_before = last_chunk_offset;
15157|  3.97k|  last_chunk_offset += static_cast<size_t>(n);
15158|  3.97k|  chunk_remaining -= static_cast<size_t>(n);
15159|       |
15160|  3.97k|  out_chunk_offset = offset_before;
15161|  3.97k|  out_chunk_total = last_chunk_total;
15162|       |
15163|  3.97k|  if (chunk_remaining == 0) {
  ------------------
  |  Branch (15163:7): [True: 3.37k, False: 600]
  ------------------
15164|  3.37k|    stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15165|  3.37k|    if (!lr.getline()) { return -1; }
  ------------------
  |  Branch (15165:9): [True: 5, False: 3.37k]
  ------------------
15166|  3.37k|    if (std::strcmp(lr.ptr(), "\r\n") != 0) { return -1; }
  ------------------
  |  Branch (15166:9): [True: 28, False: 3.34k]
  ------------------
15167|  3.37k|  }
15168|       |
15169|  3.94k|  return n;
15170|  3.97k|}
_ZN7httplib6detail14ChunkedDecoder19parse_trailers_intoERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSC_:
15173|    180|                                                const Headers &src_headers) {
15174|    180|  stream_line_reader lr(strm, line_buf, sizeof(line_buf));
15175|    180|  if (!lr.getline()) { return false; }
  ------------------
  |  Branch (15175:7): [True: 20, False: 160]
  ------------------
15176|    160|  return parse_trailers(lr, dest, src_headers);
15177|    180|}
_ZN7httplib6detail14parse_trailersERNS0_18stream_line_readerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSD_:
 5772|    160|                           const Headers &src_headers) {
 5773|       |  // NOTE: In RFC 9112, '7.1 Chunked Transfer Coding' mentions "The chunked
 5774|       |  // transfer coding is complete when a chunk with a chunk-size of zero is
 5775|       |  // received, possibly followed by a trailer section, and finally terminated by
 5776|       |  // an empty line". https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1
 5777|       |  //
 5778|       |  // In '7.1.3. Decoding Chunked', however, the pseudo-code in the section
 5779|       |  // doesn't care for the existence of the final CRLF. In other words, it seems
 5780|       |  // to be ok whether the final CRLF exists or not in the chunked data.
 5781|       |  // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1.3
 5782|       |  //
 5783|       |  // According to the reference code in RFC 9112, cpp-httplib now allows
 5784|       |  // chunked transfer coding data without the final CRLF.
 5785|       |
 5786|       |  // RFC 7230 Section 4.1.2 - Headers prohibited in trailers
 5787|    160|  thread_local case_ignore::unordered_set<std::string> prohibited_trailers = {
 5788|    160|      "transfer-encoding",
 5789|    160|      "content-length",
 5790|    160|      "host",
 5791|    160|      "authorization",
 5792|    160|      "www-authenticate",
 5793|    160|      "proxy-authenticate",
 5794|    160|      "proxy-authorization",
 5795|    160|      "cookie",
 5796|    160|      "set-cookie",
 5797|    160|      "cache-control",
 5798|    160|      "expect",
 5799|    160|      "max-forwards",
 5800|    160|      "pragma",
 5801|    160|      "range",
 5802|    160|      "te",
 5803|    160|      "age",
 5804|    160|      "expires",
 5805|    160|      "date",
 5806|    160|      "location",
 5807|    160|      "retry-after",
 5808|    160|      "vary",
 5809|    160|      "warning",
 5810|    160|      "content-encoding",
 5811|    160|      "content-type",
 5812|    160|      "content-range",
 5813|    160|      "trailer"};
 5814|       |
 5815|    160|  case_ignore::unordered_set<std::string> declared_trailers;
 5816|    160|  auto trailer_header = get_combined_header_value(src_headers, "Trailer");
 5817|    160|  if (!trailer_header.empty()) {
  ------------------
  |  Branch (5817:7): [True: 0, False: 160]
  ------------------
 5818|       |    // split() trims each token and skips empty ones, so the name arrives ready
 5819|       |    // to look up.
 5820|      0|    split(trailer_header.data(), trailer_header.data() + trailer_header.size(),
 5821|      0|          ',', [&](const char *b, const char *e) {
 5822|      0|            std::string key(b, e);
 5823|      0|            if (prohibited_trailers.find(key) == prohibited_trailers.end()) {
 5824|      0|              declared_trailers.insert(key);
 5825|      0|            }
 5826|      0|          });
 5827|      0|  }
 5828|       |
 5829|    160|  size_t trailer_header_count = 0;
 5830|  3.69k|  while (strcmp(line_reader.ptr(), "\r\n") != 0) {
  ------------------
  |  Branch (5830:10): [True: 3.69k, False: 1]
  ------------------
 5831|  3.69k|    if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; }
  ------------------
  |  |  114|  3.69k|#define CPPHTTPLIB_HEADER_MAX_LENGTH 8192
  ------------------
  |  Branch (5831:9): [True: 2, False: 3.69k]
  ------------------
 5832|  3.69k|    if (trailer_header_count >= CPPHTTPLIB_HEADER_MAX_COUNT) { return false; }
  ------------------
  |  |  118|  3.69k|#define CPPHTTPLIB_HEADER_MAX_COUNT 100
  ------------------
  |  Branch (5832:9): [True: 0, False: 3.69k]
  ------------------
 5833|       |
 5834|  3.69k|    constexpr auto line_terminator_len = 2;
 5835|  3.69k|    auto line_beg = line_reader.ptr();
 5836|  3.69k|    auto line_end =
 5837|  3.69k|        line_reader.ptr() + line_reader.size() - line_terminator_len;
 5838|       |
 5839|  3.69k|    if (!parse_header(line_beg, line_end,
  ------------------
  |  Branch (5839:9): [True: 108, False: 3.58k]
  ------------------
 5840|  3.69k|                      [&](const std::string &key, const std::string &val) {
 5841|  3.69k|                        if (declared_trailers.find(key) !=
 5842|  3.69k|                            declared_trailers.end()) {
 5843|  3.69k|                          dest.emplace(key, val);
 5844|  3.69k|                          trailer_header_count++;
 5845|  3.69k|                        }
 5846|  3.69k|                      })) {
 5847|    108|      return false;
 5848|    108|    }
 5849|       |
 5850|  3.58k|    if (!line_reader.getline()) { return false; }
  ------------------
  |  Branch (5850:9): [True: 49, False: 3.53k]
  ------------------
 5851|  3.58k|  }
 5852|       |
 5853|      1|  return true;
 5854|    160|}
_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_:
 5726|  3.69k|inline bool parse_header(const char *beg, const char *end, T fn) {
 5727|       |  // Skip trailing spaces and tabs.
 5728|  4.04k|  while (beg < end && is_space_or_tab(end[-1])) {
  ------------------
  |  Branch (5728:10): [True: 3.99k, False: 43]
  |  Branch (5728:23): [True: 348, False: 3.64k]
  ------------------
 5729|    348|    end--;
 5730|    348|  }
 5731|       |
 5732|  3.69k|  auto p = beg;
 5733|  89.3k|  while (p < end && *p != ':') {
  ------------------
  |  Branch (5733:10): [True: 89.2k, False: 82]
  |  Branch (5733:21): [True: 85.6k, False: 3.61k]
  ------------------
 5734|  85.6k|    p++;
 5735|  85.6k|  }
 5736|       |
 5737|  3.69k|  auto name = std::string(beg, p);
 5738|  3.69k|  if (!detail::fields::is_field_name(name)) { return false; }
  ------------------
  |  Branch (5738:7): [True: 79, False: 3.61k]
  ------------------
 5739|       |
 5740|  3.61k|  if (p == end) { return false; }
  ------------------
  |  Branch (5740:7): [True: 13, False: 3.60k]
  ------------------
 5741|       |
 5742|  3.60k|  auto key_end = p;
 5743|       |
 5744|  3.60k|  if (*p++ != ':') { return false; }
  ------------------
  |  Branch (5744:7): [True: 0, False: 3.60k]
  ------------------
 5745|       |
 5746|  4.12k|  while (p < end && is_space_or_tab(*p)) {
  ------------------
  |  Branch (5746:10): [True: 2.22k, False: 1.90k]
  |  Branch (5746:21): [True: 524, False: 1.69k]
  ------------------
 5747|    524|    p++;
 5748|    524|  }
 5749|       |
 5750|  3.60k|  if (p <= end) {
  ------------------
  |  Branch (5750:7): [True: 3.60k, False: 0]
  ------------------
 5751|  3.60k|    auto key_len = key_end - beg;
 5752|  3.60k|    if (!key_len) { return false; }
  ------------------
  |  Branch (5752:9): [True: 0, False: 3.60k]
  ------------------
 5753|       |
 5754|  3.60k|    auto key = std::string(beg, key_end);
 5755|  3.60k|    auto val = std::string(p, end);
 5756|       |
 5757|  3.60k|    if (!detail::fields::is_field_value(val)) { return false; }
  ------------------
  |  Branch (5757:9): [True: 16, False: 3.58k]
  ------------------
 5758|       |
 5759|       |    // RFC 9110 §5.5: header field values are opaque octets and MUST NOT be
 5760|       |    // percent-decoded by the recipient. Applications that need to interpret a
 5761|       |    // value as a URI component should call httplib::decode_uri_component()
 5762|       |    // (or decode_path_component()) explicitly.
 5763|  3.58k|    fn(key, val);
 5764|       |
 5765|  3.58k|    return true;
 5766|  3.60k|  }
 5767|       |
 5768|      0|  return false;
 5769|  3.60k|}
_ZZN7httplib6detail14parse_trailersERNS0_18stream_line_readerERNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_11case_ignore8equal_toEEERKSD_ENKUlRKSA_SI_E_clESI_SI_:
 5840|  3.58k|                      [&](const std::string &key, const std::string &val) {
 5841|  3.58k|                        if (declared_trailers.find(key) !=
  ------------------
  |  Branch (5841:29): [True: 0, False: 3.58k]
  ------------------
 5842|  3.58k|                            declared_trailers.end()) {
 5843|      0|                          dest.emplace(key, val);
 5844|      0|                          trailer_header_count++;
 5845|      0|                        }
 5846|  3.58k|                      })) {
_ZN7httplib6detail27read_content_without_lengthERNS_6StreamEmNSt3__18functionIFbPKcmmmEEE:
 8184|    484|                            ContentReceiverWithProgress out) {
 8185|    484|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8186|    484|  size_t r = 0;
 8187|  1.85k|  for (;;) {
 8188|  1.85k|    auto n = strm.read(buf, CPPHTTPLIB_RECV_BUFSIZ);
  ------------------
  |  |  172|  1.85k|#define CPPHTTPLIB_RECV_BUFSIZ size_t(16384u)
  ------------------
 8189|  1.85k|    if (n == 0) { return ReadContentResult::Success; }
  ------------------
  |  Branch (8189:9): [True: 449, False: 1.40k]
  ------------------
 8190|  1.40k|    if (n < 0) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8190:9): [True: 0, False: 1.40k]
  ------------------
 8191|       |
 8192|       |    // Check if adding this data would exceed the payload limit
 8193|  1.40k|    if (r > payload_max_length ||
  ------------------
  |  Branch (8193:9): [True: 0, False: 1.40k]
  ------------------
 8194|  1.40k|        payload_max_length - r < static_cast<size_t>(n)) {
  ------------------
  |  Branch (8194:9): [True: 0, False: 1.40k]
  ------------------
 8195|      0|      return ReadContentResult::PayloadTooLarge;
 8196|      0|    }
 8197|       |
 8198|  1.40k|    if (!out(buf, static_cast<size_t>(n), r, 0)) {
  ------------------
  |  Branch (8198:9): [True: 35, False: 1.36k]
  ------------------
 8199|     35|      return ReadContentResult::Error;
 8200|     35|    }
 8201|  1.36k|    r += static_cast<size_t>(n);
 8202|  1.36k|  }
 8203|       |
 8204|      0|  return ReadContentResult::Success;
 8205|    484|}
_ZN7httplib6detail24read_content_with_lengthERNS_6StreamEmNSt3__18functionIFbmmEEENS4_IFbPKcmmmEEEm:
 8144|    453|    size_t payload_max_length = (std::numeric_limits<size_t>::max)()) {
 8145|    453|  char buf[CPPHTTPLIB_RECV_BUFSIZ];
 8146|       |
 8147|    453|  detail::BodyReader br;
 8148|    453|  br.stream = &strm;
 8149|    453|  br.has_content_length = true;
 8150|    453|  br.content_length = len;
 8151|    453|  br.payload_max_length = payload_max_length;
 8152|    453|  br.chunked = false;
 8153|    453|  br.bytes_read = 0;
 8154|    453|  br.last_error = Error::Success;
 8155|       |
 8156|    453|  size_t r = 0;
 8157|    921|  while (r < len) {
  ------------------
  |  Branch (8157:10): [True: 920, False: 1]
  ------------------
 8158|    920|    auto read_len = static_cast<size_t>(len - r);
 8159|    920|    auto to_read = (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ);
  ------------------
  |  |  172|    920|#define CPPHTTPLIB_RECV_BUFSIZ size_t(16384u)
  ------------------
 8160|    920|    auto n = detail::read_body_content(&strm, br, buf, to_read);
 8161|    920|    if (n <= 0) {
  ------------------
  |  Branch (8161:9): [True: 449, False: 471]
  ------------------
 8162|       |      // Check if it was a payload size error
 8163|    449|      if (br.last_error == Error::ExceedMaxPayloadSize) {
  ------------------
  |  Branch (8163:11): [True: 0, False: 449]
  ------------------
 8164|      0|        return ReadContentResult::PayloadTooLarge;
 8165|      0|      }
 8166|    449|      return ReadContentResult::Error;
 8167|    449|    }
 8168|       |
 8169|    471|    if (!out(buf, static_cast<size_t>(n), r, len)) {
  ------------------
  |  Branch (8169:9): [True: 3, False: 468]
  ------------------
 8170|      3|      return ReadContentResult::Error;
 8171|      3|    }
 8172|    468|    r += static_cast<size_t>(n);
 8173|       |
 8174|    468|    if (progress) {
  ------------------
  |  Branch (8174:9): [True: 468, False: 0]
  ------------------
 8175|    468|      if (!progress(r, len)) { return ReadContentResult::Error; }
  ------------------
  |  Branch (8175:11): [True: 0, False: 468]
  ------------------
 8176|    468|    }
 8177|    468|  }
 8178|       |
 8179|      1|  return ReadContentResult::Success;
 8180|    453|}
_ZN7httplib6detail17read_body_contentEPNS_6StreamERNS0_10BodyReaderEPcm:
 2574|    920|                                 size_t len) {
 2575|    920|  (void)stream;
 2576|    920|  return br.read(buf, len);
 2577|    920|}
_ZN7httplib6detail10BodyReader4readEPcm:
11592|    920|inline ssize_t detail::BodyReader::read(char *buf, size_t len) {
11593|    920|  if (!stream) {
  ------------------
  |  Branch (11593:7): [True: 0, False: 920]
  ------------------
11594|      0|    last_error = Error::Connection;
11595|      0|    return -1;
11596|      0|  }
11597|    920|  if (eof) { return 0; }
  ------------------
  |  Branch (11597:7): [True: 0, False: 920]
  ------------------
11598|       |
11599|    920|  if (!chunked) {
  ------------------
  |  Branch (11599:7): [True: 920, False: 0]
  ------------------
11600|       |    // Content-Length based reading
11601|    920|    if (has_content_length && bytes_read >= content_length) {
  ------------------
  |  Branch (11601:9): [True: 920, False: 0]
  |  Branch (11601:31): [True: 0, False: 920]
  ------------------
11602|      0|      eof = true;
11603|      0|      return 0;
11604|      0|    }
11605|       |
11606|    920|    auto to_read = len;
11607|    920|    if (has_content_length) {
  ------------------
  |  Branch (11607:9): [True: 920, False: 0]
  ------------------
11608|    920|      auto remaining = content_length - bytes_read;
11609|    920|      to_read = (std::min)(len, remaining);
11610|    920|    }
11611|    920|    auto n = stream->read(buf, to_read);
11612|       |
11613|    920|    if (n < 0) {
  ------------------
  |  Branch (11613:9): [True: 0, False: 920]
  ------------------
11614|      0|      last_error = stream->get_error();
11615|      0|      if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11615:11): [True: 0, False: 0]
  ------------------
11616|      0|      eof = true;
11617|      0|      return n;
11618|      0|    }
11619|    920|    if (n == 0) {
  ------------------
  |  Branch (11619:9): [True: 449, False: 471]
  ------------------
11620|       |      // Unexpected EOF before content_length
11621|    449|      last_error = stream->get_error();
11622|    449|      if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11622:11): [True: 449, False: 0]
  ------------------
11623|    449|      eof = true;
11624|    449|      return 0;
11625|    449|    }
11626|       |
11627|    471|    bytes_read += static_cast<size_t>(n);
11628|    471|    if (has_content_length && bytes_read >= content_length) { eof = true; }
  ------------------
  |  Branch (11628:9): [True: 471, False: 0]
  |  Branch (11628:31): [True: 1, False: 470]
  ------------------
11629|    471|    if (payload_max_length > 0 && bytes_read > payload_max_length) {
  ------------------
  |  Branch (11629:9): [True: 471, False: 0]
  |  Branch (11629:35): [True: 0, False: 471]
  ------------------
11630|      0|      last_error = Error::ExceedMaxPayloadSize;
11631|      0|      eof = true;
11632|      0|      return -1;
11633|      0|    }
11634|    471|    return n;
11635|    471|  }
11636|       |
11637|       |  // Chunked transfer encoding: delegate to shared decoder instance.
11638|      0|  if (!chunked_decoder) { chunked_decoder.reset(new ChunkedDecoder(*stream)); }
  ------------------
  |  Branch (11638:7): [True: 0, False: 0]
  ------------------
11639|       |
11640|      0|  size_t chunk_offset = 0;
11641|      0|  size_t chunk_total = 0;
11642|      0|  auto n = chunked_decoder->read_payload(buf, len, chunk_offset, chunk_total);
11643|      0|  if (n < 0) {
  ------------------
  |  Branch (11643:7): [True: 0, False: 0]
  ------------------
11644|      0|    last_error = stream->get_error();
11645|      0|    if (last_error == Error::Success) { last_error = Error::Read; }
  ------------------
  |  Branch (11645:9): [True: 0, False: 0]
  ------------------
11646|      0|    eof = true;
11647|      0|    return n;
11648|      0|  }
11649|       |
11650|      0|  if (n == 0) {
  ------------------
  |  Branch (11650:7): [True: 0, False: 0]
  ------------------
11651|       |    // Final chunk observed. Leave trailer parsing to the caller (StreamHandle).
11652|      0|    eof = true;
11653|      0|    return 0;
11654|      0|  }
11655|       |
11656|      0|  bytes_read += static_cast<size_t>(n);
11657|      0|  if (payload_max_length > 0 && bytes_read > payload_max_length) {
  ------------------
  |  Branch (11657:7): [True: 0, False: 0]
  |  Branch (11657:33): [True: 0, False: 0]
  ------------------
11658|      0|    last_error = Error::ExceedMaxPayloadSize;
11659|      0|    eof = true;
11660|      0|    return -1;
11661|      0|  }
11662|      0|  return n;
11663|      0|}
_ZNK7httplib6Stream9get_errorEv:
 1910|    449|  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:
 8323|  3.82k|                                        size_t len) {
 8324|  3.82k|    return receiver(buf, n, off, len);
 8325|  3.82k|  };
_ZZN7httplib10ClientImpl15process_requestERNS_6StreamERNS_7RequestERNS_8ResponseEbRNS_5ErrorEENKUlmmE_clEmm:
15957|    468|    auto progress = [&](size_t current, size_t total) {
15958|    468|      if (!req.download_progress || redirect) { return true; }
  ------------------
  |  Branch (15958:11): [True: 468, False: 0]
  |  Branch (15958:37): [True: 0, False: 0]
  ------------------
15959|      0|      auto ret = req.download_progress(current, total);
15960|      0|      if (!ret) {
  ------------------
  |  Branch (15960:11): [True: 0, False: 0]
  ------------------
15961|      0|        error = Error::Canceled;
15962|      0|        output_error_log(error, &req);
15963|      0|      }
15964|      0|      return ret;
15965|    468|    };
_ZNK7httplib10ClientImpl10output_logERKNS_7RequestERKNS_8ResponseE:
15812|    489|                                   const Response &res) const {
15813|    489|  if (logger_) {
  ------------------
  |  Branch (15813:7): [True: 0, False: 489]
  ------------------
15814|      0|    std::lock_guard<std::mutex> guard(logger_mutex_);
15815|      0|    logger_(req, res);
15816|      0|  }
15817|    489|}
_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:
 7651|    139|inline bool gzip_decompressor::is_valid() const { return is_valid_; }
_ZN7httplib6detail17gzip_decompressor10decompressEPKcmNSt3__18functionIFbS3_mEEE:
 7654|  1.99k|                                          Callback callback) {
 7655|  1.99k|  assert(is_valid_);
  ------------------
  |  Branch (7655:3): [True: 1.99k, False: 0]
  ------------------
 7656|       |
 7657|  1.99k|  auto ret = Z_OK;
 7658|       |
 7659|  1.99k|  do {
 7660|  1.99k|    constexpr size_t max_avail_in =
 7661|  1.99k|        (std::numeric_limits<decltype(strm_.avail_in)>::max)();
 7662|       |
 7663|  1.99k|    strm_.avail_in = static_cast<decltype(strm_.avail_in)>(
 7664|  1.99k|        (std::min)(data_length, max_avail_in));
 7665|  1.99k|    strm_.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>(data));
 7666|       |
 7667|  1.99k|    data_length -= strm_.avail_in;
 7668|  1.99k|    data += strm_.avail_in;
 7669|       |
 7670|  1.99k|    std::array<char, CPPHTTPLIB_COMPRESSION_BUFSIZ> buff{};
 7671|   129k|    while (strm_.avail_in > 0 && ret == Z_OK) {
  ------------------
  |  Branch (7671:12): [True: 127k, False: 1.69k]
  |  Branch (7671:34): [True: 127k, False: 258]
  ------------------
 7672|   127k|      strm_.avail_out = static_cast<uInt>(buff.size());
 7673|   127k|      strm_.next_out = reinterpret_cast<Bytef *>(buff.data());
 7674|       |
 7675|   127k|      ret = inflate(&strm_, Z_NO_FLUSH);
 7676|       |
 7677|   127k|      assert(ret != Z_STREAM_ERROR);
  ------------------
  |  Branch (7677:7): [True: 127k, False: 0]
  ------------------
 7678|   127k|      switch (ret) {
  ------------------
  |  Branch (7678:15): [True: 25, False: 127k]
  ------------------
 7679|      1|      case Z_NEED_DICT:
  ------------------
  |  Branch (7679:7): [True: 1, False: 127k]
  ------------------
 7680|     25|      case Z_DATA_ERROR:
  ------------------
  |  Branch (7680:7): [True: 24, False: 127k]
  ------------------
 7681|     25|      case Z_MEM_ERROR: inflateEnd(&strm_); return false;
  ------------------
  |  Branch (7681:7): [True: 0, False: 127k]
  ------------------
 7682|   127k|      }
 7683|       |
 7684|   127k|      if (!callback(buff.data(), buff.size() - strm_.avail_out)) {
  ------------------
  |  Branch (7684:11): [True: 15, False: 127k]
  ------------------
 7685|     15|        return false;
 7686|     15|      }
 7687|   127k|    }
 7688|       |
 7689|  1.95k|    if (ret != Z_OK && ret != Z_STREAM_END) { return false; }
  ------------------
  |  Branch (7689:9): [True: 259, False: 1.69k]
  |  Branch (7689:24): [True: 0, False: 259]
  ------------------
 7690|       |
 7691|  1.95k|  } while (data_length > 0);
  ------------------
  |  Branch (7691:12): [True: 0, False: 1.95k]
  ------------------
 7692|       |
 7693|  1.95k|  return true;
 7694|  1.99k|}
_ZN7httplib6detail12BufferStreamD2Ev:
 3671|  3.10k|  ~BufferStream() override = default;
_ZN7httplib6detail12BufferStream5writeEPKcm:
12002|  20.5k|inline ssize_t BufferStream::write(const char *ptr, size_t size) {
12003|  20.5k|  buffer.append(ptr, size);
12004|  20.5k|  return static_cast<ssize_t>(size);
12005|  20.5k|}
_ZNK7httplib6Stream13buffered_dataERm:
 1899|  3.65M|  virtual const char *buffered_data(size_t &size) const {
 1900|  3.65M|    size = 0;
 1901|  3.65M|    return nullptr;
 1902|  3.65M|  }
_ZNK7httplib10ClientImpl6is_sslEv:
16076|  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|    146|  case 0: method = "GET"; break;
  ------------------
  |  Branch (78:3): [True: 146, False: 2.96k]
  ------------------
   79|    612|  case 1: method = "POST"; break;
  ------------------
  |  Branch (79:3): [True: 612, False: 2.49k]
  ------------------
   80|    912|  case 2: method = "PUT"; break;
  ------------------
  |  Branch (80:3): [True: 912, False: 2.19k]
  ------------------
   81|    322|  case 3: method = "PATCH"; break;
  ------------------
  |  Branch (81:3): [True: 322, False: 2.78k]
  ------------------
   82|    279|  case 4: method = "DELETE"; break;
  ------------------
  |  Branch (82:3): [True: 279, False: 2.83k]
  ------------------
   83|    838|  case 5: method = "OPTIONS"; break;
  ------------------
  |  Branch (83:3): [True: 838, False: 2.27k]
  ------------------
   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.65M|  ssize_t read(char *ptr, size_t size) override {
   11|  3.65M|    if (size + read_pos_ > size_) { size = size_ - read_pos_; }
  ------------------
  |  Branch (11:9): [True: 3.16k, False: 3.65M]
  ------------------
   12|  3.65M|    memcpy(ptr, data_ + read_pos_, size);
   13|  3.65M|    read_pos_ += size;
   14|  3.65M|    return static_cast<ssize_t>(size);
   15|  3.65M|  }
_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|  }

