From 9c89b45af2cbf8e7baf857d5dfde25ea1fb23819 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 28 Jan 2008 16:52:52 +0000 Subject: [PATCH] - client: add config flag. Causes client to use NTLM auth and HTTP 1.0 - client: we weren't doing exponential backoff if scheduler requests failed at initialization; fix this svn path=/trunk/boinc/; revision=14628 --- checkin_notes | 11 ++++++++ client/http_curl.C | 61 +++++++++++++++++++++++-------------------- client/log_flags.C | 2 ++ client/log_flags.h | 1 + client/scheduler_op.C | 2 ++ 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/checkin_notes b/checkin_notes index cc95ee99d0..c218e7bbed 100644 --- a/checkin_notes +++ b/checkin_notes @@ -811,3 +811,14 @@ David Jan 28 2008 user.inc user/ login_action.php + +David Jan 28 2008 + - client: add config flag. + Causes client to use NTLM auth and HTTP 1.0 + - client: we weren't doing exponential backoff if scheduler + requests failed at initialization; fix this + + client/ + http_curl.C + log_flags.C,h + scheduler_op.C diff --git a/client/http_curl.C b/client/http_curl.C index 582cd278d5..81e30b18d6 100644 --- a/client/http_curl.C +++ b/client/http_curl.C @@ -398,7 +398,7 @@ int HTTP_OP::libcurl_exec( // force curl to use HTTP/1.0 if config specifies it // (curl uses 1.1 by default) // - if (config.http_1_0) { + if (config.http_1_0 || config.force_ntlm) { curlErr = curl_easy_setopt(curlEasy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); } curlErr = curl_easy_setopt(curlEasy, CURLOPT_MAXREDIRS, 50L); @@ -770,32 +770,29 @@ int libcurl_debugfunction( void HTTP_OP::setupProxyCurl() { - // CMC: use the libcurl proxy routines with this object's proxy information struct - /* PROXY_INFO pi useful members: - pi.http_server_name - pi.http_server_port - pi.http_user_name - pi.http_user_passwd - pi.socks5_user_name - pi.socks5_user_passwd - pi.socks_server_name - pi.socks_server_port - pi.socks_version - pi.use_http_auth - pi.use_http_proxy - pi.use_socks_proxy - - Curl self-explanatory setopt params for proxies: - CURLOPT_HTTPPROXYTUNNEL - CURLOPT_PROXYTYPE (pass in CURLPROXY_HTTP or CURLPROXY_SOCKS5) - CURLOPT_PROXYPORT -- a long port # - CURLOPT_PROXY - pass in char* of the proxy url - CURLOPT_PROXYUSERPWD -- a char* in the format username:password - CURLOPT_HTTPAUTH -- pass in one of CURLAUTH_BASIC, CURLAUTH_DIGEST, - CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM, CURLAUTH_ANY, CURLAUTH_ANYSAFE - CURLOPT_PROXYAUTH -- "or" | the above bitmasks -- only basic, digest, ntlm work - - */ +// PROXY_INFO pi useful members: +// pi.http_server_name +// pi.http_server_port +// pi.http_user_name +// pi.http_user_passwd +// pi.socks5_user_name +// pi.socks5_user_passwd +// pi.socks_server_name +// pi.socks_server_port +// pi.socks_version +// pi.use_http_auth +// pi.use_http_proxy +// pi.use_socks_proxy +// +// Curl self-explanatory setopt params for proxies: +// CURLOPT_HTTPPROXYTUNNEL +// CURLOPT_PROXYTYPE (pass in CURLPROXY_HTTP or CURLPROXY_SOCKS5) +// CURLOPT_PROXYPORT -- a long port # +// CURLOPT_PROXY - pass in char* of the proxy url +// CURLOPT_PROXYUSERPWD -- a char* in the format username:password +// CURLOPT_HTTPAUTH -- pass in one of CURLAUTH_BASIC, CURLAUTH_DIGEST, +// CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM, CURLAUTH_ANY, CURLAUTH_ANYSAFE +// CURLOPT_PROXYAUTH -- "or" | the above bitmasks -- only basic, digest, ntlm work CURLcode curlErr; @@ -815,7 +812,11 @@ void HTTP_OP::setupProxyCurl() { if (auth_type) { curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, auth_type); } else { - curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_ANY & ~CURLAUTH_NTLM); + if (config.force_ntlm) { + curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); + } else { + curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_ANY); + } } sprintf(szCurlProxyUserPwd, "%s:%s", pi.http_user_name, pi.http_user_passwd); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYUSERPWD, szCurlProxyUserPwd); @@ -991,9 +992,11 @@ void HTTP_OP_SET::got_select(FDSET_GROUP&, double timeout) { // if proxy/socks server uses authentication and its not set yet, // get what last transfer used + // if (hop->auth_flag && !hop->auth_type) { curlErr = curl_easy_getinfo(hop->curlEasy, - CURLINFO_PROXYAUTH_AVAIL, &hop->auth_type); + CURLINFO_PROXYAUTH_AVAIL, &hop->auth_type + ); } // the op is done if curl_multi_msg_read gave us a msg for this http_op diff --git a/client/log_flags.C b/client/log_flags.C index 37c8ab207d..889d46a1cd 100644 --- a/client/log_flags.C +++ b/client/log_flags.C @@ -206,6 +206,7 @@ void CONFIG::defaults() { report_results_immediately = false; start_delay = 0; run_apps_manually = false; + force_ntlm = false; } int CONFIG::parse_options(XML_PARSER& xp) { @@ -251,6 +252,7 @@ int CONFIG::parse_options(XML_PARSER& xp) { if (xp.parse_bool(tag, "report_results_immediately", report_results_immediately)) continue; if (xp.parse_double(tag, "start_delay", start_delay)) continue; if (xp.parse_bool(tag, "run_apps_manually", run_apps_manually)) continue; + if (xp.parse_bool(tag, "force_ntlm", force_ntlm)) continue; msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n", CONFIG_FILE, tag ); diff --git a/client/log_flags.h b/client/log_flags.h index fe555196f5..914a0cb1f2 100644 --- a/client/log_flags.h +++ b/client/log_flags.h @@ -103,6 +103,7 @@ struct CONFIG { bool report_results_immediately; double start_delay; bool run_apps_manually; + bool force_ntlm; CONFIG(); void defaults(); diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 995a0ddcbb..9059cd8c2d 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -234,6 +234,7 @@ int SCHEDULER_OP::start_rpc(PROJECT* p) { "Scheduler request failed: %s", boincerror(retval) ); } + backoff(cur_proj, "scheduler request failed"); return retval; } retval = http_ops->insert(&http_op); @@ -243,6 +244,7 @@ int SCHEDULER_OP::start_rpc(PROJECT* p) { "Scheduler request failed: %s", boincerror(retval) ); } + backoff(cur_proj, "scheduler request failed"); return retval; } p->rpc_seqno++;