rename http_settings class as http_proxy class

This commit is contained in:
spyhole 2005-08-24 23:29:57 +00:00
parent 67527bec0b
commit 663764a49a
4 changed files with 24 additions and 23 deletions

View File

@ -1,4 +1,5 @@
modified release 0.901
* rename http_settings class as http_proxy class for compatible socks4/5 proxy later.(by spyhole)
Initial release 0.9 Initial release 0.9
* multitracker support * multitracker support

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
@ -89,7 +89,7 @@
<li><a class="reference" href="#torrent-status" id="id74" name="id74">torrent_status</a></li> <li><a class="reference" href="#torrent-status" id="id74" name="id74">torrent_status</a></li>
<li><a class="reference" href="#peer-info" id="id75" name="id75">peer_info</a></li> <li><a class="reference" href="#peer-info" id="id75" name="id75">peer_info</a></li>
<li><a class="reference" href="#address" id="id76" name="id76">address</a></li> <li><a class="reference" href="#address" id="id76" name="id76">address</a></li>
<li><a class="reference" href="#http-settings" id="id77" name="id77">http_proxy</a></li> <li><a class="reference" href="#http-proxy" id="id77" name="id77">http_proxy</a></li>
<li><a class="reference" href="#ip-filter" id="id78" name="id78">ip_filter</a><ul> <li><a class="reference" href="#ip-filter" id="id78" name="id78">ip_filter</a><ul>
<li><a class="reference" href="#id14" id="id79" name="id79">ip_filter()</a></li> <li><a class="reference" href="#id14" id="id79" name="id79">ip_filter()</a></li>
<li><a class="reference" href="#add-rule" id="id80" name="id80">add_rule()</a></li> <li><a class="reference" href="#add-rule" id="id80" name="id80">add_rule()</a></li>
@ -542,7 +542,7 @@ class session: public boost::noncopyable
void disable_extensions(); void disable_extensions();
void enable_extension(peer_connection::extension_index); void enable_extension(peer_connection::extension_index);
void set_http_proxy(const http_proxy&amp; settings); void set_http_proxy(const http_proxy&amp; http_proxy);
void set_upload_rate_limit(int bytes_per_second); void set_upload_rate_limit(int bytes_per_second);
void set_download_rate_limit(int bytes_per_second); void set_download_rate_limit(int bytes_per_second);
@ -1790,9 +1790,9 @@ while it does the DNS lookup, it returns a string that points to the address rep
<p><tt class="docutils literal"><span class="pre">ip()</span></tt> will return the 32-bit ip-address as an integer. <tt class="docutils literal"><span class="pre">port()</span></tt> returns the port number.</p> <p><tt class="docutils literal"><span class="pre">ip()</span></tt> will return the 32-bit ip-address as an integer. <tt class="docutils literal"><span class="pre">port()</span></tt> returns the port number.</p>
</div> </div>
<div class="section" id="http-settings"> <div class="section" id="http-settings">
<h1><a name="http-settings">http_proxy</a></h1> <h1><a name="http-proxy">http_proxy</a></h1>
<p>You have some control over tracker requests through the <tt class="docutils literal"><span class="pre">http_proxy</span></tt> object. You <p>You have some control over tracker requests through the <tt class="docutils literal"><span class="pre">http_proxy</span></tt> object. You
create it and fill it with your settings and then use <tt class="docutils literal"><span class="pre">session::set_http_proxy()</span></tt> create it and fill it with your http-proxy and then use <tt class="docutils literal"><span class="pre">session::set_http_proxy()</span></tt>
to apply them. You have control over proxy and authorization settings and also the user-agent to apply them. You have control over proxy and authorization settings and also the user-agent
that will be sent to the tracker. The user-agent is a good way to identify your client.</p> that will be sent to the tracker. The user-agent is a good way to identify your client.</p>
<pre class="literal-block"> <pre class="literal-block">

View File

@ -420,7 +420,7 @@ The ``session`` class has the following synopsis::
void disable_extensions(); void disable_extensions();
void enable_extension(peer_connection::extension_index); void enable_extension(peer_connection::extension_index);
void set_http_proxy(const http_proxy& settings); void set_http_proxy(const http_proxy& http_proxy);
void set_upload_rate_limit(int bytes_per_second); void set_upload_rate_limit(int bytes_per_second);
void set_download_rate_limit(int bytes_per_second); void set_download_rate_limit(int bytes_per_second);

View File

@ -108,17 +108,17 @@ struct set_keypress
{ {
set_keypress() set_keypress()
{ {
termios new_settings; termios new_http_proxy;
tcgetattr(0,&stored_settings); tcgetattr(0,&stored_http_proxy);
new_settings = stored_settings; new_http_proxy = stored_http_proxy;
// Disable canonical mode, and set buffer size to 1 byte // Disable canonical mode, and set buffer size to 1 byte
new_settings.c_lflag &= (~ICANON); new_http_proxy.c_lflag &= (~ICANON);
new_settings.c_cc[VTIME] = 0; new_http_proxy.c_cc[VTIME] = 0;
new_settings.c_cc[VMIN] = 1; new_http_proxy.c_cc[VMIN] = 1;
tcsetattr(0,TCSANOW,&new_settings); tcsetattr(0,TCSANOW,&new_http_proxy);
} }
~set_keypress() { tcsetattr(0,TCSANOW,&stored_settings); } ~set_keypress() { tcsetattr(0,TCSANOW,&stored_http_proxy); }
termios stored_settings; termios stored_http_proxy;
}; };
bool sleep_and_input(char* c) bool sleep_and_input(char* c)
@ -303,12 +303,12 @@ int main(int argc, char* argv[])
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
fs::path::default_name_check(fs::no_check); fs::path::default_name_check(fs::no_check);
http_proxy settings; http_proxy http_proxy;
// settings.proxy_ip = "192.168.0.1"; // http_proxy.proxy_ip = "192.168.0.1";
// settings.proxy_port = 80; // http_proxy.proxy_port = 80;
// settings.proxy_login = "hyd"; // http_proxy.proxy_login = "hyd";
// settings.proxy_password = "foobar"; // http_proxy.proxy_password = "foobar";
settings.user_agent = "client_test"; http_proxy.user_agent = "client_test";
std::deque<std::string> events; std::deque<std::string> events;
@ -319,7 +319,7 @@ int main(int argc, char* argv[])
ses.listen_on(std::make_pair(6880, 6889)); ses.listen_on(std::make_pair(6880, 6889));
//ses.set_upload_rate_limit(512 * 1024); //ses.set_upload_rate_limit(512 * 1024);
ses.set_http_proxy(settings); ses.set_http_proxy(http_proxy);
ses.set_severity_level(alert::debug); ses.set_severity_level(alert::debug);
// ses.set_severity_level(alert::info); // ses.set_severity_level(alert::info);