# HG changeset patch # User Alain Mazy # Date 1777309307 -7200 # Node ID 1205e4bda548c714db387aec6766b4860f17a863 # Parent 5e2e2c8d7969f2b387112e34b4204438263a4e3b S3: rewrote the read() function diff -r 5e2e2c8d7969 -r 1205e4bda548 Aws/AwsS3StoragePlugin.cpp --- a/Aws/AwsS3StoragePlugin.cpp Tue Apr 14 11:02:01 2026 +0200 +++ b/Aws/AwsS3StoragePlugin.cpp Mon Apr 27 19:01:47 2026 +0200 @@ -284,28 +284,17 @@ std::string range = std::string("bytes=") + boost::lexical_cast(fromOffset) + "-" + boost::lexical_cast(fromOffset + size -1); getObjectRequest.SetRange(range.c_str()); } - - getObjectRequest.SetResponseStreamFactory( - [data, size]() - { - std::unique_ptr - istream(Aws::New(ALLOCATION_TAG)); - - istream->rdbuf()->pubsetbuf(static_cast(data), - size); - - return istream.release(); - }); - // Get the object auto result = client_->GetObject(getObjectRequest); - if (result.IsSuccess()) - { - } - else + if (!result.IsSuccess()) { throw StoragePluginException(std::string("error while reading file ") + path + ": response code = " + boost::lexical_cast((int)result.GetError().GetResponseCode()) + " " + result.GetError().GetExceptionName().c_str() + " " + result.GetError().GetMessage().c_str()); } + + auto& body = result.GetResult().GetBody(); + body.read(data, size); + // it seems important to consume the HTTP stream so the connection can go back in the pool (but, it is actually already consumed !) + body.ignore(std::numeric_limits::max()); } }; diff -r 5e2e2c8d7969 -r 1205e4bda548 NEWS --- a/NEWS Tue Apr 14 11:02:01 2026 +0200 +++ b/NEWS Mon Apr 27 19:01:47 2026 +0200 @@ -1,3 +1,10 @@ +Pending changes in the mainline +=============================== + +* AWS plugin: + * Internals: rewrote the read() function to make sure to consume the HTTP stream completely + so it can go back to the pool (although it seems to do so already) + 2026-04-13 - v 2.5.2 ====================