summaryrefslogtreecommitdiff
path: root/src/common/compress.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-27 11:31:31 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-27 11:31:31 -0400
commit10a4f9cd0745cbcb1a9018304dad2dd5edbee1f2 (patch)
tree63978172d0eebf9795c526978c094abac3de28a0 /src/common/compress.c
parent49deb1e1b810e348bfa9fb27a0f0ef54f3694cc9 (diff)
parent2903c329aaad1b7628c1def4168270d626755566 (diff)
downloadtor-10a4f9cd0745cbcb1a9018304dad2dd5edbee1f2.tar.gz
tor-10a4f9cd0745cbcb1a9018304dad2dd5edbee1f2.zip
Merge branch 'parse_accept_encoding'
Diffstat (limited to 'src/common/compress.c')
-rw-r--r--src/common/compress.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common/compress.c b/src/common/compress.c
index 9a24025db0..8502dee25c 100644
--- a/src/common/compress.c
+++ b/src/common/compress.c
@@ -285,6 +285,26 @@ tor_compress_supports_method(compress_method_t method)
}
}
+/**
+ * Return a bitmask of the supported compression types, where 1&lt;&lt;m is
+ * set in the bitmask if and only if compression with method <b>m</b> is
+ * supported.
+ */
+unsigned
+tor_compress_get_supported_method_bitmask(void)
+{
+ static unsigned supported = 0;
+ if (supported == 0) {
+ compress_method_t m;
+ for (m = NO_METHOD; m <= UNKNOWN_METHOD; ++m) {
+ if (tor_compress_supports_method(m)) {
+ supported |= (1u << m);
+ }
+ }
+ }
+ return supported;
+}
+
/** Table of compression method names. These should have an "x-" prefix,
* if they are not listed in the IANA content coding registry. */
static const struct {