From 6d367a431725e6bf27fe9ffb344361712b120cf9 Mon Sep 17 00:00:00 2001 From: Walt Gribben Date: Wed, 19 Apr 2006 23:01:43 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=9974 --- checkin_notes | 17 +++++++++++++++++ client/http_curl.C | 13 ++++++------- lib/proxy_info.C | 22 +++++----------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/checkin_notes b/checkin_notes index f3aa4ebe9f..59b17fda39 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4059,3 +4059,20 @@ David 19 Apr 2006 sched/ server_types.C + + +Walt 19 Apr 2006 + - Code cleanup: remove duplicate calls to xml_unescape. + - Bug Fix: Change HTTP redirect limit to 50 + - Bug Fix: Fix problems with socks5 proxys: + - Auth negotiation is handled by libcurl, remove that from BOINC + - Set connection timeouts to 20 seconds + *NOTE* Using socks5 proxies will cause BOINC to block until a + connection is made to the end server. BOINC will 'lock up' + until the connection attempt completes or times out. + + client/ + http_curl.C + lib/ + proxy_info.C + diff --git a/client/http_curl.C b/client/http_curl.C index 23603a78e3..3a158a8d4a 100644 --- a/client/http_curl.C +++ b/client/http_curl.C @@ -301,7 +301,7 @@ The checking this option controls is of the identity that the server claims. The // force curl to use HTTP/1.1 curlErr = curl_easy_setopt(curlEasy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); - curlErr = curl_easy_setopt(curlEasy, CURLOPT_MAXREDIRS, 5L); + curlErr = curl_easy_setopt(curlEasy, CURLOPT_MAXREDIRS, 50L); curlErr = curl_easy_setopt(curlEasy, CURLOPT_AUTOREFERER, 1L); curlErr = curl_easy_setopt(curlEasy, CURLOPT_FOLLOWLOCATION, 1L); @@ -701,18 +701,17 @@ void HTTP_OP::setupProxyCurl() { curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYPORT, (long) pi.socks_server_port); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.socks_server_name); + // libcurl uses blocking sockets with socks proxy, so limit timeout. + // - imlemented with local patch to libcurl + curlErr = curl_easy_setopt(curlEasy, CURLOPT_CONNECTTIMEOUT, 20L); if ( strlen(pi.socks5_user_passwd)>0 || strlen(pi.socks5_user_name)>0 ) { + auth_flag = false; sprintf(szCurlProxyUserPwd, "%s:%s", pi.socks5_user_name, pi.socks5_user_passwd); curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYUSERPWD, szCurlProxyUserPwd); - auth_flag = true; - if (auth_type) { - curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, auth_type); - } else { - curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_ANY); - } + curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_ANY); } } } diff --git a/lib/proxy_info.C b/lib/proxy_info.C index a71ef1077c..bc415cdaf2 100644 --- a/lib/proxy_info.C +++ b/lib/proxy_info.C @@ -33,7 +33,7 @@ using std::string; #include "proxy_info.h" int PROXY_INFO::parse(MIOFILE& in) { - char buf[256], buf2[1024]; + char buf[1024]; string s5un, s5up, hun, hup, temp; memset(this, 0, sizeof(PROXY_INFO)); @@ -47,22 +47,10 @@ int PROXY_INFO::parse(MIOFILE& in) { else if (parse_int(buf, "", socks_server_port)) continue; else if (parse_str(buf, "", http_server_name, sizeof(http_server_name))) continue; else if (parse_int(buf, "", http_server_port)) continue; - else if (parse_str(buf, "", buf2, 1024)) { - xml_unescape(buf2, socks5_user_name); - continue; - } - else if (parse_str(buf, "", buf2, 1024)) { - xml_unescape(buf2, socks5_user_passwd); - continue; - } - else if (parse_str(buf, "", buf2, 1024)) { - xml_unescape(buf2, http_user_name); - continue; - } - else if (parse_str(buf, "", buf2, 1024)) { - xml_unescape(buf2, http_user_passwd); - continue; - } + else if (parse_str(buf, "", socks5_user_name,sizeof(socks5_user_name))) continue; + else if (parse_str(buf, "", socks5_user_passwd,sizeof(socks5_user_passwd))) continue; + else if (parse_str(buf, "", http_user_name,sizeof(http_user_name))) continue; + else if (parse_str(buf, "", http_user_passwd,sizeof(http_user_passwd))) continue; } return ERR_XML_PARSE; }