-
Notifications
You must be signed in to change notification settings - Fork 1.1k
S3 GetObject returns empty result body #912
Description
The C++ SDK is returning an empty result body for an object that the outcome result IsSucess and has GetContentLenght different than zero.
I followed most of AWS documentation and example codes - including the one officially available at Developer Guide. I also looked around for reported bugs and found this for the AWS JS SDK. Basically, there was something listening and intercepting the 'data' before the SDK could store it in the buffer.
I'm on Ubuntu 16.04, tried everything imaginable (firewall, netstat, killing applications), but still got an empty result body. I was not able to fix it - thus I'm submitting this issue - but I found a workaround. My workaround for this 'bug' uses the SetResponseStreamFactory to write a file as soon as the object is downloaded from the bucket.
objectRequest.SetResponseStreamFactory([filePath]()
{
return new std::fstream(filePath.c_str(), std::ios::out | std::ios::binary);
});