Made the Jamfile to work with boost-build.

updated documentation to reflect the new (working) Jamfile.
This commit is contained in:
Arvid Norberg
2004-02-22 22:40:45 +00:00
parent f656b34d63
commit 9a2fc89eae
12 changed files with 167 additions and 130 deletions

View File

@@ -81,7 +81,8 @@ namespace libtorrent
, unsigned short port
, std::string const& request
, request_callback* c
, const http_settings& stn)
, const http_settings& stn
, std::string const& password)
: tracker_connection(c)
, m_state(read_status)
, m_content_encoding(plain)
@@ -121,6 +122,7 @@ namespace libtorrent
}
m_send_buffer += request;
/*
m_send_buffer += "?info_hash=";
m_send_buffer += escape_string(
reinterpret_cast<const char*>(req.info_hash.begin()), 20);
@@ -151,7 +153,7 @@ namespace libtorrent
// extension that tells the tracker that
// we don't need any peer_id's in the response
m_send_buffer += "&no_peer_id=1";
*/
m_send_buffer += " HTTP/1.0\r\nAccept-Encoding: gzip\r\n"
"User-Agent: ";
m_send_buffer += m_settings.user_agent;
@@ -168,6 +170,11 @@ namespace libtorrent
m_send_buffer += "\r\nProxy-Authorization: Basic ";
m_send_buffer += base64encode(m_settings.proxy_login + ":" + m_settings.proxy_password);
}
if (password != "")
{
m_send_buffer += "\r\nAuthorization: Basic ";
m_send_buffer += base64encode(password);
}
m_send_buffer += "\r\n\r\n";
#ifndef NDEBUG
if (c) c->debug_log("==> TRACKER_REQUEST [ str: " + m_send_buffer + " ]");

View File

@@ -590,7 +590,8 @@ namespace libtorrent
++i)
{
i->second->abort();
m_tracker_manager.queue_request(i->second->generate_tracker_request(m_listen_port));
m_tracker_manager.queue_request(
i->second->generate_tracker_request(m_listen_port));
}
m_connections.clear();
m_torrents.clear();
@@ -844,8 +845,9 @@ namespace libtorrent
else if (i->second->should_request())
{
m_tracker_manager.queue_request(
i->second->generate_tracker_request(m_listen_port),
boost::get_pointer(i->second));
i->second->generate_tracker_request(m_listen_port)
, boost::get_pointer(i->second)
, i->second->tracker_password());
}
i->second->second_tick();

View File

@@ -459,6 +459,12 @@ namespace libtorrent
i->second->announce_piece(index);
}
std::string torrent::tracker_password() const
{
if (m_username.empty() && m_password.empty()) return "";
return m_username + ":" + m_password;
}
tracker_request torrent::generate_tracker_request(int port)
{
assert(port > 0);

View File

@@ -185,6 +185,26 @@ namespace libtorrent
throw invalid_handle();
}
void torrent_handle::set_tracker_login(std::string const& name, std::string const& password)
{
if (m_ses == 0) throw invalid_handle();
{
boost::mutex::scoped_lock l(m_ses->m_mutex);
torrent* t = m_ses->find_torrent(m_info_hash);
if (t != 0) t->set_tracker_login(name, password);
}
if (m_chk)
{
boost::mutex::scoped_lock l(m_chk->m_mutex);
detail::piece_checker_data* d = m_chk->find_torrent(m_info_hash);
if (d != 0) d->torrent_ptr->set_tracker_login(name, password);
}
throw invalid_handle();
}
bool torrent_handle::is_valid() const
{
if (m_ses == 0) return false;

View File

@@ -304,7 +304,8 @@ namespace libtorrent
void tracker_manager::queue_request(
tracker_request const& req
, request_callback* c)
, request_callback* c
, std::string const& password)
{
try
{
@@ -363,7 +364,8 @@ namespace libtorrent
, port
, request_string
, c
, m_settings));
, m_settings
, password));
}
else if (protocol == "udp")
{