_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1299|    602|  insertion_ordered_multimap() = default;
_ZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEE:
10103|    602|                             Params &params) {
10104|    602|  std::set<std::string> cache;
10105|    602|  split(data, data + size, '&', [&](const char *b, const char *e) {
10106|    602|    std::string kv(b, e);
10107|    602|    if (cache.find(kv) != cache.end()) { return; }
10108|    602|    cache.insert(std::move(kv));
10109|       |
10110|    602|    std::string key;
10111|    602|    std::string val;
10112|    602|    divide_query_pair(b, e, key, val);
10113|       |
10114|    602|    if (!key.empty()) {
10115|    602|      params.emplace(decode_query_component(key), decode_query_component(val));
10116|    602|    }
10117|    602|  });
10118|    602|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6732|    800|                  std::function<void(const char *, const char *)> fn) {
 6733|    800|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 6734|    800|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6737|    800|                  std::function<void(const char *, const char *)> fn) {
 6738|    800|  size_t i = 0;
 6739|    800|  size_t beg = 0;
 6740|    800|  size_t count = 1;
 6741|       |
 6742|  37.8M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6742:10): [True: 37.8M, False: 0]
  |  Branch (6742:10): [True: 37.8M, False: 800]
  ------------------
 6743|  37.8M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6743:9): [True: 5.23M, False: 32.5M]
  |  Branch (6743:22): [True: 5.23M, False: 0]
  ------------------
 6744|  5.23M|      auto r = trim(b, e, beg, i);
 6745|  5.23M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6745:11): [True: 375k, False: 4.86M]
  ------------------
 6746|  5.23M|      beg = i + 1;
 6747|  5.23M|      count++;
 6748|  5.23M|    }
 6749|  37.8M|    i++;
 6750|  37.8M|  }
 6751|       |
 6752|    800|  if (i) {
  ------------------
  |  Branch (6752:7): [True: 800, False: 0]
  ------------------
 6753|    800|    auto r = trim(b, e, beg, i);
 6754|    800|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6754:9): [True: 701, False: 99]
  ------------------
 6755|    800|  }
 6756|    800|}
_ZN7httplib6detail4trimEPKcS2_mm:
 6672|  5.23M|                                      size_t right) {
 6673|  7.09M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (6673:10): [True: 7.09M, False: 99]
  |  Branch (6673:26): [True: 1.85M, False: 5.23M]
  ------------------
 6674|  1.85M|    left++;
 6675|  1.85M|  }
 6676|  7.08M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (6676:10): [True: 7.08M, False: 48]
  |  Branch (6676:23): [True: 1.84M, False: 5.23M]
  ------------------
 6677|  1.84M|    right--;
 6678|  1.84M|  }
 6679|  5.23M|  return std::make_pair(left, right);
 6680|  5.23M|}
_ZN7httplib6detail15is_space_or_tabEc:
 6525|  14.1M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (6525:46): [True: 3.69M, False: 10.4M]
  |  Branch (6525:58): [True: 7.78k, False: 10.4M]
  ------------------
_ZZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEEENKUlS2_S2_E_clES2_S2_:
10105|   309k|  split(data, data + size, '&', [&](const char *b, const char *e) {
10106|   309k|    std::string kv(b, e);
10107|   309k|    if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (10107:9): [True: 174k, False: 135k]
  ------------------
10108|   135k|    cache.insert(std::move(kv));
10109|       |
10110|   135k|    std::string key;
10111|   135k|    std::string val;
10112|   135k|    divide_query_pair(b, e, key, val);
10113|       |
10114|   135k|    if (!key.empty()) {
  ------------------
  |  Branch (10114:9): [True: 134k, False: 1.01k]
  ------------------
10115|   134k|      params.emplace(decode_query_component(key), decode_query_component(val));
10116|   134k|    }
10117|   135k|  });
_ZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
10093|   201k|                              std::string &val) {
10094|   201k|  divide(b, static_cast<std::size_t>(e - b), '=',
10095|   201k|         [&](const char *lhs_data, std::size_t lhs_size, const char *rhs_data,
10096|   201k|             std::size_t rhs_size) {
10097|   201k|           key.assign(lhs_data, lhs_size);
10098|   201k|           val.assign(rhs_data, rhs_size);
10099|   201k|         });
10100|   201k|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 6713|   201k|           fn) {
 6714|   201k|  const auto it = std::find(data, data + size, d);
 6715|   201k|  const auto found = static_cast<std::size_t>(it != data + size);
 6716|   201k|  const auto lhs_data = data;
 6717|   201k|  const auto lhs_size = static_cast<std::size_t>(it - data);
 6718|   201k|  const auto rhs_data = it + found;
 6719|   201k|  const auto rhs_size = size - lhs_size - found;
 6720|       |
 6721|   201k|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 6722|   201k|}
_ZZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
10096|   201k|             std::size_t rhs_size) {
10097|   201k|           key.assign(lhs_data, lhs_size);
10098|   201k|           val.assign(rhs_data, rhs_size);
10099|   201k|         });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1328|   134k|  template <typename... Args> iterator emplace(Args &&...args) {
 1329|   134k|    entries_.emplace_back(std::forward<Args>(args)...);
 1330|   134k|    return make_iter(entries_.size() - 1, npos());
 1331|   134k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1437|   134k|  iterator make_iter(size_type idx, size_type key_idx) {
 1438|   134k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1439|   134k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1283|   134k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1203|   134k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib22decode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
12753|   400k|                                          bool plus_as_space) {
12754|   400k|  std::string result;
12755|   400k|  result.reserve(component.size());
12756|       |
12757|  32.3M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (12757:22): [True: 31.9M, False: 400k]
  ------------------
12758|  31.9M|    if (component[i] == '%' && i + 2 < component.size()) {
  ------------------
  |  Branch (12758:9): [True: 249k, False: 31.7M]
  |  Branch (12758:32): [True: 245k, False: 3.40k]
  ------------------
12759|   245k|      auto val = 0;
12760|   245k|      if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (12760:11): [True: 62.3k, False: 183k]
  ------------------
12761|  62.3k|        result += static_cast<char>(val);
12762|  62.3k|        i += 2;
12763|   183k|      } else {
12764|   183k|        result += component[i];
12765|   183k|      }
12766|  31.7M|    } else if (component[i] == '+' && plus_as_space) {
  ------------------
  |  Branch (12766:16): [True: 12.5k, False: 31.7M]
  |  Branch (12766:39): [True: 9.55k, False: 3.02k]
  ------------------
12767|  9.55k|      result += ' '; // + becomes space in form-urlencoded
12768|  31.7M|    } else {
12769|  31.7M|      result += component[i];
12770|  31.7M|    }
12771|  31.9M|  }
12772|   400k|  return result;
12773|   400k|}
_ZN7httplib6detail13from_hex_to_iERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmmRi:
 5797|  1.13M|                          int &val) {
 5798|  1.13M|  if (i >= s.size()) { return false; }
  ------------------
  |  Branch (5798:7): [True: 13, False: 1.13M]
  ------------------
 5799|       |
 5800|  1.13M|  val = 0;
 5801|  1.90M|  for (; cnt; i++, cnt--) {
  ------------------
  |  Branch (5801:10): [True: 1.55M, False: 349k]
  ------------------
 5802|  1.55M|    if (!s[i]) { return false; }
  ------------------
  |  Branch (5802:9): [True: 3.38k, False: 1.54M]
  ------------------
 5803|  1.54M|    auto v = 0;
 5804|  1.54M|    if (is_hex(s[i], v)) {
  ------------------
  |  Branch (5804:9): [True: 767k, False: 781k]
  ------------------
 5805|   767k|      val = val * 16 + v;
 5806|   781k|    } else {
 5807|   781k|      return false;
 5808|   781k|    }
 5809|  1.54M|  }
 5810|   349k|  return true;
 5811|  1.13M|}
_ZN7httplib6detail6is_hexEcRi:
 5782|  1.54M|inline bool is_hex(char c, int &v) {
 5783|  1.54M|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5783:7): [True: 31.3k, False: 1.51M]
  ------------------
 5784|  31.3k|    v = c - '0';
 5785|  31.3k|    return true;
 5786|  1.51M|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5786:14): [True: 1.03M, False: 477k]
  |  Branch (5786:26): [True: 94.0k, False: 945k]
  ------------------
 5787|  94.0k|    v = c - 'A' + 10;
 5788|  94.0k|    return true;
 5789|  1.42M|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5789:14): [True: 939k, False: 483k]
  |  Branch (5789:26): [True: 641k, False: 297k]
  ------------------
 5790|   641k|    v = c - 'a' + 10;
 5791|   641k|    return true;
 5792|   641k|  }
 5793|   781k|  return false;
 5794|  1.54M|}
_ZN7httplib6detail14is_ascii_digitEc:
  674|  5.88M|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (674:45): [True: 1.96M, False: 3.91M]
  |  Branch (674:57): [True: 64.1k, False: 1.90M]
  ------------------
_ZN7httplib21decode_path_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12657|    227|inline std::string decode_path_component(const std::string &component) {
12658|    227|  std::string result;
12659|    227|  result.reserve(component.size());
12660|       |
12661|  3.82M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (12661:22): [True: 3.82M, False: 227]
  ------------------
12662|  3.82M|    if (component[i] == '%' && i + 1 < component.size()) {
  ------------------
  |  Branch (12662:9): [True: 429k, False: 3.39M]
  |  Branch (12662:32): [True: 429k, False: 7]
  ------------------
12663|   429k|      if (component[i + 1] == 'u') {
  ------------------
  |  Branch (12663:11): [True: 3.46k, False: 426k]
  ------------------
12664|       |        // Unicode %uXXXX encoding
12665|  3.46k|        auto val = 0;
12666|       |        // 4 digits Unicode codes: val is 0x0000-0xFFFF (from 4 hex digits),
12667|       |        // so to_utf8 writes at most 3 bytes. buff[4] is safe.
12668|  3.46k|        char buff[4];
12669|  3.46k|        size_t len = 0;
12670|  3.46k|        if (detail::from_hex_to_i(component, i + 2, 4, val) &&
  ------------------
  |  Branch (12670:13): [True: 2.05k, False: 1.41k]
  ------------------
12671|  2.05k|            (len = detail::to_utf8(val, buff)) > 0) {
  ------------------
  |  Branch (12671:13): [True: 1.72k, False: 327]
  ------------------
12672|  1.72k|          result.append(buff, len);
12673|  1.72k|          i += 5; // 'u0000'
12674|  1.74k|        } else {
12675|       |          // Not 4 hex digits, or a surrogate, which is no character: the
12676|       |          // escape is kept as it is rather than joining its neighbours
12677|  1.74k|          result += component[i];
12678|  1.74k|        }
12679|   426k|      } else {
12680|       |        // Standard %XX encoding
12681|   426k|        auto val = 0;
12682|   426k|        if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (12682:13): [True: 152k, False: 274k]
  ------------------
12683|       |          // 2 digits hex codes
12684|   152k|          result += static_cast<char>(val);
12685|   152k|          i += 2; // 'XX'
12686|   274k|        } else {
12687|   274k|          result += component[i];
12688|   274k|        }
12689|   426k|      }
12690|  3.39M|    } else {
12691|  3.39M|      result += component[i];
12692|  3.39M|    }
12693|  3.82M|  }
12694|    227|  return result;
12695|    227|}
_ZN7httplib6detail7to_utf8EiPc:
 5916|  2.05k|inline size_t to_utf8(int code, char *buff) {
 5917|  2.05k|  if (code < 0x0080) {
  ------------------
  |  Branch (5917:7): [True: 365, False: 1.69k]
  ------------------
 5918|    365|    buff[0] = static_cast<char>(code & 0x7F);
 5919|    365|    return 1;
 5920|  1.69k|  } else if (code < 0x0800) {
  ------------------
  |  Branch (5920:14): [True: 624, False: 1.06k]
  ------------------
 5921|    624|    buff[0] = static_cast<char>(0xC0 | ((code >> 6) & 0x1F));
 5922|    624|    buff[1] = static_cast<char>(0x80 | (code & 0x3F));
 5923|    624|    return 2;
 5924|  1.06k|  } else if (code < 0xD800) {
  ------------------
  |  Branch (5924:14): [True: 476, False: 591]
  ------------------
 5925|    476|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5926|    476|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5927|    476|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5928|    476|    return 3;
 5929|    591|  } else if (code < 0xE000) { // D800 - DFFF is invalid...
  ------------------
  |  Branch (5929:14): [True: 327, False: 264]
  ------------------
 5930|    327|    return 0;
 5931|    327|  } else if (code < 0x10000) {
  ------------------
  |  Branch (5931:14): [True: 264, False: 0]
  ------------------
 5932|    264|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5933|    264|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5934|    264|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5935|    264|    return 3;
 5936|    264|  } else if (code < 0x110000) {
  ------------------
  |  Branch (5936:14): [True: 0, False: 0]
  ------------------
 5937|      0|    buff[0] = static_cast<char>(0xF0 | ((code >> 18) & 0x7));
 5938|      0|    buff[1] = static_cast<char>(0x80 | ((code >> 12) & 0x3F));
 5939|      0|    buff[2] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5940|      0|    buff[3] = static_cast<char>(0x80 | (code & 0x3F));
 5941|      0|    return 4;
 5942|      0|  }
 5943|       |
 5944|       |  // NOTREACHED
 5945|      0|  return 0;
 5946|  2.05k|}
_ZN7httplib22encode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
12698|  66.7k|                                          bool space_as_plus) {
12699|  66.7k|  std::string result;
12700|  66.7k|  result.reserve(component.size() * 3);
12701|       |
12702|  4.39M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (12702:22): [True: 4.32M, False: 66.7k]
  ------------------
12703|  4.32M|    auto c = static_cast<unsigned char>(component[i]);
12704|       |
12705|       |    // Unreserved characters per RFC 3986
12706|  4.32M|    if (detail::is_ascii_alnum(static_cast<char>(c)) || c == '-' || c == '.' ||
  ------------------
  |  Branch (12706:9): [True: 275k, False: 4.04M]
  |  Branch (12706:57): [True: 3.92k, False: 4.04M]
  |  Branch (12706:69): [True: 4.70k, False: 4.04M]
  ------------------
12707|  4.04M|        c == '_' || c == '~') {
  ------------------
  |  Branch (12707:9): [True: 3.22k, False: 4.03M]
  |  Branch (12707:21): [True: 3.74k, False: 4.03M]
  ------------------
12708|   291k|      result += static_cast<char>(c);
12709|   291k|    }
12710|       |    // Space handling
12711|  4.03M|    else if (c == ' ') {
  ------------------
  |  Branch (12711:14): [True: 5.62k, False: 4.02M]
  ------------------
12712|  5.62k|      if (space_as_plus) {
  ------------------
  |  Branch (12712:11): [True: 5.62k, False: 0]
  ------------------
12713|  5.62k|        result += '+';
12714|  5.62k|      } else {
12715|      0|        result += "%20";
12716|      0|      }
12717|  5.62k|    }
12718|       |    // Plus sign handling
12719|  4.02M|    else if (c == '+') {
  ------------------
  |  Branch (12719:14): [True: 3.13k, False: 4.02M]
  ------------------
12720|  3.13k|      if (space_as_plus) {
  ------------------
  |  Branch (12720:11): [True: 3.13k, False: 0]
  ------------------
12721|  3.13k|        result += "%2B";
12722|  3.13k|      } else {
12723|      0|        result += static_cast<char>(c);
12724|      0|      }
12725|  3.13k|    }
12726|       |    // Query-safe sub-delimiters (excluding & and = which are query delimiters)
12727|  4.02M|    else if (c == '!' || c == '$' || c == '\'' || c == '(' || c == ')' ||
  ------------------
  |  Branch (12727:14): [True: 4.73k, False: 4.01M]
  |  Branch (12727:26): [True: 3.37k, False: 4.01M]
  |  Branch (12727:38): [True: 3.51k, False: 4.01M]
  |  Branch (12727:51): [True: 3.36k, False: 4.00M]
  |  Branch (12727:63): [True: 26.0k, False: 3.98M]
  ------------------
12728|  3.98M|             c == '*' || c == ',' || c == ';') {
  ------------------
  |  Branch (12728:14): [True: 3.93k, False: 3.97M]
  |  Branch (12728:26): [True: 5.10k, False: 3.97M]
  |  Branch (12728:38): [True: 3.52k, False: 3.97M]
  ------------------
12729|  53.5k|      result += static_cast<char>(c);
12730|  53.5k|    }
12731|       |    // Colon and @ are allowed in query
12732|  3.97M|    else if (c == ':' || c == '@') {
  ------------------
  |  Branch (12732:14): [True: 3.67k, False: 3.96M]
  |  Branch (12732:26): [True: 553k, False: 3.41M]
  ------------------
12733|   557k|      result += static_cast<char>(c);
12734|   557k|    }
12735|       |    // Forward slash is allowed in query values
12736|  3.41M|    else if (c == '/') {
  ------------------
  |  Branch (12736:14): [True: 6.46k, False: 3.40M]
  ------------------
12737|  6.46k|      result += static_cast<char>(c);
12738|  6.46k|    }
12739|       |    // Question mark is allowed in query values (after first ?)
12740|  3.40M|    else if (c == '?') {
  ------------------
  |  Branch (12740:14): [True: 3.37k, False: 3.40M]
  ------------------
12741|  3.37k|      result += static_cast<char>(c);
12742|  3.40M|    } else {
12743|  3.40M|      result += '%';
12744|  3.40M|      char hex[3];
12745|  3.40M|      snprintf(hex, sizeof(hex), "%02X", c);
12746|  3.40M|      result.append(hex, 2);
12747|  3.40M|    }
12748|  4.32M|  }
12749|  66.7k|  return result;
12750|  66.7k|}
_ZN7httplib6detail14is_ascii_alnumEc:
  680|  4.33M|inline bool is_ascii_alnum(char c) {
  681|  4.33M|  return is_ascii_digit(c) || is_ascii_alpha(c);
  ------------------
  |  Branch (681:10): [True: 32.5k, False: 4.30M]
  |  Branch (681:31): [True: 244k, False: 4.05M]
  ------------------
  682|  4.33M|}
_ZN7httplib6detail14is_ascii_alphaEc:
  676|  4.30M|inline bool is_ascii_alpha(char c) {
  677|  4.30M|  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
  ------------------
  |  Branch (677:11): [True: 179k, False: 4.12M]
  |  Branch (677:23): [True: 161k, False: 17.9k]
  |  Branch (677:37): [True: 121k, False: 4.02M]
  |  Branch (677:49): [True: 83.0k, False: 38.0k]
  ------------------
  678|  4.30M|}
_ZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
10131|    198|inline std::string normalize_query_string(const std::string &query) {
10132|    198|  std::string result;
10133|    198|  split(query.data(), query.data() + query.size(), '&',
10134|    198|        [&](const char *b, const char *e) {
10135|    198|          std::string key;
10136|    198|          std::string val;
10137|    198|          divide_query_pair(b, e, key, val);
10138|       |
10139|    198|          if (!key.empty()) {
10140|    198|            auto dec_key = decode_query_component(key);
10141|    198|            auto dec_val = decode_query_component(val);
10142|       |
10143|    198|            if (!result.empty()) { result += '&'; }
10144|    198|            result += encode_query_component(dec_key);
10145|    198|            if (!val.empty() || std::find(b, e, '=') != e) {
10146|    198|              result += '=';
10147|    198|              result += encode_query_component(dec_val);
10148|    198|            }
10149|    198|          }
10150|    198|        });
10151|    198|  return result;
10152|    198|}
_ZZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcSB_E_clESB_SB_:
10134|  66.3k|        [&](const char *b, const char *e) {
10135|  66.3k|          std::string key;
10136|  66.3k|          std::string val;
10137|  66.3k|          divide_query_pair(b, e, key, val);
10138|       |
10139|  66.3k|          if (!key.empty()) {
  ------------------
  |  Branch (10139:15): [True: 65.8k, False: 550]
  ------------------
10140|  65.8k|            auto dec_key = decode_query_component(key);
10141|  65.8k|            auto dec_val = decode_query_component(val);
10142|       |
10143|  65.8k|            if (!result.empty()) { result += '&'; }
  ------------------
  |  Branch (10143:17): [True: 65.6k, False: 182]
  ------------------
10144|  65.8k|            result += encode_query_component(dec_key);
10145|  65.8k|            if (!val.empty() || std::find(b, e, '=') != e) {
  ------------------
  |  Branch (10145:17): [True: 356, False: 65.4k]
  |  Branch (10145:17): [True: 770, False: 65.0k]
  |  Branch (10145:33): [True: 414, False: 65.0k]
  ------------------
10146|    770|              result += '=';
10147|    770|              result += encode_query_component(dec_val);
10148|    770|            }
10149|  65.8k|          }
10150|  66.3k|        });
_ZN7httplib6detail13is_valid_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6381|    123|inline bool is_valid_path(const std::string &path) {
 6382|    123|  if (path.empty() || path[0] != '/') { return false; }
  ------------------
  |  Branch (6382:7): [True: 0, False: 123]
  |  Branch (6382:23): [True: 25, False: 98]
  ------------------
 6383|       |
 6384|     98|  auto beg = size_t{1};
 6385|  1.09M|  for (auto i = beg; i <= path.size(); i++) {
  ------------------
  |  Branch (6385:22): [True: 1.09M, False: 70]
  ------------------
 6386|  1.09M|    if (i < path.size() && path[i] != '/') {
  ------------------
  |  Branch (6386:9): [True: 1.09M, False: 74]
  |  Branch (6386:28): [True: 1.09M, False: 481]
  ------------------
 6387|  1.09M|      if (path[i] == '\0' || path[i] == '\\') { return false; }
  ------------------
  |  Branch (6387:11): [True: 4, False: 1.09M]
  |  Branch (6387:30): [True: 2, False: 1.09M]
  ------------------
 6388|       |#ifdef _WIN32
 6389|       |      if (path[i] == ':') { return false; }
 6390|       |#endif
 6391|  1.09M|      continue;
 6392|  1.09M|    }
 6393|    555|    auto len = i - beg;
 6394|    555|    if ((len == 0 && i < path.size()) ||
  ------------------
  |  Branch (6394:10): [True: 26, False: 529]
  |  Branch (6394:22): [True: 18, False: 8]
  ------------------
 6395|    537|        (len > 0 && (path[i - 1] == '.' || path[i - 1] == ' '))) {
  ------------------
  |  Branch (6395:10): [True: 529, False: 8]
  |  Branch (6395:22): [True: 2, False: 527]
  |  Branch (6395:44): [True: 2, False: 525]
  ------------------
 6396|     22|      return false;
 6397|     22|    }
 6398|    533|    beg = i + 1;
 6399|    533|  }
 6400|     70|  return true;
 6401|     98|}
_ZN7httplib6detail9parse_urlERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_13UrlComponentsE:
  930|    437|inline bool parse_url(const std::string &url, UrlComponents &uc) {
  931|    437|  uc = {};
  932|    437|  size_t pos = 0;
  933|       |
  934|    437|  auto sep = url.find("://");
  935|    437|  if (sep < url.find_first_of("/?#")) {
  ------------------
  |  Branch (935:7): [True: 47, False: 390]
  ------------------
  936|       |    // Schemes are case-insensitive (RFC 3986 3.1)
  937|     47|    uc.scheme = case_ignore::to_lower(url.substr(0, sep));
  938|       |
  939|       |    // Scheme must be [a-z]+ only
  940|     47|    if (uc.scheme.empty()) { return false; }
  ------------------
  |  Branch (940:9): [True: 1, False: 46]
  ------------------
  941|  1.40k|    for (auto c : uc.scheme) {
  ------------------
  |  Branch (941:17): [True: 1.40k, False: 28]
  ------------------
  942|  1.40k|      if (c < 'a' || c > 'z') { return false; }
  ------------------
  |  Branch (942:11): [True: 17, False: 1.38k]
  |  Branch (942:22): [True: 1, False: 1.38k]
  ------------------
  943|  1.40k|    }
  944|       |
  945|     28|    pos = sep + 3;
  946|    390|  } else if (url.compare(0, 2, "//") == 0) {
  ------------------
  |  Branch (946:14): [True: 6, False: 384]
  ------------------
  947|      6|    pos = 2;
  948|      6|  }
  949|       |
  950|    418|  auto has_authority_prefix = pos > 0;
  951|    418|  auto has_authority = has_authority_prefix || (!url.empty() && url[0] != '/' &&
  ------------------
  |  Branch (951:24): [True: 34, False: 384]
  |  Branch (951:49): [True: 384, False: 0]
  |  Branch (951:65): [True: 376, False: 8]
  ------------------
  952|    376|                                                url[0] != '?' && url[0] != '#');
  ------------------
  |  Branch (952:49): [True: 372, False: 4]
  |  Branch (952:66): [True: 371, False: 1]
  ------------------
  953|    418|  if (has_authority) {
  ------------------
  |  Branch (953:7): [True: 405, False: 13]
  ------------------
  954|       |    // userinfo is not supported, and a backslash that some parsers take for
  955|       |    // '/' would leave them seeing another host than this one.
  956|    405|    if (url.find_first_of("@\\", pos) < url.find_first_of("/?#", pos)) {
  ------------------
  |  Branch (956:9): [True: 19, False: 386]
  ------------------
  957|     19|      return false;
  958|     19|    }
  959|       |
  960|    386|    if (pos < url.size() && url[pos] == '[') {
  ------------------
  |  Branch (960:9): [True: 364, False: 22]
  |  Branch (960:29): [True: 155, False: 209]
  ------------------
  961|    155|      auto close = url.find(']', pos);
  962|    155|      if (close == std::string::npos) { return false; }
  ------------------
  |  Branch (962:11): [True: 5, False: 150]
  ------------------
  963|    150|      uc.host = url.substr(pos + 1, close - pos - 1);
  964|       |
  965|       |      // IPv6 host must be [a-fA-F0-9:]+ only
  966|    150|      if (uc.host.empty()) { return false; }
  ------------------
  |  Branch (966:11): [True: 1, False: 149]
  ------------------
  967|  1.47k|      for (auto c : uc.host) {
  ------------------
  |  Branch (967:19): [True: 1.47k, False: 96]
  ------------------
  968|  1.47k|        if (!(is_ascii_digit(c) || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (968:15): [True: 219, False: 1.25k]
  |  Branch (968:37): [True: 272, False: 981]
  |  Branch (968:49): [True: 267, False: 5]
  ------------------
  969|    986|              (c >= 'A' && c <= 'F') || c == ':')) {
  ------------------
  |  Branch (969:16): [True: 555, False: 431]
  |  Branch (969:28): [True: 544, False: 11]
  |  Branch (969:41): [True: 389, False: 53]
  ------------------
  970|     53|          return false;
  971|     53|        }
  972|  1.47k|      }
  973|       |
  974|     96|      pos = close + 1;
  975|       |
  976|       |      // The IPv6 literal is the whole host, so ']' must be followed by a port,
  977|       |      // path, query or fragment delimiter (or the end of input). Otherwise the
  978|       |      // trailing bytes would be folded into the path while the connection
  979|       |      // still targets the bracketed address.
  980|     96|      if (pos < url.size()) {
  ------------------
  |  Branch (980:11): [True: 56, False: 40]
  ------------------
  981|     56|        auto c = url[pos];
  982|     56|        if (c != ':' && c != '/' && c != '?' && c != '#') { return false; }
  ------------------
  |  Branch (982:13): [True: 55, False: 1]
  |  Branch (982:25): [True: 53, False: 2]
  |  Branch (982:37): [True: 51, False: 2]
  |  Branch (982:49): [True: 48, False: 3]
  ------------------
  983|     56|      }
  984|    231|    } else {
  985|    231|      auto end = url.find_first_of(":/?#", pos);
  986|    231|      if (end == std::string::npos) { end = url.size(); }
  ------------------
  |  Branch (986:11): [True: 70, False: 161]
  ------------------
  987|    231|      uc.host = url.substr(pos, end - pos);
  988|    231|      pos = end;
  989|    231|    }
  990|       |
  991|    279|    if (pos < url.size() && url[pos] == ':') {
  ------------------
  |  Branch (991:9): [True: 169, False: 110]
  |  Branch (991:29): [True: 52, False: 117]
  ------------------
  992|     52|      ++pos;
  993|     52|      auto end = url.find_first_of("/?#", pos);
  994|     52|      if (end == std::string::npos) { end = url.size(); }
  ------------------
  |  Branch (994:11): [True: 13, False: 39]
  ------------------
  995|     52|      uc.port = url.substr(pos, end - pos);
  996|     52|      pos = end;
  997|     52|    }
  998|       |
  999|       |    // Without :// or //, the entire input must be consumed as host[:port].
 1000|       |    // If there is leftover (path, query, etc.), this is not a valid
 1001|       |    // host[:port] string — clear and reparse as a plain path.
 1002|    279|    if (!has_authority_prefix && pos < url.size()) {
  ------------------
  |  Branch (1002:9): [True: 246, False: 33]
  |  Branch (1002:34): [True: 150, False: 96]
  ------------------
 1003|    150|      uc.host.clear();
 1004|    150|      uc.port.clear();
 1005|    150|      pos = 0;
 1006|    150|    }
 1007|    279|  }
 1008|       |
 1009|    292|  if (pos < url.size() && url[pos] != '?' && url[pos] != '#') {
  ------------------
  |  Branch (1009:7): [True: 169, False: 123]
  |  Branch (1009:27): [True: 165, False: 4]
  |  Branch (1009:46): [True: 162, False: 3]
  ------------------
 1010|    162|    auto end = url.find_first_of("?#", pos);
 1011|    162|    if (end == std::string::npos) { end = url.size(); }
  ------------------
  |  Branch (1011:9): [True: 49, False: 113]
  ------------------
 1012|    162|    uc.path = url.substr(pos, end - pos);
 1013|    162|    pos = end;
 1014|    162|  }
 1015|       |
 1016|    292|  if (pos < url.size() && url[pos] == '?') {
  ------------------
  |  Branch (1016:7): [True: 120, False: 172]
  |  Branch (1016:27): [True: 76, False: 44]
  ------------------
 1017|     76|    auto end = url.find('#', pos);
 1018|     76|    if (end == std::string::npos) { end = url.size(); }
  ------------------
  |  Branch (1018:9): [True: 42, False: 34]
  ------------------
 1019|     76|    uc.query = url.substr(pos, end - pos);
 1020|     76|  }
 1021|       |
 1022|    292|  return true;
 1023|    418|}
_ZN7httplib6detail11case_ignore8to_lowerERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|     47|inline std::string to_lower(const std::string &s) {
  711|     47|  std::string result = s;
  712|     47|  std::transform(
  713|     47|      result.begin(), result.end(), result.begin(),
  714|     47|      [](unsigned char c) { return static_cast<char>(to_lower(c)); });
  715|     47|  return result;
  716|     47|}
_ZZN7httplib6detail11case_ignore8to_lowerERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEENKUlhE_clEh:
  714|  2.92k|      [](unsigned char c) { return static_cast<char>(to_lower(c)); });
_ZN7httplib6detail11case_ignore8to_lowerEi:
  686|  2.92k|inline unsigned char to_lower(int c) {
  687|  2.92k|  const static unsigned char table[256] = {
  688|  2.92k|      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  689|  2.92k|      15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  690|  2.92k|      30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  691|  2.92k|      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  692|  2.92k|      60,  61,  62,  63,  64,  97,  98,  99,  100, 101, 102, 103, 104, 105, 106,
  693|  2.92k|      107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  694|  2.92k|      122, 91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  695|  2.92k|      105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  696|  2.92k|      120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  697|  2.92k|      135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  698|  2.92k|      150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  699|  2.92k|      165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  700|  2.92k|      180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 224, 225, 226,
  701|  2.92k|      227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
  702|  2.92k|      242, 243, 244, 245, 246, 215, 248, 249, 250, 251, 252, 253, 254, 223, 224,
  703|  2.92k|      225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  704|  2.92k|      240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  705|  2.92k|      255,
  706|  2.92k|  };
  707|  2.92k|  return table[(unsigned char)(char)c];
  708|  2.92k|}
_ZN7httplib6detail19remove_dot_segmentsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1027|    200|inline std::string remove_dot_segments(const std::string &path) {
 1028|    200|  std::string out;
 1029|    200|  size_t i = 0;
 1030|   364k|  while (i < path.size()) {
  ------------------
  |  Branch (1030:10): [True: 364k, False: 200]
  ------------------
 1031|   364k|    auto next = (std::min)(path.find('/', i + 1), path.size());
 1032|   364k|    auto segment = path.substr(i + 1, next - i - 1);
 1033|   364k|    auto is_last = next == path.size();
 1034|   364k|    if (segment == "." || segment == "..") {
  ------------------
  |  Branch (1034:9): [True: 7.39k, False: 356k]
  |  Branch (1034:27): [True: 25.8k, False: 331k]
  ------------------
 1035|  33.2k|      if (segment == "..") {
  ------------------
  |  Branch (1035:11): [True: 25.8k, False: 7.39k]
  ------------------
 1036|  25.8k|        out.erase((std::min)(out.rfind('/'), out.size()));
 1037|  25.8k|      }
 1038|  33.2k|      if (is_last) { out += '/'; }
  ------------------
  |  Branch (1038:11): [True: 21, False: 33.2k]
  ------------------
 1039|   331k|    } else {
 1040|   331k|      out += '/';
 1041|   331k|      out += segment;
 1042|   331k|    }
 1043|   364k|    i = next;
 1044|   364k|  }
 1045|    200|  if (out.empty()) { out = "/"; }
  ------------------
  |  Branch (1045:7): [True: 0, False: 200]
  ------------------
 1046|    200|  return out;
 1047|    200|}
_ZN7httplib6detail25resolve_relative_locationERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
 1053|    249|                                             const std::string &base) {
 1054|    249|  if (location.empty() || location[0] == '/') { return location; }
  ------------------
  |  Branch (1054:7): [True: 1, False: 248]
  |  Branch (1054:27): [True: 2, False: 246]
  ------------------
 1055|       |
 1056|       |  // A ':' in the first segment means the value has a scheme.
 1057|    246|  if (location.find(':') < location.find_first_of("/?#")) { return location; }
  ------------------
  |  Branch (1057:7): [True: 21, False: 225]
  ------------------
 1058|       |
 1059|       |  // A path starting with "//" would be re-parsed as an authority. Prefix "/."
 1060|       |  // (as the URL Standard does); remove_dot_segments strips it later.
 1061|    225|  auto on_this_host = [](std::string path) -> std::string {
 1062|    225|    if (path.compare(0, 2, "//") == 0) { path.insert(0, "/."); }
 1063|    225|    return path;
 1064|    225|  };
 1065|       |
 1066|    225|  if (location[0] == '#') {
  ------------------
  |  Branch (1066:7): [True: 4, False: 221]
  ------------------
 1067|      4|    return on_this_host(base.substr(0, base.find('#')) + location);
 1068|      4|  }
 1069|       |
 1070|    221|  auto base_path = base.substr(0, base.find_first_of("?#"));
 1071|    221|  if (location[0] == '?') { return on_this_host(base_path + location); }
  ------------------
  |  Branch (1071:7): [True: 56, False: 165]
  ------------------
 1072|       |
 1073|    165|  if (base_path.empty() || base_path[0] != '/') { base_path = "/"; }
  ------------------
  |  Branch (1073:7): [True: 4, False: 161]
  |  Branch (1073:28): [True: 28, False: 133]
  ------------------
 1074|    165|  auto merged = base_path.substr(0, base_path.rfind('/') + 1) + location;
 1075|       |
 1076|       |  // Remove "." and ".." segments from the merged path.
 1077|    165|  auto path_end = (std::min)(merged.find_first_of("?#"), merged.size());
 1078|    165|  return on_this_host(remove_dot_segments(merged.substr(0, path_end)) +
 1079|    165|                      merged.substr(path_end));
 1080|    221|}
_ZZN7httplib6detail25resolve_relative_locationERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_ENKUlS7_E_clES7_:
 1061|    225|  auto on_this_host = [](std::string path) -> std::string {
 1062|    225|    if (path.compare(0, 2, "//") == 0) { path.insert(0, "/."); }
  ------------------
  |  Branch (1062:9): [True: 9, False: 216]
  ------------------
 1063|    225|    return path;
 1064|    225|  };
_ZN7httplib6detail11encode_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6482|     94|inline std::string encode_path(const std::string &s) {
 6483|     94|  std::string result;
 6484|     94|  result.reserve(s.size());
 6485|       |
 6486|  1.90k|  for (size_t i = 0; s[i]; i++) {
  ------------------
  |  Branch (6486:22): [True: 1.81k, False: 94]
  ------------------
 6487|  1.81k|    switch (s[i]) {
 6488|    194|    case ' ': result += "%20"; break;
  ------------------
  |  Branch (6488:5): [True: 194, False: 1.62k]
  ------------------
 6489|    194|    case '+': result += "%2B"; break;
  ------------------
  |  Branch (6489:5): [True: 194, False: 1.62k]
  ------------------
 6490|    194|    case '\'': result += "%27"; break;
  ------------------
  |  Branch (6490:5): [True: 194, False: 1.62k]
  ------------------
 6491|    194|    case ',': result += "%2C"; break;
  ------------------
  |  Branch (6491:5): [True: 194, False: 1.62k]
  ------------------
 6492|       |    // case ':': result += "%3A"; break; // ok? probably...
 6493|    194|    case ';': result += "%3B"; break;
  ------------------
  |  Branch (6493:5): [True: 194, False: 1.62k]
  ------------------
 6494|    844|    default:
  ------------------
  |  Branch (6494:5): [True: 844, False: 970]
  ------------------
 6495|    844|      auto c = static_cast<uint8_t>(s[i]);
 6496|       |      // Control characters (incl. CR/LF) and non-ASCII bytes are not allowed
 6497|       |      // in a request-target as-is.
 6498|    844|      if (c < 0x20 || c == 0x7f || c >= 0x80) {
  ------------------
  |  Branch (6498:11): [True: 201, False: 643]
  |  Branch (6498:23): [True: 194, False: 449]
  |  Branch (6498:36): [True: 220, False: 229]
  ------------------
 6499|    615|        result += '%';
 6500|    615|        char hex[4];
 6501|    615|        auto len = snprintf(hex, sizeof(hex) - 1, "%02X", c);
 6502|    615|        assert(len == 2);
  ------------------
  |  Branch (6502:9): [True: 615, False: 0]
  ------------------
 6503|    615|        result.append(hex, static_cast<size_t>(len));
 6504|    615|      } else {
 6505|    229|        result += s[i];
 6506|    229|      }
 6507|    844|      break;
 6508|  1.81k|    }
 6509|  1.81k|  }
 6510|       |
 6511|     94|  return result;
 6512|     94|}
_ZN7httplib20encode_uri_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12527|    283|inline std::string encode_uri_component(const std::string &value) {
12528|    283|  std::ostringstream escaped;
12529|    283|  escaped.fill('0');
12530|    283|  escaped << std::hex;
12531|       |
12532|  6.18k|  for (auto c : value) {
  ------------------
  |  Branch (12532:15): [True: 6.18k, False: 283]
  ------------------
12533|  6.18k|    if (detail::is_ascii_alnum(c) || c == '-' || c == '_' || c == '.' ||
  ------------------
  |  Branch (12533:9): [True: 548, False: 5.64k]
  |  Branch (12533:38): [True: 195, False: 5.44k]
  |  Branch (12533:50): [True: 195, False: 5.25k]
  |  Branch (12533:62): [True: 220, False: 5.03k]
  ------------------
12534|  5.03k|        c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || c == ')') {
  ------------------
  |  Branch (12534:9): [True: 197, False: 4.83k]
  |  Branch (12534:21): [True: 199, False: 4.63k]
  |  Branch (12534:33): [True: 199, False: 4.43k]
  |  Branch (12534:45): [True: 194, False: 4.24k]
  |  Branch (12534:58): [True: 203, False: 4.03k]
  |  Branch (12534:70): [True: 327, False: 3.71k]
  ------------------
12535|  2.47k|      escaped << c;
12536|  3.71k|    } else {
12537|  3.71k|      escaped << std::uppercase;
12538|  3.71k|      escaped << '%' << std::setw(2)
12539|  3.71k|              << static_cast<int>(static_cast<unsigned char>(c));
12540|  3.71k|      escaped << std::nouppercase;
12541|  3.71k|    }
12542|  6.18k|  }
12543|       |
12544|    283|  return escaped.str();
12545|    283|}
_ZN7httplib10encode_uriERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12547|    283|inline std::string encode_uri(const std::string &value) {
12548|    283|  std::ostringstream escaped;
12549|    283|  escaped.fill('0');
12550|    283|  escaped << std::hex;
12551|       |
12552|  6.18k|  for (auto c : value) {
  ------------------
  |  Branch (12552:15): [True: 6.18k, False: 283]
  ------------------
12553|  6.18k|    if (detail::is_ascii_alnum(c) || c == '-' || c == '_' || c == '.' ||
  ------------------
  |  Branch (12553:9): [True: 548, False: 5.64k]
  |  Branch (12553:38): [True: 195, False: 5.44k]
  |  Branch (12553:50): [True: 195, False: 5.25k]
  |  Branch (12553:62): [True: 220, False: 5.03k]
  ------------------
12554|  5.03k|        c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || c == ')' ||
  ------------------
  |  Branch (12554:9): [True: 197, False: 4.83k]
  |  Branch (12554:21): [True: 199, False: 4.63k]
  |  Branch (12554:33): [True: 199, False: 4.43k]
  |  Branch (12554:45): [True: 194, False: 4.24k]
  |  Branch (12554:58): [True: 203, False: 4.03k]
  |  Branch (12554:70): [True: 327, False: 3.71k]
  ------------------
12555|  3.71k|        c == ';' || c == '/' || c == '?' || c == ':' || c == '@' || c == '&' ||
  ------------------
  |  Branch (12555:9): [True: 195, False: 3.51k]
  |  Branch (12555:21): [True: 222, False: 3.29k]
  |  Branch (12555:33): [True: 196, False: 3.09k]
  |  Branch (12555:45): [True: 199, False: 2.90k]
  |  Branch (12555:57): [True: 194, False: 2.70k]
  |  Branch (12555:69): [True: 243, False: 2.46k]
  ------------------
12556|  4.86k|        c == '=' || c == '+' || c == '$' || c == ',' || c == '#') {
  ------------------
  |  Branch (12556:9): [True: 217, False: 2.24k]
  |  Branch (12556:21): [True: 323, False: 1.92k]
  |  Branch (12556:33): [True: 203, False: 1.72k]
  |  Branch (12556:45): [True: 197, False: 1.52k]
  |  Branch (12556:57): [True: 201, False: 1.32k]
  ------------------
12557|  4.86k|      escaped << c;
12558|  4.86k|    } else {
12559|  1.32k|      escaped << std::uppercase;
12560|  1.32k|      escaped << '%' << std::setw(2)
12561|  1.32k|              << static_cast<int>(static_cast<unsigned char>(c));
12562|  1.32k|      escaped << std::nouppercase;
12563|  1.32k|    }
12564|  6.18k|  }
12565|       |
12566|    283|  return escaped.str();
12567|    283|}
_ZN7httplib20decode_uri_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12569|    236|inline std::string decode_uri_component(const std::string &value) {
12570|    236|  std::string result;
12571|       |
12572|  1.79M|  for (size_t i = 0; i < value.size(); i++) {
  ------------------
  |  Branch (12572:22): [True: 1.79M, False: 236]
  ------------------
12573|  1.79M|    if (value[i] == '%' && i + 2 < value.size()) {
  ------------------
  |  Branch (12573:9): [True: 229k, False: 1.56M]
  |  Branch (12573:28): [True: 229k, False: 46]
  ------------------
12574|   229k|      auto val = 0;
12575|   229k|      if (detail::from_hex_to_i(value, i + 1, 2, val)) {
  ------------------
  |  Branch (12575:11): [True: 66.5k, False: 162k]
  ------------------
12576|  66.5k|        result += static_cast<char>(val);
12577|  66.5k|        i += 2;
12578|   162k|      } else {
12579|   162k|        result += value[i];
12580|   162k|      }
12581|  1.56M|    } else {
12582|  1.56M|      result += value[i];
12583|  1.56M|    }
12584|  1.79M|  }
12585|       |
12586|    236|  return result;
12587|    236|}
_ZN7httplib10decode_uriERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12589|    236|inline std::string decode_uri(const std::string &value) {
12590|    236|  std::string result;
12591|       |
12592|  1.79M|  for (size_t i = 0; i < value.size(); i++) {
  ------------------
  |  Branch (12592:22): [True: 1.79M, False: 236]
  ------------------
12593|  1.79M|    if (value[i] == '%' && i + 2 < value.size()) {
  ------------------
  |  Branch (12593:9): [True: 229k, False: 1.56M]
  |  Branch (12593:28): [True: 229k, False: 46]
  ------------------
12594|   229k|      auto val = 0;
12595|   229k|      if (detail::from_hex_to_i(value, i + 1, 2, val)) {
  ------------------
  |  Branch (12595:11): [True: 66.5k, False: 162k]
  ------------------
12596|  66.5k|        auto c = static_cast<char>(val);
12597|       |        // Keep escapes of the reserved characters that encode_uri leaves
12598|       |        // literal, so decode_uri is the inverse of encode_uri and an escaped
12599|       |        // delimiter is not promoted into a real one (as with JS decodeURI).
12600|  66.5k|        if (c == ';' || c == '/' || c == '?' || c == ':' || c == '@' ||
  ------------------
  |  Branch (12600:13): [True: 5.14k, False: 61.4k]
  |  Branch (12600:25): [True: 793, False: 60.6k]
  |  Branch (12600:37): [True: 196, False: 60.4k]
  |  Branch (12600:49): [True: 205, False: 60.2k]
  |  Branch (12600:61): [True: 196, False: 60.0k]
  ------------------
12601|  60.0k|            c == '&' || c == '=' || c == '+' || c == '$' || c == ',' ||
  ------------------
  |  Branch (12601:13): [True: 194, False: 59.8k]
  |  Branch (12601:25): [True: 220, False: 59.5k]
  |  Branch (12601:37): [True: 935, False: 58.6k]
  |  Branch (12601:49): [True: 376, False: 58.2k]
  |  Branch (12601:61): [True: 314, False: 57.9k]
  ------------------
12602|  57.9k|            c == '#') {
  ------------------
  |  Branch (12602:13): [True: 229, False: 57.7k]
  ------------------
12603|  8.80k|          result += value[i];
12604|  8.80k|          result += value[i + 1];
12605|  8.80k|          result += value[i + 2];
12606|  57.7k|        } else {
12607|  57.7k|          result += c;
12608|  57.7k|        }
12609|  66.5k|        i += 2;
12610|   162k|      } else {
12611|   162k|        result += value[i];
12612|   162k|      }
12613|  1.56M|    } else {
12614|  1.56M|      result += value[i];
12615|  1.56M|    }
12616|  1.79M|  }
12617|       |
12618|    236|  return result;
12619|    236|}
_ZN7httplib17sanitize_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
12775|    130|inline std::string sanitize_filename(const std::string &filename) {
12776|       |  // Extract basename: find the last path separator (/ or \) and, on Windows,
12777|       |  // ':', which ends a drive prefix ("C:..") or names an NTFS stream ("a:b")
12778|       |#ifdef _WIN32
12779|       |  auto pos = filename.find_last_of("/\\:");
12780|       |#else
12781|    130|  auto pos = filename.find_last_of("/\\");
12782|    130|#endif
12783|    130|  auto result =
12784|    130|      (pos != std::string::npos) ? filename.substr(pos + 1) : filename;
  ------------------
  |  Branch (12784:7): [True: 31, False: 99]
  ------------------
12785|       |
12786|       |  // Strip null bytes
12787|    130|  result.erase(std::remove(result.begin(), result.end(), '\0'), result.end());
12788|       |
12789|       |  // Trim whitespace
12790|    130|  {
12791|    130|    auto start = result.find_first_not_of(" \t");
12792|    130|    auto end = result.find_last_not_of(" \t");
12793|    130|    result = (start == std::string::npos)
  ------------------
  |  Branch (12793:14): [True: 32, False: 98]
  ------------------
12794|    130|                 ? ""
12795|    130|                 : result.substr(start, end - start + 1);
12796|    130|  }
12797|       |
12798|       |  // Reject . and ..
12799|    130|  if (result == "." || result == "..") { return ""; }
  ------------------
  |  Branch (12799:7): [True: 1, False: 129]
  |  Branch (12799:24): [True: 1, False: 128]
  ------------------
12800|       |
12801|    128|  return result;
12802|    130|}

LLVMFuzzerTestOneInput:
    7|  2.79k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    8|  2.79k|  if (size < 2) return 0;
  ------------------
  |  Branch (8:7): [True: 1, False: 2.78k]
  ------------------
    9|       |
   10|       |  // Use first byte to select which parsing function to exercise
   11|  2.78k|  uint8_t selector = data[0];
   12|  2.78k|  const char *payload = reinterpret_cast<const char *>(data + 1);
   13|  2.78k|  size_t payload_size = size - 1;
   14|  2.78k|  std::string input(payload, payload_size);
   15|       |
   16|  2.78k|  switch (selector % 13) {
  ------------------
  |  Branch (16:11): [True: 2.78k, False: 0]
  ------------------
   17|    602|  case 0: {
  ------------------
  |  Branch (17:3): [True: 602, False: 2.18k]
  ------------------
   18|       |    // parse_query_text
   19|    602|    httplib::Params params;
   20|    602|    httplib::detail::parse_query_text(payload, payload_size, params);
   21|    602|    break;
   22|      0|  }
   23|     50|  case 1: {
  ------------------
  |  Branch (23:3): [True: 50, False: 2.73k]
  ------------------
   24|       |    // decode_query_component
   25|     50|    httplib::decode_query_component(input, true);
   26|     50|    httplib::decode_query_component(input, false);
   27|     50|    break;
   28|      0|  }
   29|    227|  case 2: {
  ------------------
  |  Branch (29:3): [True: 227, False: 2.56k]
  ------------------
   30|       |    // decode_path_component
   31|    227|    httplib::decode_path_component(input);
   32|    227|    break;
   33|      0|  }
   34|    125|  case 3: {
  ------------------
  |  Branch (34:3): [True: 125, False: 2.66k]
  ------------------
   35|       |    // encode_query_component
   36|    125|    httplib::encode_query_component(input);
   37|    125|    break;
   38|      0|  }
   39|    198|  case 4: {
  ------------------
  |  Branch (39:3): [True: 198, False: 2.59k]
  ------------------
   40|       |    // normalize_query_string
   41|    198|    httplib::detail::normalize_query_string(input);
   42|    198|    break;
   43|      0|  }
   44|    123|  case 5: {
  ------------------
  |  Branch (44:3): [True: 123, False: 2.66k]
  ------------------
   45|       |    // is_valid_path
   46|    123|    httplib::detail::is_valid_path(input);
   47|    123|    break;
   48|      0|  }
   49|    437|  case 6: {
  ------------------
  |  Branch (49:3): [True: 437, False: 2.35k]
  ------------------
   50|       |    // parse_url
   51|    437|    httplib::detail::UrlComponents uc;
   52|    437|    httplib::detail::parse_url(input, uc);
   53|    437|    break;
   54|      0|  }
   55|     35|  case 7: {
  ------------------
  |  Branch (55:3): [True: 35, False: 2.75k]
  ------------------
   56|       |    // remove_dot_segments
   57|     35|    httplib::detail::remove_dot_segments(input);
   58|     35|    break;
   59|      0|  }
   60|    249|  case 8: {
  ------------------
  |  Branch (60:3): [True: 249, False: 2.54k]
  ------------------
   61|       |    // resolve_relative_location, with the input as "<location>\n<base>"
   62|    249|    auto nl = input.find('\n');
   63|    249|    auto location = input.substr(0, nl);
   64|    249|    auto base = nl == std::string::npos ? std::string("/index.html")
  ------------------
  |  Branch (64:17): [True: 189, False: 60]
  ------------------
   65|    249|                                        : input.substr(nl + 1);
   66|    249|    httplib::detail::resolve_relative_location(location, base);
   67|    249|    break;
   68|      0|  }
   69|     94|  case 9: {
  ------------------
  |  Branch (69:3): [True: 94, False: 2.69k]
  ------------------
   70|       |    // encode_path
   71|     94|    httplib::detail::encode_path(input);
   72|     94|    break;
   73|      0|  }
   74|    283|  case 10: {
  ------------------
  |  Branch (74:3): [True: 283, False: 2.50k]
  ------------------
   75|       |    // encode_uri_component, encode_uri
   76|    283|    httplib::encode_uri_component(input);
   77|    283|    httplib::encode_uri(input);
   78|    283|    break;
   79|      0|  }
   80|    236|  case 11: {
  ------------------
  |  Branch (80:3): [True: 236, False: 2.55k]
  ------------------
   81|       |    // decode_uri_component, decode_uri
   82|    236|    httplib::decode_uri_component(input);
   83|    236|    httplib::decode_uri(input);
   84|    236|    break;
   85|      0|  }
   86|    130|  case 12: {
  ------------------
  |  Branch (86:3): [True: 130, False: 2.65k]
  ------------------
   87|       |    // sanitize_filename
   88|    130|    httplib::sanitize_filename(input);
   89|    130|    break;
   90|      0|  }
   91|  2.78k|  }
   92|       |
   93|  2.78k|  return 0;
   94|  2.78k|}

