Changes to AWS construct to support streaming #1496
Draft
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.
TLDR: the design you originally proposed mostly works. the only thing that I needed to fix was to carry along a function to convert from bytes to the StreamingInput or StreamingOutput types. This PR only contains a few changes I'd make to improve things when we want to support streaming payload signature, trailers, etc.
I've opened this PR because theses are changes I made to make s3-restart-wip work.
It does the following:
Regarding 2), I did that because if we introduce middleware like CRC/SHA checksum, they'll include additional headers that need to be in the signature.
Regarding 3), I did that because generating a sha256 hash and including it in the signature works but is only one way, of several ways, to do payload signature. It does not work well when the payload is large (load everything in memory, it does not support sending the payload in chunks), and it does not work for sigv4a.
For example, signing the payload on a request where the payload is uploaded in chunks is described in the docs. One of the input of the first chunk is the signature computed for the Authorization header, so we'd probably have to rework how we do ( in AWSSigning) to expose it.
In the list of changes in s3-restart-wip, you'll see that I also include the java-sdk. This is for testing and inspecting what the java SDK does when we enable certain things. But I'M UNABLE TO ENABLE THE SIGNATURE OF THE PAYLOAD. The only thing that comes close is setting the CRC32 checksum algorithm which will affect the request (change the body to include trailers, and so it changes the
X-Amz-Content-SHA256
header toSTREAMING-UNSIGNED-PAYLOAD-TRAILER
, add a bunch of headers).Example:
To view this request, I've also used mitm and target my AWS java sdk client to it. It makes it easy to see what the SDK does when playing with settings.
PR Checklist (not all items are relevant to all PRs)