diff options
-rw-r--r-- | src/rgw/rgw_common.cc | 53 | ||||
-rw-r--r-- | src/rgw/rgw_common.h | 3 | ||||
-rw-r--r-- | src/rgw/rgw_rest.cc | 53 | ||||
-rw-r--r-- | src/rgw/rgw_rest.h | 3 |
4 files changed, 56 insertions, 56 deletions
diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 56a354a3faa..a743e7c02e7 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -1895,3 +1895,56 @@ bool match_policy(boost::string_view pattern, boost::string_view input, last_pos_input = cur_pos_input + 1; } } + +/* + * make attrs look-like-this + * converts underscores to dashes + */ +string lowercase_dash_http_attr(const string& orig) +{ + const char *s = orig.c_str(); + char buf[orig.size() + 1]; + buf[orig.size()] = '\0'; + + for (size_t i = 0; i < orig.size(); ++i, ++s) { + switch (*s) { + case '_': + buf[i] = '-'; + break; + default: + buf[i] = tolower(*s); + } + } + return string(buf); +} + +/* + * make attrs Look-Like-This + * converts underscores to dashes + */ +string camelcase_dash_http_attr(const string& orig) +{ + const char *s = orig.c_str(); + char buf[orig.size() + 1]; + buf[orig.size()] = '\0'; + + bool last_sep = true; + + for (size_t i = 0; i < orig.size(); ++i, ++s) { + switch (*s) { + case '_': + case '-': + buf[i] = '-'; + last_sep = true; + break; + default: + if (last_sep) { + buf[i] = toupper(*s); + } else { + buf[i] = tolower(*s); + } + last_sep = false; + } + } + return string(buf); +} diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 902ca230839..624d9b2b5c4 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -2371,4 +2371,7 @@ static constexpr uint32_t MATCH_POLICY_STRING = 0x08; extern bool match_policy(boost::string_view pattern, boost::string_view input, uint32_t flag); +extern string camelcase_dash_http_attr(const string& orig); +extern string lowercase_dash_http_attr(const string& orig); + #endif diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 6a030e87295..681f6e9e896 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -165,59 +165,6 @@ string uppercase_underscore_http_attr(const string& orig) return string(buf); } -/* - * make attrs look-like-this - * converts underscores to dashes - */ -string lowercase_dash_http_attr(const string& orig) -{ - const char *s = orig.c_str(); - char buf[orig.size() + 1]; - buf[orig.size()] = '\0'; - - for (size_t i = 0; i < orig.size(); ++i, ++s) { - switch (*s) { - case '_': - buf[i] = '-'; - break; - default: - buf[i] = tolower(*s); - } - } - return string(buf); -} - -/* - * make attrs Look-Like-This - * converts underscores to dashes - */ -string camelcase_dash_http_attr(const string& orig) -{ - const char *s = orig.c_str(); - char buf[orig.size() + 1]; - buf[orig.size()] = '\0'; - - bool last_sep = true; - - for (size_t i = 0; i < orig.size(); ++i, ++s) { - switch (*s) { - case '_': - case '-': - buf[i] = '-'; - last_sep = true; - break; - default: - if (last_sep) { - buf[i] = toupper(*s); - } else { - buf[i] = tolower(*s); - } - last_sep = false; - } - } - return string(buf); -} - /* avoid duplicate hostnames in hostnames lists */ static set<string> hostnames_set; static set<string> hostnames_s3website_set; diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 515057dfcd6..495827791a2 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -17,9 +17,6 @@ extern std::map<std::string, std::string> rgw_to_http_attrs; -extern string camelcase_dash_http_attr(const string& orig); -extern string lowercase_dash_http_attr(const string& orig); - extern void rgw_rest_init(CephContext *cct, RGWRados *store, RGWZoneGroup& zone_group); extern void rgw_flush_formatter_and_reset(struct req_state *s, |