- client/API: add autosetup proxy info to init_data.xml

svn path=/trunk/boinc/; revision=19090
This commit is contained in:
David Anderson 2009-09-18 16:30:25 +00:00
parent 69f09b9384
commit 2e702db323
5 changed files with 51 additions and 17 deletions

View File

@ -7842,8 +7842,17 @@ David 17 Sept 2009
client/
client_types.cpp
David 17 Sept 2009
David 18 Sept 2009
- transitioner: fix to 15 Sept checkin
sched/
transitioner.cpp
David 18 Sept 2009
- client/API: add autosetup proxy info to init_data.xml
client/
http_curl.cpp
sysmon_win.cpp
lib/
proxy_info.cpp,h

View File

@ -859,11 +859,11 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) {
if (log_flags.proxy_debug) {
msg_printf(0, MSG_INFO,
"[proxy_debug] HTTP_OP::setup_proxy_session(): setting up automatic proxy %s:%d",
pi.autodetect_server_name, pi.autodetect_server_port
pi.autodetect_server_name, pi.autodetect_port
);
}
switch(pi.autodetect_server_protocol) {
switch(pi.autodetect_protocol) {
case URL_PROTOCOL_SOCKS:
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
break;
@ -873,7 +873,7 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) {
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
break;
}
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYPORT, (long) pi.autodetect_server_port);
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYPORT, (long) pi.autodetect_port);
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.autodetect_server_name);
}
}

View File

@ -193,9 +193,9 @@ static void windows_detect_autoproxy_settings() {
);
// Store the results for future use.
gstate.proxy_info.autodetect_server_protocol = proxy_protocol;
gstate.proxy_info.autodetect_protocol = proxy_protocol;
strcpy(gstate.proxy_info.autodetect_server_name, proxy_server);
gstate.proxy_info.autodetect_server_port = proxy_port;
gstate.proxy_info.autodetect_port = proxy_port;
if (log_flags.proxy_debug) {
msg_printf(NULL, MSG_INFO,
@ -210,9 +210,9 @@ static void windows_detect_autoproxy_settings() {
} else {
// We can get here if the user is switching from a network that
// requires a proxy to one that does not require a proxy.
gstate.proxy_info.autodetect_server_protocol = 0;
gstate.proxy_info.autodetect_protocol = 0;
strcpy(gstate.proxy_info.autodetect_server_name, "");
gstate.proxy_info.autodetect_server_port = 0;
gstate.proxy_info.autodetect_port = 0;
if (log_flags.proxy_debug) {
msg_printf(NULL, MSG_INFO, "[proxy_debug] no automatic proxy detected");
}

View File

@ -70,8 +70,7 @@ int PROXY_INFO::write(MIOFILE& out) {
" <socks5_user_passwd>%s</socks5_user_passwd>\n"
" <http_user_name>%s</http_user_name>\n"
" <http_user_passwd>%s</http_user_passwd>\n"
" <no_proxy>%s</no_proxy>\n"
"</proxy_info>\n",
" <no_proxy>%s</no_proxy>\n",
use_http_proxy?" <use_http_proxy/>\n":"",
use_socks_proxy?" <use_socks_proxy/>\n":"",
use_http_auth?" <use_http_auth/>\n":"",
@ -86,6 +85,19 @@ int PROXY_INFO::write(MIOFILE& out) {
hup,
noproxy_hosts
);
if (strlen(autodetect_server_name)) {
out.printf(
" <autodetect_protocol>%d</autodetect_protocol>\n"
" <autodetect_server_name>%d</autodetect_server_name>\n"
" <autodetect_port>%d</autodetect_port>\n",
autodetect_protocol,
autodetect_server_name,
autodetect_port
);
}
out.printf(
"</proxy_info>\n"
);
return 0;
}
@ -102,12 +114,10 @@ void PROXY_INFO::clear() {
strcpy(http_user_name, "");
strcpy(http_user_passwd, "");
socks_version = 0;
strcpy(autodetect_server_name, "");
autodetect_server_port = 80;
strcpy(noproxy_hosts, "");
autodetect_server_protocol = 0;
strcpy(autodetect_server_name, "");
autodetect_server_port = 80;
strcpy(autodetect_server_name, "");
autodetect_port = 80;
autodetect_protocol = 0;
}
const char *BOINC_RCSID_af13db88e5 = "$Id$";

View File

@ -20,7 +20,11 @@
#include "miofile.h"
// info on whether HTTP requests need to go through a proxy
//
struct PROXY_INFO {
// the following is populated is user has specified an HTTP proxy
//
bool use_http_proxy;
bool use_http_auth;
char http_server_name[256];
@ -28,6 +32,8 @@ struct PROXY_INFO {
char http_user_name[256];
char http_user_passwd[256];
// the following is populated if use has specified a SOCKs proxy
//
bool use_socks_proxy;
int socks_version;
char socks_server_name[256];
@ -35,15 +41,24 @@ struct PROXY_INFO {
char socks5_user_name[256];
char socks5_user_passwd[256];
// 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)
//
char noproxy_hosts[256];
int autodetect_server_protocol;
// On Windows, if neither HTTP nor SOCKS proxy is specified,
// we try the "autodetect" mechanism.
// If it gets anything, the info is filled in below
//
int autodetect_protocol;
// URL_PROTOCOL_SOCKS, URL_PROTOCOL_HTTP, or URL_PROTOCOL_HTTPS
char autodetect_server_name[256];
int autodetect_server_port;
int autodetect_port;
bool need_autodetect_proxy_settings;
// if true, we need to detect proxy settings.
// set to true if ref web site lookup fails
bool have_autodetect_proxy_settings;
// whether above fields are defined
int parse(MIOFILE&);
int write(MIOFILE&);