diff options
author | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-06-23 15:54:29 +0300 |
---|---|---|
committer | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-06-23 15:54:29 +0300 |
commit | 928b8f21eba6f027ef2bc417a6da669a875a15aa (patch) | |
tree | 2e3c067c22133756a794ffd8a509d9a18f74750d | |
parent | Add [proxy] section settings to segget.conf (diff) | |
download | idfetch-928b8f21eba6f027ef2bc417a6da669a875a15aa.tar.gz idfetch-928b8f21eba6f027ef2bc417a6da669a875a15aa.tar.bz2 idfetch-928b8f21eba6f027ef2bc417a6da669a875a15aa.zip |
Add [user-data].user_agent option to segget.conf
USER_AGENT
Set the User-Agent: header in the http request sent to the remote server.
This can be used to fool servers or scripts.
Default:
user_agent=segget
-rw-r--r-- | segget/segget.conf | 8 | ||||
-rw-r--r-- | segget/segment.cpp | 2 | ||||
-rw-r--r-- | segget/settings.cpp | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/segget/segget.conf b/segget/segget.conf index 3d1dc47..21c17a9 100644 --- a/segget/segget.conf +++ b/segget/segget.conf @@ -179,7 +179,13 @@ benchmark_oblivion=5 [user-data] -# NOT IMPLEMENTED YET: user_agent=segget +# USER_AGENT +# Set the User-Agent: header in the http request sent to the remote server. +# This can be used to fool servers or scripts. +# Default: +# user_agent=segget +user_agent=segget + # Specify the user and password for authentication on a ftp servers. # NOT IMPLEMENTED YET: ftp-user=anonymous # NOT IMPLEMENTED YET: ftp-password=me@mail.ru diff --git a/segget/segment.cpp b/segget/segment.cpp index e055b23..f8bf50a 100644 --- a/segget/segment.cpp +++ b/segget/segment.cpp @@ -127,7 +127,7 @@ int Tsegment::add_easy_handle_to_multi(CURLM *cm){ curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_LIMIT, settings.low_connection_speed_limit); curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_TIME, settings.low_connection_speed_time); curl_easy_setopt(easyhandle, CURLOPT_MAX_RECV_SPEED_LARGE, settings.max_connection_speed); - + curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, settings.user_agent.c_str()); if (settings.proxy_off) curl_easy_setopt(easyhandle, CURLOPT_NOPROXY, "*"); diff --git a/segget/settings.cpp b/segget/settings.cpp index 6b78774..f574fd3 100644 --- a/segget/settings.cpp +++ b/segget/settings.cpp @@ -31,6 +31,8 @@ class Tsettings{ //mirrors uint max_connections_num_per_mirror; uint benchmark_oblivion; + //user-data + string user_agent; //proxy string proxy_ip_or_name; uint proxy_port; @@ -59,6 +61,8 @@ class Tsettings{ //mirrors max_connections_num_per_mirror(2), benchmark_oblivion(5), + //user-data + user_agent("segget"), //proxy proxy_ip_or_name("none"), proxy_port(0), @@ -96,6 +100,8 @@ void Tsettings::load_from_conf_file(){ conf.set(max_connections_num_per_mirror, "mirrors", "max_connections_num_per_mirror"); conf.set(benchmark_oblivion, "mirrors", "benchmark_oblivion"); + conf.set(user_agent, "user-data", "user_agent"); + conf.set(proxy_ip_or_name, "proxy", "proxy_ip_or_name"); conf.set(proxy_port, "proxy", "proxy_port"); conf.set(proxy_off, "proxy", "proxy_off"); |