forked from premiere/premiere-libtorrent
fixed web seed for windows
This commit is contained in:
parent
9d449caf84
commit
c9392fe0fb
|
@ -75,6 +75,9 @@ namespace libtorrent
|
||||||
TORRENT_EXPORT boost::optional<std::string> url_has_argument(
|
TORRENT_EXPORT boost::optional<std::string> url_has_argument(
|
||||||
std::string const& url, std::string argument);
|
std::string const& url, std::string argument);
|
||||||
|
|
||||||
|
// replaces \ with /
|
||||||
|
TORRENT_EXPORT void convert_path_to_posix(std::string& path);
|
||||||
|
|
||||||
TORRENT_EXPORT std::string read_until(char const*& str, char delim, char const* end);
|
TORRENT_EXPORT std::string read_until(char const*& str, char delim, char const* end);
|
||||||
TORRENT_EXPORT std::string to_hex(std::string const& s);
|
TORRENT_EXPORT std::string to_hex(std::string const& s);
|
||||||
TORRENT_EXPORT bool is_hex(char const *in, int len);
|
TORRENT_EXPORT bool is_hex(char const *in, int len);
|
||||||
|
|
|
@ -264,6 +264,13 @@ namespace libtorrent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void convert_path_to_posix(std::string& path)
|
||||||
|
{
|
||||||
|
for (std::string::iterator i = path.begin()
|
||||||
|
, end(path.end()); i != end; ++i)
|
||||||
|
if (*i == '\\') *i = '/';
|
||||||
|
}
|
||||||
|
|
||||||
std::string read_until(char const*& str, char delim, char const* end)
|
std::string read_until(char const*& str, char delim, char const* end)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(str <= end);
|
TORRENT_ASSERT(str <= end);
|
||||||
|
|
|
@ -261,12 +261,18 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
request += m_url;
|
request += m_url;
|
||||||
std::string path = info.orig_files().at(f.file_index).path;
|
std::string path = info.orig_files().at(f.file_index).path;
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
convert_path_to_posix(path);
|
||||||
|
#endif
|
||||||
request += escape_path(path.c_str(), path.length());
|
request += escape_path(path.c_str(), path.length());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string path = m_path;
|
std::string path = m_path;
|
||||||
path += info.orig_files().at(f.file_index).path;
|
path += info.orig_files().at(f.file_index).path;
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
convert_path_to_posix(path);
|
||||||
|
#endif
|
||||||
request += escape_path(path.c_str(), path.length());
|
request += escape_path(path.c_str(), path.length());
|
||||||
}
|
}
|
||||||
request += " HTTP/1.1\r\n";
|
request += " HTTP/1.1\r\n";
|
||||||
|
@ -453,6 +459,9 @@ namespace libtorrent
|
||||||
|
|
||||||
torrent_info const& info = t->torrent_file();
|
torrent_info const& info = t->torrent_file();
|
||||||
std::string path = info.orig_files().at(file_index).path;
|
std::string path = info.orig_files().at(file_index).path;
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
convert_path_to_posix(path);
|
||||||
|
#endif
|
||||||
path = escape_path(path.c_str(), path.length());
|
path = escape_path(path.c_str(), path.length());
|
||||||
size_t i = location.rfind(path);
|
size_t i = location.rfind(path);
|
||||||
if (i == std::string::npos)
|
if (i == std::string::npos)
|
||||||
|
|
Loading…
Reference in New Issue