#include "rgw_rest.h"
#include "rgw_crypt_sanitize.h"
+#include <boost/container/small_vector.hpp>
#include <boost/utility/string_view.hpp>
#define dout_context g_ceph_context
return true;
}
-std::vector<boost::string_view> get_str_vec(const boost::string_view& str,
- const char* const delims)
+template<std::size_t ExpectedStrNum>
+boost::container::small_vector<boost::string_view, ExpectedStrNum>
+get_str_vec(const boost::string_view& str, const char* const delims)
{
- std::vector<boost::string_view> str_vec;
+ boost::container::small_vector<boost::string_view, ExpectedStrNum> str_vec;
size_t pos = 0;
boost::string_view token;
return str_vec;
}
-std::vector<boost::string_view> get_str_vec(const boost::string_view& str)
+template<std::size_t ExpectedStrNum>
+boost::container::small_vector<boost::string_view, ExpectedStrNum>
+get_str_vec(const boost::string_view& str)
{
const char delims[] = ";,= \t";
- return get_str_vec(str, delims);
+ return get_str_vec<ExpectedStrNum>(str, delims);
}
};
}
std::map<boost::string_view, boost::string_view> kv;
- for (const auto& s : get_str_vec(input, ",")) {
+ for (const auto& s : get_str_vec<4>(input, ",")) {
const auto parsed_pair = parse_key_value(s);
if (parsed_pair) {
kv[parsed_pair->first] = parsed_pair->second;
/* Handle case when query string exists. Step 3 described in: http://docs.
* aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html */
std::map<std::string, std::string> canonical_qs_map;
- for (const auto& s : get_str_vec(info.request_params, "&")) {
+ for (const auto& s : get_str_vec<5>(info.request_params, "&")) {
boost::string_view key, val;
const auto parsed_pair = parse_key_value(s);
if (parsed_pair) {
const bool force_boto2_compat)
{
std::map<boost::string_view, std::string> canonical_hdrs_map;
- for (const auto& token : get_str_vec(signedheaders, ";")) {
+ for (const auto& token : get_str_vec<5>(signedheaders, ";")) {
/* TODO(rzarzynski): we'd like to switch to sstring here but it should
* get push_back() and reserve() first. */
std::string token_env = "HTTP_";