commit c486ef57a320b840fb50b184ee4ee806d9715888 Author: Nick Mathewson nickm@torproject.org Date: Mon May 1 15:31:28 2017 -0400
Rename x-lzma to x-tor-lzma
We shouldn't call it lzma, because we are imposing a limit on the memory needed for decoding. --- src/common/compress.c | 4 +++- src/test/test_buffers.c | 2 +- src/test/test_dir_handle_get.c | 7 ++++--- src/test/test_util.c | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/common/compress.c b/src/common/compress.c index 738df9f..047f904 100644 --- a/src/common/compress.c +++ b/src/common/compress.c @@ -313,7 +313,9 @@ static const struct { } compression_method_names[] = { { "gzip", GZIP_METHOD }, { "deflate", ZLIB_METHOD }, - { "x-lzma", LZMA_METHOD }, + // We call this "x-tor-lzma" rather than "x-lzma", because we impose a + // lower maximum memory usage on the decoding side. + { "x-tor-lzma", LZMA_METHOD }, { "x-zstd" , ZSTD_METHOD }, { "identity", NO_METHOD },
diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c index ce5ac97..c0e222b 100644 --- a/src/test/test_buffers.c +++ b/src/test/test_buffers.c @@ -854,7 +854,7 @@ struct testcase_t buffer_tests[] = { { "compress/zstd", test_buffers_compress, TT_FORK, &passthrough_setup, (char*)"x-zstd" }, { "compress/lzma", test_buffers_compress, TT_FORK, - &passthrough_setup, (char*)"x-lzma" }, + &passthrough_setup, (char*)"x-tor-lzma" },
END_OF_TESTCASES }; diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c index 7794bd7..6e96391 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -2530,13 +2530,14 @@ test_dir_handle_get_parse_accept_encoding(void *arg) encodings = parse_accept_encoding_header("gzip"); tt_uint_op(B_NONE|B_GZIP, OP_EQ, encodings);
- encodings = parse_accept_encoding_header("x-zstd, deflate, x-lzma"); + encodings = parse_accept_encoding_header("x-zstd, deflate, x-tor-lzma"); tt_uint_op(B_NONE|B_ZLIB|B_ZSTD|B_LZMA, OP_EQ, encodings);
- encodings = parse_accept_encoding_header("x-zstd, deflate, x-lzma, gzip"); + encodings = parse_accept_encoding_header( + "x-zstd, deflate, x-tor-lzma, gzip"); tt_uint_op(B_NONE|B_ZLIB|B_ZSTD|B_LZMA|B_GZIP, OP_EQ, encodings);
- encodings = parse_accept_encoding_header("x-zstd,deflate,x-lzma,gzip"); + encodings = parse_accept_encoding_header("x-zstd,deflate,x-tor-lzma,gzip"); tt_uint_op(B_NONE|B_ZLIB|B_ZSTD|B_LZMA|B_GZIP, OP_EQ, encodings);
done: diff --git a/src/test/test_util.c b/src/test/test_util.c index dec1d52..022f29c 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -5753,7 +5753,7 @@ struct testcase_t util_tests[] = { UTIL_LEGACY(pow2), COMPRESS(zlib, "deflate"), COMPRESS(gzip, "gzip"), - COMPRESS(lzma, "x-lzma"), + COMPRESS(lzma, "x-tor-lzma"), COMPRESS(zstd, "x-zstd"), UTIL_TEST(gzip_compression_bomb, TT_FORK), UTIL_LEGACY(datadir),