HDDS-16189. Return application/xml for S3 error responses - #11031
HDDS-16189. Return application/xml for S3 error responses#11031F64116045 wants to merge 3 commits into
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the fix! @F64116045 The change itself is correct. However, I tested the curl command from the Jira description, and it still returns text/plain. It looks like it takes a different error path. Please see inline comments.
| } | ||
| exception.setRequestId(requestIdentifier.getRequestId()); | ||
| return Response.status(exception.getHttpCode()) | ||
| .type(MediaType.APPLICATION_XML_TYPE) |
There was a problem hiding this comment.
I think the change is correct, but I noticed that the exact reproduction of HDDS-16189 follows the authentication-error path, which bypasses OS3ExceptionMapper. Should we also set MediaType.APPLICATION_XML_TYPE in S3Utils.wrapOS3Exception() and add a test for that?
There was a problem hiding this comment.
Oops, I missed that the curl request stops at AuthorizationFilter and never reaches OS3ExceptionMapper.
Thanks a lot for catching this!
There was a problem hiding this comment.
Thanks, updated S3Utils.wrapOS3Exception() and added a test.
| import org.mockito.junit.jupiter.MockitoExtension; | ||
|
|
||
| /** | ||
| * This class tests OS3Exception class. |
There was a problem hiding this comment.
nit: This class now also tests OS3ExceptionMapper. Could we update the class Javadoc accordingly?
|
@chihsuan Thanks a lot for the review and for catching the authentication-error path I missed. I've addressed the suggestions. |
Gargi-jais11
left a comment
There was a problem hiding this comment.
Thanks @F64116045 for the patch. Overall LGTM!
Let's add integration test as well in AbstractS3SDKV1Tests and AbstractS3SDKV2Tests for end to end testing.
|
Thanks @Gargi-jais11 for the review and suggestion, added the checks to both SDK v1 and v2 tests. |
What changes were proposed in this pull request?
The
makeBucket()test in MinIO's Mint test suite, included in the Ozone S3 compatibility report, exposed that S3 Gateway returns XML error bodies withContent-Type: text/plain.OS3ExceptionMapperconvertsOS3Exceptionresponses to XML but does not specify the response media type. Jersey therefore usestext/plain, causing clients such as the MinIO SDK to reject the response instead of parsing the S3 error.This patch sets the response media type to
application/xmland adds a unit test to verify it.S3 REST error response reference: https://docs.aws.amazon.com/AmazonS3/latest/developerguide/ErrorResponses.html
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16189
How was this patch tested?
CI: https://github.com/F64116045/ozone/actions/runs/31982282510