treat redirect locations slightly more graceful

This commit is contained in:
Arvid Norberg 2009-12-05 22:10:44 +00:00
parent 1a60150e61
commit 1e15054e0e
1 changed files with 4 additions and 7 deletions

View File

@ -622,14 +622,11 @@ void http_connection::on_read(error_code const& e
std::string url = m_url;
// remove the leaf filename
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 += '/';
}
else
{
url.resize(i + 1);
}
url += location;
get(url, m_timeout, m_priority, &m_proxy, m_redirects - 1);