summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2011-12-20 02:55:57 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2011-12-20 02:55:57 +0200
commit52b3346939f13c78eca5476850377dd2aac139a1 (patch)
tree47b0c800a7ef16f0733b1f80f3e7d231fde9ac39
parent816941559161cbc54d5373713cf07fb3fe40e311 (diff)
fixed proxy type sending
-rwxr-xr-xserver/server/main.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/server/server/main.cpp b/server/server/main.cpp
index 1adcd44..ee4660f 100755
--- a/server/server/main.cpp
+++ b/server/server/main.cpp
@@ -321,6 +321,41 @@ void session::proto_parser(std::vector<byte>& data)
data.push_back(0x02);
for(std::list<config::proxy_entry>::iterator it = cfg->get_proxy_list()->begin(), end = cfg->get_proxy_list()->end(); it != end; ++it)
{
+ switch(it->type)
+ {
+ case config::HTTPS:
+ {
+ const char *str = "https://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::SOCKS4:
+ {
+ const char *str = "socks4://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::SOCKS5:
+ {
+ const char *str = "socks5://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::HTTP:
+ {
+ const char *str = "http://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ }
if(!it->login.empty() && !it->password.empty())
{
for(int i = 0; i < it->login.size(); ++ i)
@@ -402,6 +437,41 @@ void session::proto_parser(std::vector<byte>& data)
data.push_back(0x03);
for(std::list<config::static_proxy_entry>::iterator it = cfg->get_static_proxy_list()->begin(), end = cfg->get_static_proxy_list()->end(); it != end; ++it)
{
+ switch(it->type)
+ {
+ case config::HTTPS:
+ {
+ const char *str = "https://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::SOCKS4:
+ {
+ const char *str = "socks4://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::SOCKS5:
+ {
+ const char *str = "socks5://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ case config::HTTP:
+ {
+ const char *str = "http://";
+ unsigned l = strlen(str);
+ for(int i = 0; i < l; i++)
+ data.push_back(str[i]);
+ }
+ break;
+ }
if(!it->login.empty() && !it->password.empty())
{
for(int i = 0; i < it->login.size(); ++ i)