Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "radosgw: fix awsv4 header line sort order." #18381

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/rgw/rgw_auth_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <algorithm>
#include <map>
#include <set>
#include <iterator>
#include <string>
#include <vector>
Expand All @@ -16,7 +15,6 @@
#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>

Expand Down Expand Up @@ -569,7 +567,7 @@ get_v4_canonical_headers(const req_info& info,
const bool using_qs,
const bool force_boto2_compat)
{
std::set<std::string> canonical_hdrs_set;
std::map<boost::string_view, std::string> canonical_hdrs_map;
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. */
Expand Down Expand Up @@ -616,14 +614,17 @@ get_v4_canonical_headers(const req_info& info,
}
}

canonical_hdrs_set.insert(
boost::algorithm::join(std::vector<std::string>(
{std::string(token), rgw_trim_whitespace(token_value)} ), ":"));
canonical_hdrs_map[token] = rgw_trim_whitespace(token_value);
}

std::string canonical_hdrs;
for (const auto& header : canonical_hdrs_set) {
canonical_hdrs.append(header.data(), header.length())
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)
.append("\n", std::strlen("\n"));
}

Expand Down