about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2016-12-08T14·31+0100
committerEelco Dolstra <edolstra@gmail.com>2016-12-08T14·31+0100
commite6a61b8da788efbbbb0eb690c49434b6b5fc9741 (patch)
tree919b3ac10266afe6684e89154fe7c61266773f6e /src/libutil/util.hh
parent8df1a3b579719e118e6d93fff3e796df30f6185e (diff)
Fix S3BinaryCacheStore
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.
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 1ede48a65ff2..50b96f7ed92c 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -431,55 +431,4 @@ void callSuccess(
 }
 
 
-/* A variant of std::istringstream that doesn't copy its string
-   argument. This is useful for large strings. The caller must ensure
-   that the string object is not destroyed while it's referenced by
-   this object. */
-class istringbuf_nocopy : public std::streambuf
-{
-    const std::string & s;
-    decltype(s.size()) off;
-    decltype(s.size()) size;
-public:
-    istringbuf_nocopy(const std::string & s) : s{s}, off{0}, size{s.size()}
-    {
-    }
-
-private:
-    int_type underflow()
-    {
-      if (off == size)
-          return traits_type::eof();
-      return traits_type::to_int_type(s[off]);
-    }
-
-    int_type uflow()
-    {
-        if (off == size)
-            return traits_type::eof();
-        return traits_type::to_int_type(s[off++]);
-    }
-
-    int_type pbackfail(int_type ch)
-    {
-        if (off == 0 || (ch != traits_type::eof() && ch != s[off - 1]))
-            return traits_type::eof();
-
-        return traits_type::to_int_type(s[--off]);
-    }
-
-    std::streamsize showmanyc()
-    {
-        return size - off;
-    }
-};
-
-
-struct istringstream_nocopy : public std::iostream
-{
-    istringbuf_nocopy buf;
-    istringstream_nocopy(const std::string & s) : std::iostream(&buf), buf(s) {};
-};
-
-
 }