forked from premiere/premiere-libtorrent
treat redirect locations slightly more graceful
This commit is contained in:
parent
1a60150e61
commit
1e15054e0e
|
@ -622,14 +622,11 @@ void http_connection::on_read(error_code const& e
|
||||||
std::string url = m_url;
|
std::string url = m_url;
|
||||||
// remove the leaf filename
|
// remove the leaf filename
|
||||||
std::size_t i = url.find_last_of('/');
|
std::size_t i = url.find_last_of('/');
|
||||||
if (i == std::string::npos)
|
if (i != std::string::npos)
|
||||||
{
|
url.resize(i);
|
||||||
|
if ((url.empty() || url[url.size()-1] != '/')
|
||||||
|
&& (location.empty() || location[0] != '/'))
|
||||||
url += '/';
|
url += '/';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
url.resize(i + 1);
|
|
||||||
}
|
|
||||||
url += location;
|
url += location;
|
||||||
|
|
||||||
get(url, m_timeout, m_priority, &m_proxy, m_redirects - 1);
|
get(url, m_timeout, m_priority, &m_proxy, m_redirects - 1);
|
||||||
|
|
Loading…
Reference in New Issue