forked from premiere/premiere-libtorrent
merged web seed fix from RC_0_16
This commit is contained in:
parent
f5972efe9f
commit
b81d1bfe08
|
@ -5,6 +5,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* web seed fixes (better support for torrents without trailing / in web seeds)
|
||||
* fix some issues with SSL over uTP connections
|
||||
* fix UDP trackers trying all endpoints behind the hostname
|
||||
|
||||
|
|
|
@ -373,16 +373,9 @@ namespace libtorrent
|
|||
|
||||
// add or remove a url that will be attempted for
|
||||
// finding the file(s) in this torrent.
|
||||
void add_web_seed(std::string const& url, web_seed_entry::type_t type)
|
||||
{
|
||||
m_web_seeds.push_back(web_seed_entry(url, type));
|
||||
}
|
||||
|
||||
void add_web_seed(std::string const& url, web_seed_entry::type_t type);
|
||||
void add_web_seed(std::string const& url, web_seed_entry::type_t type
|
||||
, std::string const& auth, web_seed_entry::headers_t const& extra_headers)
|
||||
{
|
||||
m_web_seeds.push_back(web_seed_entry(url, type, auth, extra_headers));
|
||||
}
|
||||
, std::string const& auth, web_seed_entry::headers_t const& extra_headers);
|
||||
|
||||
void remove_web_seed(std::string const& url, web_seed_entry::type_t type);
|
||||
void disconnect_web_seed(peer_connection* p);
|
||||
|
|
|
@ -5149,6 +5149,7 @@ namespace libtorrent
|
|||
{
|
||||
std::string url = url_list->list_string_value_at(i);
|
||||
if (url.empty()) continue;
|
||||
if (m_torrent_file->num_files() > 1 && url[url.size()-1] != '/') url += '/';
|
||||
add_web_seed(url, web_seed_entry::url_seed);
|
||||
}
|
||||
}
|
||||
|
@ -7217,6 +7218,25 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
// add or remove a url that will be attempted for
|
||||
// finding the file(s) in this torrent.
|
||||
void torrent::add_web_seed(std::string const& url, web_seed_entry::type_t type)
|
||||
{
|
||||
web_seed_entry ent(url, type);
|
||||
// don't add duplicates
|
||||
if (std::find(m_web_seeds.begin(), m_web_seeds.end(), ent) != m_web_seeds.end()) return;
|
||||
m_web_seeds.push_back(ent);
|
||||
}
|
||||
|
||||
void torrent::add_web_seed(std::string const& url, web_seed_entry::type_t type
|
||||
, std::string const& auth, web_seed_entry::headers_t const& extra_headers)
|
||||
{
|
||||
web_seed_entry ent(url, type, auth, extra_headers);
|
||||
// don't add duplicates
|
||||
if (std::find(m_web_seeds.begin(), m_web_seeds.end(), ent) != m_web_seeds.end()) return;
|
||||
m_web_seeds.push_back(ent);
|
||||
}
|
||||
|
||||
void torrent::set_allow_peers(bool b, bool graceful)
|
||||
{
|
||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||
|
|
|
@ -1103,6 +1103,14 @@ namespace libtorrent
|
|||
return false;
|
||||
}
|
||||
|
||||
lazy_entry const* info = torrent_file.dict_find_dict("info");
|
||||
if (info == 0)
|
||||
{
|
||||
ec = errors::torrent_missing_info;
|
||||
return false;
|
||||
}
|
||||
if (!parse_info_section(*info, ec, flags)) return false;
|
||||
|
||||
// extract the url of the tracker
|
||||
lazy_entry const* i = torrent_file.dict_find_list("announce-list");
|
||||
if (i)
|
||||
|
@ -1187,8 +1195,10 @@ namespace libtorrent
|
|||
lazy_entry const* url_seeds = torrent_file.dict_find("url-list");
|
||||
if (url_seeds && url_seeds->type() == lazy_entry::string_t)
|
||||
{
|
||||
m_web_seeds.push_back(web_seed_entry(maybe_url_encode(url_seeds->string_value())
|
||||
, web_seed_entry::url_seed));
|
||||
web_seed_entry ent(maybe_url_encode(url_seeds->string_value())
|
||||
, web_seed_entry::url_seed);
|
||||
if (m_multifile && ent.url[ent.url.size()-1] != '/') ent.url += '/';
|
||||
m_web_seeds.push_back(ent);
|
||||
}
|
||||
else if (url_seeds && url_seeds->type() == lazy_entry::list_t)
|
||||
{
|
||||
|
@ -1196,8 +1206,10 @@ namespace libtorrent
|
|||
{
|
||||
lazy_entry const* url = url_seeds->list_at(i);
|
||||
if (url->type() != lazy_entry::string_t) continue;
|
||||
m_web_seeds.push_back(web_seed_entry(maybe_url_encode(url->string_value())
|
||||
, web_seed_entry::url_seed));
|
||||
web_seed_entry ent(maybe_url_encode(url->string_value())
|
||||
, web_seed_entry::url_seed);
|
||||
if (m_multifile && ent.url[ent.url.size()-1] != '/') ent.url += '/';
|
||||
m_web_seeds.push_back(ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1227,13 +1239,7 @@ namespace libtorrent
|
|||
if (m_created_by.empty()) m_created_by = torrent_file.dict_find_string_value("created by");
|
||||
verify_encoding(m_created_by);
|
||||
|
||||
lazy_entry const* info = torrent_file.dict_find_dict("info");
|
||||
if (info == 0)
|
||||
{
|
||||
ec = errors::torrent_missing_info;
|
||||
return false;
|
||||
}
|
||||
return parse_info_section(*info, ec, flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
boost::optional<time_t>
|
||||
|
|
Loading…
Reference in New Issue