|
@@ -2497,6 +2497,52 @@ test_dir_handle_get_status_vote_current_authority(void* data)
|
|
|
dirvote_free_all();
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+test_dir_handle_get_parse_accept_encoding(void *arg)
|
|
|
+{
|
|
|
+ (void)arg;
|
|
|
+ const unsigned B_NONE = 1u << NO_METHOD;
|
|
|
+ const unsigned B_ZLIB = 1u << ZLIB_METHOD;
|
|
|
+ const unsigned B_GZIP = 1u << GZIP_METHOD;
|
|
|
+ const unsigned B_LZMA = 1u << LZMA_METHOD;
|
|
|
+ const unsigned B_ZSTD = 1u << ZSTD_METHOD;
|
|
|
+
|
|
|
+ unsigned encodings;
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header("");
|
|
|
+ tt_uint_op(B_NONE, OP_EQ, encodings);
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header(" ");
|
|
|
+ tt_uint_op(B_NONE, OP_EQ, encodings);
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header("dewey, cheatham, and howe ");
|
|
|
+ tt_uint_op(B_NONE, OP_EQ, encodings);
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header("dewey, cheatham, and gzip");
|
|
|
+ tt_uint_op(B_NONE, OP_EQ, encodings);
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header("dewey, cheatham, and, gzip");
|
|
|
+ tt_uint_op(B_NONE|B_GZIP, OP_EQ, encodings);
|
|
|
+
|
|
|
+ encodings = parse_accept_encoding_header(" gzip");
|
|
|
+ tt_uint_op(B_NONE|B_GZIP, OP_EQ, encodings);
|
|
|
+
|
|
|
+ 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");
|
|
|
+ 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");
|
|
|
+ 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");
|
|
|
+ tt_uint_op(B_NONE|B_ZLIB|B_ZSTD|B_LZMA|B_GZIP, OP_EQ, encodings);
|
|
|
+
|
|
|
+ done:
|
|
|
+ ;
|
|
|
+}
|
|
|
+
|
|
|
#define DIR_HANDLE_CMD(name,flags) \
|
|
|
{ #name, test_dir_handle_get_##name, (flags), NULL, NULL }
|
|
|
|
|
@@ -2555,6 +2601,7 @@ struct testcase_t dir_handle_get_tests[] = {
|
|
|
DIR_HANDLE_CMD(status_vote_next_consensus_signatures_not_found, 0),
|
|
|
DIR_HANDLE_CMD(status_vote_next_consensus_signatures_busy, 0),
|
|
|
DIR_HANDLE_CMD(status_vote_next_consensus_signatures, 0),
|
|
|
+ DIR_HANDLE_CMD(parse_accept_encoding, 0),
|
|
|
END_OF_TESTCASES
|
|
|
};
|
|
|
|