Implement zstd decompression

Given the size of Redfish schemas these days, it would be nice to be
able to store them on disk in a zstd format.  Unfortunately, not all
clients support zstd at this time.

This commit implements reading of zstd files from disk, as well as
decompressing zstd in the case where the client does not support zstd as
a return type.

Tested:
Implanted an artificial zstd file into the system, and observed correct
decompression both with an allow-encoding header of empty string and
zstd.

Change-Id: I8b631bb943de99002fdd6745340aec010ee591ff
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/webassets.hpp b/include/webassets.hpp
index 91239dc..aa57230 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -5,6 +5,7 @@
 #include "app.hpp"
 #include "async_resp.hpp"
 #include "forward_unauthorized.hpp"
+#include "http_body.hpp"
 #include "http_request.hpp"
 #include "http_response.hpp"
 #include "logging.hpp"
@@ -68,6 +69,7 @@
     std::string_view contentType;
     std::string_view contentEncoding;
     std::string etag;
+    bmcweb::CompressionType onDiskComp = bmcweb::CompressionType::Raw;
     bool renamed = false;
 };
 
@@ -109,7 +111,8 @@
         }
     }
 
-    if (asyncResp->res.openFile(file.absolutePath) != crow::OpenCode::Success)
+    if (asyncResp->res.openFile(file.absolutePath, bmcweb::EncodingType::Raw,
+                                file.onDiskComp) != crow::OpenCode::Success)
     {
         BMCWEB_LOG_DEBUG("failed to read file");
         asyncResp->res.result(
@@ -174,6 +177,7 @@
         // Use the non-gzip version for determining content type
         extension = webpath.extension().string();
         file.contentEncoding = "gzip";
+        file.onDiskComp = bmcweb::CompressionType::Gzip;
     }
     else if (extension == ".zstd")
     {
@@ -181,6 +185,7 @@
         // Use the non-zstd version for determining content type
         extension = webpath.extension().string();
         file.contentEncoding = "zstd";
+        file.onDiskComp = bmcweb::CompressionType::Zstd;
     }
 
     file.etag = getStaticEtag(webpath);