You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
560 B
C++

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#include "UriQueryParser.hxx"
#include "IterableSplitString.hxx"
using std::string_view_literals::operator""sv;
std::string_view
UriFindRawQueryParameter(std::string_view query_string, std::string_view name) noexcept
{
for (const std::string_view i : IterableSplitString(query_string, '&')) {
if (i.starts_with(name)) {
if (i.size() == name.size())
return ""sv;
if (i[name.size()] == '=')
return i.substr(name.size() + 1);
}
}
return {};
}