Skip to content

Instantly share code, notes, and snippets.

@cbodley
Created March 3, 2017 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbodley/9144f89eb25e869dd21aea51ceb13d0b to your computer and use it in GitHub Desktop.
Save cbodley/9144f89eb25e869dd21aea51ceb13d0b to your computer and use it in GitHub Desktop.
struct crypt_sanitize_header {
boost::string_ref name;
boost::string_ref value;
crypt_sanitize_header(boost::string_ref name, boost::string_ref value)
: name(name), value(value) {}
};
std::ostream& operator<<(std::ostream& out, const crypt_sanitize_header& h) {
out << h.name << '=';
if (conf->rgw_crypt_suppress_logs &&
boost::algorithm::iequals(h.name, HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY)) {
out << "=key suppressed=";
} else {
out << h.value;
}
return out;
}
// example use:
dout(0) << crypt_sanitize_header{name, value} << dendl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment