You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently AWS SDK needs to calculate some sort of signature before sending bytes over wire (in PutObject/etc) -- related stream gets read and then rewound to start and read again. Is there any way to avoid this double "read file from disk" besides using streambuf that keeps entire file in memory?
The default ctor args for s3 turn the payload hashing off of you are using tls. Also, setting the content length field will prevent the seek operations to figure it out. By controlling both of these settings, the file will only be read once.
On Oct 30, 2017, at 9:27 AM, crusader-mike ***@***.***> wrote:
Apparently AWS SDK needs to calculate some sort of signature before sending bytes over wire (in PutObject/etc) -- related stream gets read and then rewound to start and read again. Is there any way to avoid this double "read file from disk" besides using streambuf that keeps entire file in memory?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Huh... I am using https and reading file (in my own implementation of streambuf) only in underflow() -- according to your criteria SDK shouldn't scan my file twice. I'll double check tonight
After examining my (relatively recent) SDK sources I came to a conclusion that it is impossible to switch off "payload signing" without overriding request class methods -- all requests get payload signed if <request-class>::SignBody() returns true. Similar flag passed by S3Client into aws signer class gets used only with payload-less requests -- i.e. not used at all. The only way to avoid payload being signed is to derive from requess-class, override SignBody() and return false.
I dug in this a bit more and found that Amazon S3 (as of now) allows unsigned payloads, but you can configure your bucket to deny such requests. Is it a prelude to total ban on unsigned payloads service wide?
In any case -- it would be very nice to have a switch in S3Client (or library-wide?) that would forcefully disable/enable payload signing (regardless of HTTP/HTTPS flag). Please :)
Until then I believe I have only these options:
live with 'double read'
load entire file into memory -- not end of the world, since I use multipart upload for large files anyway
override SignBody() of each request I use and hope users don't use HTTP urls in my program
Sounds like option number 2 is the least of all evil right now.
A note about option N2 -- multipart upload is limited to 10'000 chunks. Which means for files bigger than 50GB chunk size will start growing and at some point they won't fit into memory (especially if you upload them in parallel). I.e. you'll have to limit memory buffer and you'll end up reading entire file twice.
Activity
JonathanHenson commentedon Oct 30, 2017
crusader-mike commentedon Oct 30, 2017
Huh... I am using https and reading file (in my own implementation of streambuf) only in
underflow()-- according to your criteria SDK shouldn't scan my file twice. I'll double check tonightcrusader-mike commentedon Oct 31, 2017
After examining my (relatively recent) SDK sources I came to a conclusion that it is impossible to switch off "payload signing" without overriding request class methods -- all requests get payload signed if
<request-class>::SignBody()returns true. Similar flag passed by S3Client into aws signer class gets used only with payload-less requests -- i.e. not used at all. The only way to avoid payload being signed is to derive from requess-class, overrideSignBody()and return false.I dug in this a bit more and found that Amazon S3 (as of now) allows unsigned payloads, but you can configure your bucket to deny such requests. Is it a prelude to total ban on unsigned payloads service wide?
In any case -- it would be very nice to have a switch in S3Client (or library-wide?) that would forcefully disable/enable payload signing (regardless of HTTP/HTTPS flag). Please :)
Until then I believe I have only these options:
Sounds like option number 2 is the least of all evil right now.
marcomagdy commentedon Oct 31, 2017
This is a bug. We need to fix it.
crusader-mike commentedon Nov 1, 2017
Thank you. Would be nice to be able to skip payload signature in HTTP case too...
crusader-mike commentedon Nov 2, 2017
A note about option N2 -- multipart upload is limited to 10'000 chunks. Which means for files bigger than 50GB chunk size will start growing and at some point they won't fit into memory (especially if you upload them in parallel). I.e. you'll have to limit memory buffer and you'll end up reading entire file twice.
wps132230 commentedon Nov 9, 2017
Hi, you can avoid reading file twice by skipping payload signature with the latest update(ver 1.3.1) now:
in which
AWSAuthV4Signer::PayloadSigningPolicy::Neverwill overruleSignBody(), even though it'strue, then the payload will never be signed.Please consult this commit for more details: b9ccf4d
I am closing this issue, if you encounter any further problem, please reopen it.
crusader-mike commentedon Nov 10, 2017
Thanks, Pushen!

Bump junit from 4.12 to 4.13.1 in /code-generation/generator (#711)
crusader-mike commentedon Jun 17, 2021
@singku @wps132230 I've discovered that with HTTP endpoint my source files/objects are still being read twice.
Culprit is check for
request.GetUri().GetScheme() != Http::Scheme::HTTPScheck at this line.Can someone explain why SDK insists on calculating payload hash on non-HTTPS endpoints even if I explicitly asked it not to "sign body"?
Is there an easy way to switch it off without substituting request signer object?