mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
Revert "refactor: use OutputIterator for url-escaped info hash strings (#3672)"
This reverts commit 479a16787e.
This commit is contained in:
@@ -172,6 +172,29 @@ char const* tr_webGetResponseStr(long code)
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_rfc2396_alnum(uint8_t ch)
|
||||
{
|
||||
return ('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ch == '.' || ch == '-' ||
|
||||
ch == '_' || ch == '~';
|
||||
}
|
||||
|
||||
void tr_http_escape_sha1(char* out, tr_sha1_digest_t const& digest)
|
||||
{
|
||||
for (auto const b : digest)
|
||||
{
|
||||
if (is_rfc2396_alnum(uint8_t(b)))
|
||||
{
|
||||
*out++ = (char)b;
|
||||
}
|
||||
else
|
||||
{
|
||||
out = fmt::format_to(out, FMT_STRING("%{:02x}"), unsigned(b));
|
||||
}
|
||||
}
|
||||
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
//// URLs
|
||||
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user