Commit de2bacab authored by David Anderson's avatar David Anderson

- boinccmd: fix bug in --set_proxy_settings command

    (it wasn't setting the "use_XXX" flags).  Fixes #776
- client: you can now include a <proxy_info> element
    in your cc_config.xml options.

TODO: the whole proxy info thing needs an overhaul:
- no separate "use_XXX" flags;
    non-empty http_server_name implies using HTTP proxy, etc.
- merge PROXY_INFO and GR_PROXY_INFO classes
- use XML_PARSER for parsing
- no PROXY_INFO element in HTTP_OP; just use gstate.proxy_info

svn path=/trunk/boinc/; revision=17379
parent 93d13daa
......@@ -2009,3 +2009,23 @@ David 25 Feb 2009
client_state.cpp
main.cpp
scheduler_op.cpp
David 25 Feb 2009
- boinccmd: fix bug in --set_proxy_settings command
(it wasn't setting the "use_XXX" flags). Fixes #776
- client: you can now include a <proxy_info> element
in your cc_config.xml options.
TODO: the whole proxy info thing needs an overhaul:
- no separate "use_XXX" flags;
non-empty http_server_name implies using HTTP proxy, etc.
- merge PROXY_INFO and GR_PROXY_INFO classes
- use XML_PARSER for parsing
- no PROXY_INFO element in HTTP_OP; just use gstate.proxy_info
client/
boinc_cmd.cpp
http_curl.cpp
lib/
parse.h
proxy_info.cpp
......@@ -347,6 +347,9 @@ int main(int argc, char** argv) {
pi.socks5_user_name = next_arg(argc, argv, i);
pi.socks5_user_passwd = next_arg(argc, argv, i);
pi.noproxy_hosts = next_arg(argc, argv, i);
if (pi.http_server_name.size()) pi.use_http_proxy = true;
if (pi.http_user_name.size()) pi.use_http_authentication = true;
if (pi.socks_server_name.size()) pi.use_socks_proxy = true;
retval = rpc.set_proxy_settings(pi);
} else if (!strcmp(cmd, "--get_messages")) {
int seqno = atoi(next_arg(argc, argv, i));
......
......@@ -830,7 +830,8 @@ void HTTP_OP::setupProxyCurl(bool no_proxy) {
// CMC Note: the string szCurlProxyUserPwd must remain in memory
// outside of this method (libcurl relies on it later when it makes
// the proxy connection), so it has been placed as a member data for HTTP_OP
memset(szCurlProxyUserPwd,0x00,128);
//
strcpy(szCurlProxyUserPwd, "");
if (no_proxy) {
curlErr = curl_easy_setopt(curlEasy,CURLOPT_PROXY,"");
......@@ -847,7 +848,7 @@ void HTTP_OP::setupProxyCurl(bool no_proxy) {
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXY, (char*) pi.http_server_name);
if (pi.use_http_auth) {
if (config.force_auth == "basic") {
if (config.force_auth == "basic") {
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
} else if (config.force_auth == "digest") {
curlErr = curl_easy_setopt(curlEasy, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST);
......@@ -863,7 +864,9 @@ void HTTP_OP::setupProxyCurl(bool no_proxy) {
}
} else {
if (pi.use_socks_proxy) {
//pi.socks_version -- picks between socks5 & socks4 -- but libcurl only socks5!
// pi.socks_version selects between socks5 & socks4.
// But libcurl only supports socks5, so ignore it.
//
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);
......
......@@ -266,6 +266,10 @@ int CONFIG::parse_options(XML_PARSER& xp) {
gstate.abort_jobs_on_exit = true;
continue;
}
if (!strcmp(tag, "proxy_info")) {
int retval = gstate.proxy_info.parse(*xp.f);
if (retval) return retval;
}
msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n",
CONFIG_FILE, tag
);
......
......@@ -38,12 +38,12 @@ int finite(double);
#include "miofile.h"
class XML_PARSER {
MIOFILE* f;
bool scan_nonws(int&);
int scan_comment();
int scan_tag(char*, int, char* ab=0, int al=0);
bool copy_until_tag(char*, int);
public:
MIOFILE* f;
XML_PARSER(MIOFILE*);
bool get(char*, int, bool&, char* ab=0, int al=0);
bool parse_start(const char*);
......
......@@ -38,9 +38,9 @@ int PROXY_INFO::parse(MIOFILE& in) {
memset(this, 0, sizeof(PROXY_INFO));
while (in.fgets(buf, 256)) {
if (match_tag(buf, "</proxy_info>")) return 0;
else if (match_tag(buf, "<use_http_proxy/>")) use_http_proxy = true;
else if (match_tag(buf, "<use_socks_proxy/>")) use_socks_proxy = true;
else if (match_tag(buf, "<use_http_auth/>")) use_http_auth = true;
else if (parse_bool(buf, "use_http_proxy", use_http_proxy)) continue;
else if (parse_bool(buf, "use_socks_proxy", use_socks_proxy)) continue;
else if (parse_bool(buf, "use_http_auth", use_http_auth)) continue;
else if (parse_int(buf, "<socks_version>", socks_version)) continue;
else if (parse_str(buf, "<socks_server_name>", socks_server_name, sizeof(socks_server_name))) continue;
else if (parse_int(buf, "<socks_server_port>", socks_server_port)) continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment