merged http_connection tweak from RC_0_16

This commit is contained in:
Arvid Norberg 2014-03-03 00:09:06 +00:00
parent 043d540627
commit fd26cc026b
2 changed files with 8 additions and 4 deletions

View File

@ -151,7 +151,7 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
bool ssl = false; bool ssl = false;
if (protocol == "https") ssl = true; if (protocol == "https") ssl = true;
char request[2048]; char request[4096];
char* end = request + sizeof(request); char* end = request + sizeof(request);
char* ptr = request; char* ptr = request;
@ -851,11 +851,15 @@ void http_connection::on_read(error_code const& e
m_last_receive = time_now_hires(); m_last_receive = time_now_hires();
} }
// if we've hit the limit, double the buffer size
if (int(m_recvbuffer.size()) == m_read_pos) if (int(m_recvbuffer.size()) == m_read_pos)
m_recvbuffer.resize((std::min)(m_read_pos + 2048, m_max_bottled_buffer_size)); m_recvbuffer.resize((std::min)(m_read_pos * 2, m_max_bottled_buffer_size));
if (m_read_pos == m_max_bottled_buffer_size) if (m_read_pos == m_max_bottled_buffer_size)
{ {
callback(asio::error::eof); // if we've reached the size limit, terminate the connection and
// report the error
callback(error_code(boost::system::errc::file_too_large, generic_category()));
close(); close();
return; return;
} }

View File

@ -1410,7 +1410,7 @@ namespace libtorrent
, ssl_listen(4433) , ssl_listen(4433)
, tracker_backoff(250) , tracker_backoff(250)
, ban_web_seeds(true) , ban_web_seeds(true)
, max_http_recv_buffer_size(2*1024*1024) , max_http_recv_buffer_size(4*1024*1024)
, support_share_mode(true) , support_share_mode(true)
, support_merkle_torrents(false) , support_merkle_torrents(false)
, report_redundant_bytes(true) , report_redundant_bytes(true)