return str_has_cntrl(_s);
}
+// remove any aws-chunked entries from the comma-separated list
+static std::string content_encoding_without_aws_chunked(std::string_view value)
+{
+ std::string result;
+ result.reserve(value.size());
+
+ for (std::string_view part : ceph::split(value, ", ")) {
+ if (part == "aws-chunked") {
+ continue;
+ }
+ if (!result.empty()) {
+ result += ", ";
+ }
+ result += part;
+ }
+
+ return result;
+}
+
int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
off_t bl_len)
{
--len;
s.resize(len);
}
- response_attrs[aiter->second] = s;
+
+ if (aiter->first == RGW_ATTR_CONTENT_ENC) {
+ // Amazon S3 stores the resulting object without the aws-chunked
+ // value in the content-encoding header. If aws-chunked is the only
+ // value that you pass in the content-encoding header, S3 considers
+ // the content-encoding header empty and does not return this header
+ // when your retrieve the object.
+ std::string encoding = content_encoding_without_aws_chunked(s);
+ if (!encoding.empty()) {
+ response_attrs[aiter->second] = std::move(encoding);
+ }
+ } else {
+ response_attrs[aiter->second] = std::move(s);
+ }
}
} else if (iter->first.compare(RGW_ATTR_CONTENT_TYPE) == 0) {
/* Special handling for content_type. */