diff --git a/client/http_curl.cpp b/client/http_curl.cpp index 8c5a710e1c..026584b130 100644 --- a/client/http_curl.cpp +++ b/client/http_curl.cpp @@ -812,8 +812,7 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) { return; } - if (strlen(pi.autodetect_server_name)) { - + if (pi.have_autodetect_proxy_settings && strlen(pi.autodetect_server_name)) { if (log_flags.proxy_debug) { msg_printf(0, MSG_INFO, "[proxy_debug] HTTP_OP::setup_proxy_session(): setting up automatic proxy %s:%d", @@ -833,10 +832,7 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) { } curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYPORT, (long) pi.autodetect_server_port); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.autodetect_server_name); - } - - if (pi.use_http_proxy) { - + } else if (pi.use_http_proxy) { if (log_flags.proxy_debug) { msg_printf( 0, MSG_INFO, "[proxy_debug]: setting up proxy %s:%d", diff --git a/client/net_stats.cpp b/client/net_stats.cpp index 39ed546034..5d45f2c496 100644 --- a/client/net_stats.cpp +++ b/client/net_stats.cpp @@ -219,6 +219,7 @@ int LOOKUP_WEBSITE_OP::do_rpc(string& url) { net_status.need_physical_connection = true; net_status.last_comm_time = 0; + gstate.proxy_info.need_autodetect_proxy_settings = true; msg_printf(0, MSG_USER_ERROR, "BOINC can't access Internet - check network connection or proxy configuration." ); diff --git a/client/sysmon_win.cpp b/client/sysmon_win.cpp index 3ea49cb14f..ba7fc452d3 100644 --- a/client/sysmon_win.cpp +++ b/client/sysmon_win.cpp @@ -198,7 +198,6 @@ static void windows_detect_autoproxy_settings() { gstate.proxy_info.autodetect_server_protocol = proxy_protocol; strcpy(gstate.proxy_info.autodetect_server_name, proxy_server); gstate.proxy_info.autodetect_server_port = proxy_port; - gstate.proxy_info.autodetect_proxy_settings = true; if (log_flags.proxy_debug) { msg_printf(NULL, MSG_INFO, @@ -216,7 +215,6 @@ static void windows_detect_autoproxy_settings() { gstate.proxy_info.autodetect_server_protocol = 0; strcpy(gstate.proxy_info.autodetect_server_name, ""); gstate.proxy_info.autodetect_server_port = 0; - gstate.proxy_info.autodetect_proxy_settings = true; if (log_flags.proxy_debug) { msg_printf(NULL, MSG_INFO, "[proxy_debug] no automatic proxy detected"); } @@ -239,8 +237,11 @@ static LRESULT CALLBACK WindowsMonitorSystemWndProc( // System Monitor 1 second timer case 1: - if (gstate.proxy_info.autodetect_proxy_settings) { + if (gstate.proxy_info.need_autodetect_proxy_settings) { + gstate.proxy_info.have_autodetect_proxy_settings = false; windows_detect_autoproxy_settings(); + gstate.proxy_info.need_autodetect_proxy_settings = false; + gstate.proxy_info.have_autodetect_proxy_settings = true; } default: break; @@ -291,7 +292,7 @@ static LRESULT CALLBACK WindowsMonitorSystemWndProc( msg_printf(NULL, MSG_INFO, "Windows is resuming operations"); // Check for a proxy - gstate.proxy_info.autodetect_proxy_settings = true; + gstate.proxy_info.need_autodetect_proxy_settings = true; resume_client(); break; @@ -348,7 +349,7 @@ static DWORD WINAPI WindowsMonitorSystemThread( LPVOID ) { } // Check for a proxy at startup - gstate.proxy_info.autodetect_proxy_settings = true; + gstate.proxy_info.need_autodetect_proxy_settings = true; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); diff --git a/lib/proxy_info.h b/lib/proxy_info.h index 00d43dba5f..d00e1875f0 100644 --- a/lib/proxy_info.h +++ b/lib/proxy_info.h @@ -40,7 +40,10 @@ struct PROXY_INFO { int autodetect_server_protocol; char autodetect_server_name[256]; int autodetect_server_port; - bool autodetect_proxy_settings; + 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; int parse(MIOFILE&); int write(MIOFILE&);