From e6a61b8da788efbbbb0eb690c49434b6b5fc9741 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 8 Dec 2016 15:31:27 +0100 Subject: Fix S3BinaryCacheStore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It failed with AWS error uploading ‘6gaxphsyhg66mz0a00qghf9nqf7majs2.ls.xz’: Unable to parse ExceptionName: MissingContentLength Message: You must provide the Content-Length HTTP header. possibly because the istringstream_nocopy introduced in 0d2ebb4373e509521f27a6e8f16bfd39d05b2188 doesn't supply the seek method that the AWS library expects. So bring back the old version, but only for S3BinaryCacheStore. --- src/libstore/derivations.cc | 2 +- src/libstore/s3-binary-cache-store.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libstore') diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 5562d46892a8..d934bda38225 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -155,7 +155,7 @@ static StringSet parseStrings(std::istream & str, bool arePaths) static Derivation parseDerivation(const string & s) { Derivation drv; - istringstream_nocopy str(s); + std::istringstream str(s); expect(str, "Derive(["); /* Parse the list of outputs. */ diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 1bc8576a8aef..3c5101f0009a 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -18,6 +18,15 @@ namespace nix { +struct istringstream_nocopy : public std::stringstream +{ + istringstream_nocopy(const std::string & s) + { + rdbuf()->pubsetbuf( + (char *) s.data(), s.size()); + } +}; + struct S3Error : public Error { Aws::S3::S3Errors err; -- cgit 1.4.1