summaryrefslogtreecommitdiffstats
path: root/netwerk/streamconv/converters/nsHTTPCompressConv.h
diff options
context:
space:
mode:
Diffstat (limited to 'netwerk/streamconv/converters/nsHTTPCompressConv.h')
-rw-r--r--netwerk/streamconv/converters/nsHTTPCompressConv.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/netwerk/streamconv/converters/nsHTTPCompressConv.h b/netwerk/streamconv/converters/nsHTTPCompressConv.h
index 4ba2d9819c..1008edcf27 100644
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.h
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.h
@@ -34,11 +34,14 @@ class nsIStringInputStream;
# define HTTP_BROTLI_TYPE "br"
# define HTTP_IDENTITY_TYPE "identity"
# define HTTP_UNCOMPRESSED_TYPE "uncompressed"
+# define HTTP_ZSTD_TYPE "zstd"
+# define HTTP_ZST_TYPE "zst"
namespace mozilla {
namespace net {
class BrotliWrapper;
+class ZstdWrapper;
class nsHTTPCompressConv : public nsIStreamConverter,
public nsICompressConvStats {
@@ -60,7 +63,8 @@ class nsHTTPCompressConv : public nsIStreamConverter,
HTTP_COMPRESS_DEFLATE,
HTTP_COMPRESS_COMPRESS,
HTTP_COMPRESS_BROTLI,
- HTTP_COMPRESS_IDENTITY
+ HTTP_COMPRESS_IDENTITY,
+ HTTP_COMPRESS_ZSTD,
};
private:
@@ -77,6 +81,7 @@ class nsHTTPCompressConv : public nsIStreamConverter,
uint32_t mInpBufferLen{0};
UniquePtr<BrotliWrapper> mBrotli;
+ UniquePtr<ZstdWrapper> mZstd;
nsCOMPtr<nsIStringInputStream> mStream;
@@ -84,6 +89,10 @@ class nsHTTPCompressConv : public nsIStreamConverter,
const char* dataIn, uint32_t, uint32_t avail,
uint32_t* countRead);
+ static nsresult ZstdHandler(nsIInputStream* stream, void* closure,
+ const char* dataIn, uint32_t, uint32_t avail,
+ uint32_t* countRead);
+
nsresult do_OnDataAvailable(nsIRequest* request, uint64_t aSourceOffset,
const char* buffer, uint32_t aCount);
@@ -92,6 +101,7 @@ class nsHTTPCompressConv : public nsIStreamConverter,
bool mStreamInitialized{false};
bool mDummyStreamInitialised{false};
bool mFailUncleanStops;
+ bool mDispatchToMainThread{false};
z_stream d_stream{};
unsigned mLen{0}, hMode{0}, mSkipCount{0}, mFlags{0};