From: Radoslaw Zarzynski Date: Mon, 16 May 2016 16:24:55 +0000 (+0200) Subject: rgw: camelcase names of custom attributes in Swift's responses. X-Git-Tag: v10.2.3~123^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ff9c29a0e7a3719858ad94f632b6d1af3f3ec73e;p=ceph.git rgw: camelcase names of custom attributes in Swift's responses. Fixes: http://tracker.ceph.com/issues/15902 Signed-off-by: Radoslaw Zarzynski (cherry picked from commit cfde4c42c0248b52ef1b855f7de79ee1e229e73f) --- diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index bb288ca1ae6..b3568cf5794 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -14,6 +14,7 @@ extern std::map 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); diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index a9bf03e7ff0..b416a9763e9 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -102,8 +102,9 @@ static void dump_account_metadata(struct req_state * const s, STREAM_IO(s)->print("%s: %s\r\n", geniter->second.c_str(), iter->second.c_str()); } else if (strncmp(name, RGW_ATTR_META_PREFIX, PREFIX_LEN) == 0) { - STREAM_IO(s)->print("X-Account-Meta-%s: %s\r\n", name + PREFIX_LEN, - iter->second.c_str()); + STREAM_IO(s)->print("X-Account-Meta-%s: %s\r\n", + camelcase_dash_http_attr(name + PREFIX_LEN).c_str(), + iter->second.c_str()); } } } @@ -366,8 +367,9 @@ static void dump_container_metadata(struct req_state *s, RGWBucketEnt& bucket) STREAM_IO(s)->print("%s: %s\r\n", geniter->second.c_str(), iter->second.c_str()); } else if (strncmp(name, RGW_ATTR_META_PREFIX, PREFIX_LEN) == 0) { - STREAM_IO(s)->print("X-Container-Meta-%s: %s\r\n", name + PREFIX_LEN, - iter->second.c_str()); + STREAM_IO(s)->print("X-Container-Meta-%s: %s\r\n", + camelcase_dash_http_attr(name + PREFIX_LEN).c_str(), + iter->second.c_str()); } } } @@ -919,7 +921,8 @@ static void dump_object_metadata(struct req_state * const s, } else if (strncmp(name, RGW_ATTR_META_PREFIX, sizeof(RGW_ATTR_META_PREFIX)-1) == 0) { name += sizeof(RGW_ATTR_META_PREFIX) - 1; - STREAM_IO(s)->print("X-Object-Meta-%s: %s\r\n", name, + STREAM_IO(s)->print("X-Object-Meta-%s: %s\r\n", + camelcase_dash_http_attr(name).c_str(), kv.second.c_str()); } }