summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/proxy_ui_server.workspace6
-rwxr-xr-xserver/server/config.cpp70
2 files changed, 30 insertions, 46 deletions
diff --git a/server/proxy_ui_server.workspace b/server/proxy_ui_server.workspace
index 1e165f9..eb17446 100644
--- a/server/proxy_ui_server.workspace
+++ b/server/proxy_ui_server.workspace
@@ -23,6 +23,12 @@
+
+
+
+
+
+
]]>
</Environment>
</CodeLite_Workspace>
diff --git a/server/server/config.cpp b/server/server/config.cpp
index fafa1ad..caa67c1 100755
--- a/server/server/config.cpp
+++ b/server/server/config.cpp
@@ -241,20 +241,20 @@ void config::load_proxy_list(char *pth)
std::string host, login, password, country, state, city;
proxy_type type = UNKNOWN;
int port = 0;
+ lp2 = line.find("://", lp1);
+ std::string s_type = line.substr(lp1, lp2-lp1);
+ if(s_type == "http")
+ type = HTTP;
+ else if(s_type == "https")
+ type = HTTPS;
+ else if(s_type == "socks4")
+ type = SOCKS4;
+ else if(s_type == "socks5")
+ type = SOCKS5;
+ lp1 = lp2+3;
+ lp2 = line.find(':', lp1);
if(line.find('@') != std::string::npos)
{
- lp2 = line.find("://", lp1);
- std::string s_type = line.substr(lp1, lp2-lp1);
- if(s_type == "http")
- type = HTTP;
- else if(s_type == "https")
- type = HTTPS;
- else if(s_type == "socks4")
- type = SOCKS4;
- else if(s_type == "socks5")
- type = SOCKS5;
- lp1 = lp2+3;
- lp2 = line.find(':', lp1);
login = line.substr(lp1, lp2-lp1);
lp1 = lp2+1;
lp2 = line.find('@', lp1);
@@ -277,18 +277,6 @@ void config::load_proxy_list(char *pth)
}
else
{
- lp2 = line.find("://", lp1);
- std::string s_type = line.substr(lp1, lp2-lp1);
- if(s_type == "http")
- type = HTTP;
- else if(s_type == "https")
- type = HTTPS;
- else if(s_type == "socks4")
- type = SOCKS4;
- else if(s_type == "socks5")
- type = SOCKS5;
- lp1 = lp2+3;
- lp2 = line.find(':', lp1);
host = line.substr(lp1, lp2-lp1);
lp1 = lp2+1;
lp2 = line.find("\x20", lp1);
@@ -336,19 +324,20 @@ void config::load_static_proxy_list(char *pth)
std::string host, login, password, label;
proxy_type type = UNKNOWN;
int port = 0, position = 0;
+ lp2 = line.find("://", lp1);
+ std::string s_type = line.substr(lp1, lp2-lp1);
+ if(s_type == "http")
+ type = HTTP;
+ else if(s_type == "https")
+ type = HTTPS;
+ else if(s_type == "socks4")
+ type = SOCKS4;
+ else if(s_type == "socks5")
+ type = SOCKS5;
+ lp1 = lp2+3;
+ lp2 = line.find(':', lp1);
if(line.find('@') != std::string::npos)
{
- lp2 = line.find("://", lp1);
- std::string s_type = line.substr(lp1, lp2-lp1);
- if(s_type == "http")
- type = HTTP;
- else if(s_type == "https")
- type = HTTPS;
- else if(s_type == "socks4")
- type = SOCKS4;
- else if(s_type == "socks5")
- type = SOCKS5;
- lp2 = line.find(':', lp1);
login = line.substr(lp1, lp2-lp1);
lp1 = lp2+1;
lp2 = line.find('@', lp1);
@@ -368,17 +357,6 @@ void config::load_static_proxy_list(char *pth)
}
else
{
- lp2 = line.find("://", lp1);
- std::string s_type = line.substr(lp1, lp2-lp1);
- if(s_type == "http")
- type = HTTP;
- else if(s_type == "https")
- type = HTTPS;
- else if(s_type == "socks4")
- type = SOCKS4;
- else if(s_type == "socks5")
- type = SOCKS5;
- lp2 = line.find(':'), lp1;
host = line.substr(lp1, lp2-lp1);
lp1 = lp2+1;
lp2 = line.find("\x20", lp1);