added new option 'always_send_user_agent'

This commit is contained in:
Arvid Norberg 2011-02-26 18:17:55 +00:00
parent 12caf7ff2e
commit 8c2d496992
3 changed files with 10 additions and 1 deletions

View File

@ -4329,6 +4329,7 @@ session_settings
int alert_queue_size;
int max_metadata_size;
bool smooth_connects;
bool always_send_user_agent;
};
``version`` is automatically set to the libtorrent version you're using
@ -5170,6 +5171,10 @@ we're close to bump up against the limit of number of connections. The intention
of this setting is to more evenly distribute our connection attempts over time,
instead of attempting to connectin in batches, and timing them out in batches.
``always_send_user_agent`` defaults to false. When set to true, web connections
will include a user-agent with every request, as opposed to just the first
request in a connection.
pe_settings
===========

View File

@ -264,6 +264,7 @@ namespace libtorrent
, alert_queue_size(1000)
, max_metadata_size(1024*1024)
, smooth_connects(true)
, always_send_user_agent(false)
{}
// libtorrent version. Used for forward binary compatibility
@ -1051,6 +1052,9 @@ namespace libtorrent
// attempt to smooth out connects to avoid getting spikes in
// opening connections and timing out connections
bool smooth_connects;
// always send user-agent
bool always_send_user_agent;
};
#ifndef TORRENT_DISABLE_DHT

View File

@ -126,7 +126,7 @@ namespace libtorrent
{
request += "Host: ";
request += m_host;
if (m_first_request) {
if (m_first_request || m_ses.settings().always_send_user_agent) {
request += "\r\nUser-Agent: ";
request += m_ses.settings().user_agent;
}