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);
+}
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
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;
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,