mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
Merge pull request #18046 from mdw-at-linuxbox/master-awsv4-sort
radosgw: fix awsv4 header line sort order.
This commit is contained in:
commit
8c344366da
@ -3,6 +3,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -15,6 +16,7 @@
|
||||
#include "rgw_rest.h"
|
||||
#include "rgw_crypt_sanitize.h"
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
@ -567,7 +569,7 @@ get_v4_canonical_headers(const req_info& info,
|
||||
const bool using_qs,
|
||||
const bool force_boto2_compat)
|
||||
{
|
||||
std::map<boost::string_view, std::string> canonical_hdrs_map;
|
||||
std::set<std::string> canonical_hdrs_set;
|
||||
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. */
|
||||
@ -614,17 +616,14 @@ get_v4_canonical_headers(const req_info& info,
|
||||
}
|
||||
}
|
||||
|
||||
canonical_hdrs_map[token] = rgw_trim_whitespace(token_value);
|
||||
canonical_hdrs_set.insert(
|
||||
boost::algorithm::join(std::vector<std::string>(
|
||||
{std::string(token), rgw_trim_whitespace(token_value)} ), ":"));
|
||||
}
|
||||
|
||||
std::string canonical_hdrs;
|
||||
for (const auto& header : canonical_hdrs_map) {
|
||||
const boost::string_view& name = header.first;
|
||||
const std::string& value = header.second;
|
||||
|
||||
canonical_hdrs.append(name.data(), name.length())
|
||||
.append(":", std::strlen(":"))
|
||||
.append(value)
|
||||
for (const auto& header : canonical_hdrs_set) {
|
||||
canonical_hdrs.append(header.data(), header.length())
|
||||
.append("\n", std::strlen("\n"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user