Revert "refactor: use OutputIterator for url-escaped info hash strings (#3672)"

This reverts commit 479a16787e.
This commit is contained in:
Charles Kerr
2022-08-19 02:18:16 -05:00
parent dde626d5e5
commit 1cf19550ad
4 changed files with 40 additions and 15 deletions

View File

@@ -8,7 +8,6 @@
#include <cinttypes> // PRIu64
#include <cstdio>
#include <ctime>
#include <iterator>
#include <string>
#include <string_view>
@@ -340,9 +339,14 @@ void doScrape(tr_torrent_metainfo const& metainfo)
}
// build the full scrape URL
auto escaped = std::array<char, TR_SHA1_DIGEST_LEN * 3 + 1>{};
tr_http_escape_sha1(std::data(escaped), metainfo.infoHash());
auto const scrape = tracker.scrape.sv();
auto url = tr_urlbuf{ scrape, tr_strvContains(scrape, '?') ? '&' : '?', "info_hash="sv };
tr_http_escape(std::back_inserter(url), metainfo.infoHash());
auto const url = tr_urlbuf{ scrape,
tr_strvContains(scrape, '?') ? '&' : '?',
"info_hash="sv,
std::string_view{ std::data(escaped) } };
printf("%" TR_PRIsv " ... ", TR_PRIsv_ARG(url));
fflush(stdout);