30 if (match_header ==
"*")
36 std::regex etag_rx(R
"(\"([0-9a-f]+)\",?\s*)");
38 std::sregex_iterator(match_header.begin(), match_header.end(), etag_rx);
39 auto etags_end = std::sregex_iterator();
40 ssize_t last_matched = 0;
42 for (std::sregex_iterator i = etags_begin; i != etags_end; ++i)
44 if (i->position() != last_matched)
46 throw std::runtime_error(
"Invalid If-Match header");
48 const std::smatch& match = *i;
49 if_etags.insert(match[1].str());
50 last_matched = match.position() + match.length();
53 ssize_t last_index_in_header = match_header.size();
55 if (last_matched != last_index_in_header || if_etags.empty())
57 throw std::runtime_error(
"Invalid If-Match header");