diff --git a/client/http_curl.cpp b/client/http_curl.cpp
index 0bda30ad96..7fbd3a61d8 100644
--- a/client/http_curl.cpp
+++ b/client/http_curl.cpp
@@ -865,7 +865,9 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) {
} else if (pi.use_socks_proxy) {
// CURL only supports SOCKS version 5
- curl_easy_setopt(curlEasy, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
+ curl_easy_setopt(curlEasy, CURLOPT_PROXYTYPE,
+ pi.socks5_remote_dns?CURLPROXY_SOCKS5_HOSTNAME:CURLPROXY_SOCKS5
+ );
curl_easy_setopt(curlEasy, CURLOPT_PROXYPORT, (long) pi.socks_server_port);
curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.socks_server_name);
// libcurl uses blocking sockets with socks proxy, so limit timeout.
diff --git a/html/inc/util.inc b/html/inc/util.inc
index c045398d6e..46c48cfd84 100644
--- a/html/inc/util.inc
+++ b/html/inc/util.inc
@@ -671,16 +671,12 @@ function post_int($name, $optional=false) {
return $y;
}
-function get_array($name, $optional=false) {
+function get_array($name) {
if (isset($_GET[$name])) {
- $x = $_GET[$name];
+ return $_GET[$name];
} else {
- if (!$optional) {
- error_page("missing or bad parameter: $name");
- }
- $x = null;
+ return array();
}
- return $x;
}
function get_str($name, $optional=false) {
diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h
index e42917f6bd..679955a1e4 100644
--- a/lib/gui_rpc_client.h
+++ b/lib/gui_rpc_client.h
@@ -364,6 +364,7 @@ struct GR_PROXY_INFO {
int socks_server_port;
std::string socks5_user_name;
std::string socks5_user_passwd;
+ bool socks5_remote_dns;
std::string noproxy_hosts;
diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp
index 86a90892ea..6d6f63ad5e 100644
--- a/lib/gui_rpc_client_ops.cpp
+++ b/lib/gui_rpc_client_ops.cpp
@@ -855,6 +855,7 @@ int GR_PROXY_INFO::parse(XML_PARSER& xp) {
if (xp.parse_int("socks_server_port", socks_server_port)) continue;
if (xp.parse_string("socks5_user_name", socks5_user_name)) continue;
if (xp.parse_string("socks5_user_passwd", socks5_user_passwd)) continue;
+ if (xp.parse_bool("socks5_remote_dns", socks5_remote_dns)) continue;
if (xp.parse_string("http_server_name", http_server_name)) continue;
if (xp.parse_int("http_server_port", http_server_port)) continue;
if (xp.parse_string("http_user_name", http_user_name)) continue;
@@ -879,6 +880,7 @@ void GR_PROXY_INFO::clear() {
http_user_passwd.clear();
socks5_user_name.clear();
socks5_user_passwd.clear();
+ socks5_remote_dns = false;
noproxy_hosts.clear();
}
@@ -1956,6 +1958,7 @@ int RPC_CLIENT::set_proxy_settings(GR_PROXY_INFO& procinfo) {
" %d\n"
" %s\n"
" %s\n"
+ " %d\n"
" %s\n"
" \n"
"\n",
@@ -1970,6 +1973,7 @@ int RPC_CLIENT::set_proxy_settings(GR_PROXY_INFO& procinfo) {
procinfo.socks_server_port,
procinfo.socks5_user_name.c_str(),
procinfo.socks5_user_passwd.c_str(),
+ procinfo.socks5_remote_dns?1:0,
procinfo.noproxy_hosts.c_str()
);
buf[sizeof(buf)-1] = 0;
diff --git a/lib/proxy_info.cpp b/lib/proxy_info.cpp
index 9bde56016b..63c85ed256 100644
--- a/lib/proxy_info.cpp
+++ b/lib/proxy_info.cpp
@@ -39,6 +39,7 @@ int PROXY_INFO::parse(XML_PARSER& xp) {
if (xp.parse_int("http_server_port", http_server_port)) continue;
if (xp.parse_str("socks5_user_name", socks5_user_name,sizeof(socks5_user_name))) continue;
if (xp.parse_str("socks5_user_passwd", socks5_user_passwd,sizeof(socks5_user_passwd))) continue;
+ if (xp.parse_bool("socks5_remote_dns", socks5_remote_dns)) continue;
if (xp.parse_str("http_user_name", http_user_name,sizeof(http_user_name))) continue;
if (xp.parse_str("http_user_passwd", http_user_passwd,sizeof(http_user_passwd))) continue;
if (xp.parse_str("no_proxy", noproxy_hosts, sizeof(noproxy_hosts))) continue;
@@ -73,6 +74,7 @@ int PROXY_INFO::write(MIOFILE& out) {
" %d\n"
" %s\n"
" %s\n"
+ " %d\n"
" %s\n"
" %s\n"
" %s\n"
@@ -86,6 +88,7 @@ int PROXY_INFO::write(MIOFILE& out) {
http_server_port,
s5un,
s5up,
+ socks5_remote_dns?1:0,
hun,
hup,
noproxy_hosts,
@@ -119,6 +122,7 @@ void PROXY_INFO::clear() {
http_server_port = 80;
safe_strcpy(socks5_user_name, "");
safe_strcpy(socks5_user_passwd, "");
+ socks5_remote_dns = false;
safe_strcpy(http_user_name, "");
safe_strcpy(http_user_passwd, "");
safe_strcpy(noproxy_hosts, "");
diff --git a/lib/proxy_info.h b/lib/proxy_info.h
index a82d161755..2dd4b3fe2d 100644
--- a/lib/proxy_info.h
+++ b/lib/proxy_info.h
@@ -44,6 +44,8 @@ struct PROXY_INFO {
int socks_server_port;
char socks5_user_name[256];
char socks5_user_passwd[256];
+ bool socks5_remote_dns;
+ // send DNS requests to the proxy
// a list of hosts for which we should NOT go through a proxy
// (e.g. a company PC attached to both local and remote projects)