implement S3 v3 pre-signed handler #8918
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Move the s3 pre-signed handler earlier in the handler chain, so that we can modify the request in the
RequestContext
before actually parsing it: this allows us to fully use the ASF parser.When pre-signing a request, the S3 client will move some of the request parameters into the query string, when those parameters would be in the headers. Now, the pre-signed handler will add back some headers that we know should be in there, and the parser will properly pick it up.
Changes
Create a general pre-signed handler in the handler chain, which will be able to manage more kind of pre-signed URL than S3. Only S3 is implemented now. Some logic had to be changed in the handler, because we were using the previously parsed
Bucket
from the request. We now need to parse it ourselves following the same logic as the RequestParser (especially a weird case where we had the sanitized path, and we needed the raw one).