lt bug fixes
This commit is contained in:
parent
657055cab1
commit
79b0f67760
|
@ -111,7 +111,7 @@ struct bandwidth_limit
|
|||
|
||||
void assign(int amount) throw()
|
||||
{
|
||||
TORRENT_ASSERT(amount > 0);
|
||||
TORRENT_ASSERT(amount >= 0);
|
||||
m_current_rate += amount;
|
||||
m_quota_left += amount;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,17 @@ void http_connection::on_read(asio::error_code const& e
|
|||
{
|
||||
libtorrent::buffer::const_interval rcv_buf(&m_recvbuffer[0]
|
||||
, &m_recvbuffer[0] + m_read_pos);
|
||||
m_parser.incoming(rcv_buf);
|
||||
try
|
||||
{
|
||||
m_parser.incoming(rcv_buf);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_timer.cancel();
|
||||
m_handler(asio::error::fault, m_parser, 0, 0);
|
||||
m_handler.clear();
|
||||
return;
|
||||
}
|
||||
if (!m_bottled && m_parser.header_finished())
|
||||
{
|
||||
if (m_read_pos > m_parser.body_start())
|
||||
|
|
|
@ -217,7 +217,11 @@ namespace libtorrent
|
|||
char dummy;
|
||||
std::string bytes;
|
||||
size_type range_start, range_end;
|
||||
range_str >> bytes >> range_start >> dummy >> range_end;
|
||||
// apparently some web servers do not send the "bytes"
|
||||
// in their content-range
|
||||
if (value.find(' ') != std::string::npos)
|
||||
range_str >> bytes;
|
||||
range_str >> range_start >> dummy >> range_end;
|
||||
if (!range_str || range_end < range_start)
|
||||
{
|
||||
throw std::runtime_error("invalid content-range in HTTP response: " + range_str.str());
|
||||
|
|
Loading…
Reference in New Issue