HDDS-15606. Support S3 object metadata headers (Cache-Control, Expires, Content-Encoding)#10786
HDDS-15606. Support S3 object metadata headers (Cache-Control, Expires, Content-Encoding)#10786Gargi-jais11 wants to merge 2 commits into
Conversation
|
|
||
| protected static final String ETAG_CUSTOM = "etag-custom"; | ||
| protected static final String CONTENT_TYPE_CUSTOM = "content-type-custom"; | ||
| protected static final String CACHE_CONTROL_CUSTOM = "cache-control-custom"; |
There was a problem hiding this comment.
The PR internally renames:
x-amz-meta-cache-control
to:
cache-control-custom
But a user can also provide:
x-amz-meta-cache-control-custom
Both values then use the same internal key, so one value can overwrite the other.
The internal storage key should use a reserved namespace that users cannot create.
| } | ||
|
|
||
| /** | ||
| * Returns the persisted S3 {@code Content-Encoding} value, with {@code aws-chunked} |
There was a problem hiding this comment.
Handle aws-chunked without case sensitivity
Currently, only this exact value is removed:
aws-chunked
These would not be removed:
AWS-CHUNKED
Aws-Chunked
HTTP encoding names are case-insensitive, so the code should use:
equalsIgnoreCase()
|
|
||
| @Test | ||
| public void inheritRequestHeader() throws IOException, OS3Exception { | ||
| public void storedObjectHeadersOnGetAndHead() throws IOException, OS3Exception { |
There was a problem hiding this comment.
Add tests for copy and multipart upload
The code changes normal upload, multipart upload, and object-copy behaviour.
However, the integration tests mainly verify normal PutObject.
Tests should also confirm that headers work correctly when:
- uploading through multipart upload;
- copying metadata with
COPY; - replacing metadata with
REPLACE.
Overall, the main feature is implemented correctly, but these edge cases could cause incorrect headers or lost metadata.
What changes were proposed in this pull request?
Ozone does not persist standard S3 object headers on PUT or return them on HEAD/GET. s3-tests fail for:
Implement persist-on-PUT and return-on-HEAD/GET for these headers, strip aws-chunked from Content-Encoding per AWS semantics, and ensure object headers override HDDS NoCacheFilter defaults on S3 object responses.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15606
How was this patch tested?
Added IT and UT.
Before Fix:
After Fix: