1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 00:34:04 +00:00

test: tests for magnet links with bad/junk values (#2483)

Co-authored-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
This commit is contained in:
Charles Kerr 2022-01-23 13:01:48 -06:00 committed by GitHub
parent c5bc3091cc
commit 85566c372e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,27 @@ TEST(MagnetMetainfo, magnetParse)
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce" "&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"sv; "&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"sv;
auto constexpr UriHexWithEmptyValue =
"magnet:?xt=urn:btih:"
"d2354010a3ca4ade5b7427bb093a62a3899ff381"
"&empty"
"&dn=Display%20Name"
"&tr=http%3A%2F%2Ftracker.openbittorrent.com%2Fannounce"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"sv;
auto constexpr UriHexWithJunkValues =
"magnet:?xt=urn:btih:"
"d2354010a3ca4ade5b7427bb093a62a3899ff381"
"&empty"
"&empty_again"
"&dn=Display%20Name"
"&tr=http%3A%2F%2Ftracker.openbittorrent.com%2Fannounce"
"&empty_again"
"&="
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"sv;
auto constexpr UriBase32 = auto constexpr UriBase32 =
"magnet:?xt=urn:btih:" "magnet:?xt=urn:btih:"
"2I2UAEFDZJFN4W3UE65QSOTCUOEZ744B" "2I2UAEFDZJFN4W3UE65QSOTCUOEZ744B"
@ -38,7 +59,7 @@ TEST(MagnetMetainfo, magnetParse)
"&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile" "&ws=http%3A%2F%2Fserver.webseed.org%2Fpath%2Fto%2Ffile"
"&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"sv; "&tr=http%3A%2F%2Ftracker.opentracker.org%2Fannounce"sv;
for (auto const& uri : { UriHex, UriBase32 }) for (auto const& uri : { UriHex, UriHexWithEmptyValue, UriHexWithJunkValues, UriBase32 })
{ {
auto mm = tr_magnet_metainfo{}; auto mm = tr_magnet_metainfo{};