- fixes to proxy autodetect

svn path=/trunk/boinc/; revision=18941
This commit is contained in:
David Anderson 2009-08-28 21:25:13 +00:00
parent 7e8dadd5a3
commit 607119dcbf
4 changed files with 13 additions and 12 deletions

View File

@ -812,8 +812,7 @@ void HTTP_OP::setup_proxy_session(bool no_proxy) {
return; return;
} }
if (strlen(pi.autodetect_server_name)) { if (pi.have_autodetect_proxy_settings && strlen(pi.autodetect_server_name)) {
if (log_flags.proxy_debug) { if (log_flags.proxy_debug) {
msg_printf(0, MSG_INFO, msg_printf(0, MSG_INFO,
"[proxy_debug] HTTP_OP::setup_proxy_session(): setting up automatic proxy %s:%d", "[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_PROXYPORT, (long) pi.autodetect_server_port);
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.autodetect_server_name); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.autodetect_server_name);
} } else if (pi.use_http_proxy) {
if (pi.use_http_proxy) {
if (log_flags.proxy_debug) { if (log_flags.proxy_debug) {
msg_printf( msg_printf(
0, MSG_INFO, "[proxy_debug]: setting up proxy %s:%d", 0, MSG_INFO, "[proxy_debug]: setting up proxy %s:%d",

View File

@ -219,6 +219,7 @@ int LOOKUP_WEBSITE_OP::do_rpc(string& url) {
net_status.need_physical_connection = true; net_status.need_physical_connection = true;
net_status.last_comm_time = 0; net_status.last_comm_time = 0;
gstate.proxy_info.need_autodetect_proxy_settings = true;
msg_printf(0, MSG_USER_ERROR, msg_printf(0, MSG_USER_ERROR,
"BOINC can't access Internet - check network connection or proxy configuration." "BOINC can't access Internet - check network connection or proxy configuration."
); );

View File

@ -198,7 +198,6 @@ static void windows_detect_autoproxy_settings() {
gstate.proxy_info.autodetect_server_protocol = proxy_protocol; gstate.proxy_info.autodetect_server_protocol = proxy_protocol;
strcpy(gstate.proxy_info.autodetect_server_name, proxy_server); strcpy(gstate.proxy_info.autodetect_server_name, proxy_server);
gstate.proxy_info.autodetect_server_port = proxy_port; gstate.proxy_info.autodetect_server_port = proxy_port;
gstate.proxy_info.autodetect_proxy_settings = true;
if (log_flags.proxy_debug) { if (log_flags.proxy_debug) {
msg_printf(NULL, MSG_INFO, msg_printf(NULL, MSG_INFO,
@ -216,7 +215,6 @@ static void windows_detect_autoproxy_settings() {
gstate.proxy_info.autodetect_server_protocol = 0; gstate.proxy_info.autodetect_server_protocol = 0;
strcpy(gstate.proxy_info.autodetect_server_name, ""); strcpy(gstate.proxy_info.autodetect_server_name, "");
gstate.proxy_info.autodetect_server_port = 0; gstate.proxy_info.autodetect_server_port = 0;
gstate.proxy_info.autodetect_proxy_settings = true;
if (log_flags.proxy_debug) { if (log_flags.proxy_debug) {
msg_printf(NULL, MSG_INFO, "[proxy_debug] no automatic proxy detected"); msg_printf(NULL, MSG_INFO, "[proxy_debug] no automatic proxy detected");
} }
@ -239,8 +237,11 @@ static LRESULT CALLBACK WindowsMonitorSystemWndProc(
// System Monitor 1 second timer // System Monitor 1 second timer
case 1: 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(); windows_detect_autoproxy_settings();
gstate.proxy_info.need_autodetect_proxy_settings = false;
gstate.proxy_info.have_autodetect_proxy_settings = true;
} }
default: default:
break; break;
@ -291,7 +292,7 @@ static LRESULT CALLBACK WindowsMonitorSystemWndProc(
msg_printf(NULL, MSG_INFO, "Windows is resuming operations"); msg_printf(NULL, MSG_INFO, "Windows is resuming operations");
// Check for a proxy // Check for a proxy
gstate.proxy_info.autodetect_proxy_settings = true; gstate.proxy_info.need_autodetect_proxy_settings = true;
resume_client(); resume_client();
break; break;
@ -348,7 +349,7 @@ static DWORD WINAPI WindowsMonitorSystemThread( LPVOID ) {
} }
// Check for a proxy at startup // 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)) { while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); TranslateMessage(&msg);

View File

@ -40,7 +40,10 @@ struct PROXY_INFO {
int autodetect_server_protocol; int autodetect_server_protocol;
char autodetect_server_name[256]; char autodetect_server_name[256];
int autodetect_server_port; 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 parse(MIOFILE&);
int write(MIOFILE&); int write(MIOFILE&);