diff --git a/checkin_notes b/checkin_notes index 14f2b67aa9..8deff08a96 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/client/http_curl.cpp b/client/http_curl.cpp index 040ae63ad1..3059f532a7 100644 --- a/client/http_curl.cpp +++ b/client/http_curl.cpp @@ -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); } } diff --git a/client/sysmon_win.cpp b/client/sysmon_win.cpp index 16c41ecfe7..240a53a02f 100644 --- a/client/sysmon_win.cpp +++ b/client/sysmon_win.cpp @@ -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"); } diff --git a/lib/proxy_info.cpp b/lib/proxy_info.cpp index 34b9b12f59..e9200988f7 100644 --- a/lib/proxy_info.cpp +++ b/lib/proxy_info.cpp @@ -70,8 +70,7 @@ int PROXY_INFO::write(MIOFILE& out) { " %s\n" " %s\n" " %s\n" - " %s\n" - "\n", + " %s\n", use_http_proxy?" \n":"", use_socks_proxy?" \n":"", use_http_auth?" \n":"", @@ -86,6 +85,19 @@ int PROXY_INFO::write(MIOFILE& out) { hup, noproxy_hosts ); + if (strlen(autodetect_server_name)) { + out.printf( + " %d\n" + " %d\n" + " %d\n", + autodetect_protocol, + autodetect_server_name, + autodetect_port + ); + } + out.printf( + "\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$"; diff --git a/lib/proxy_info.h b/lib/proxy_info.h index b5cf85421e..ebb68804f0 100644 --- a/lib/proxy_info.h +++ b/lib/proxy_info.h @@ -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&);