Merge pull request #172 from knu/do_not_send_proxy_info

Do not send proxy info to external services
This commit is contained in:
John Reese 2015-09-21 14:31:00 -07:00
commit 4bb45ac3e7
1 changed files with 11 additions and 12 deletions

View File

@ -75,7 +75,9 @@ class CPushSocket : public CSocket
// forward declaration // forward declaration
CURLcode make_curl_request(const CString& service_host, const CString& service_url, CURLcode make_curl_request(const CString& service_host, const CString& service_url,
const CString& service_auth, MCString& params, int port, const CString& service_auth, MCString& params, int port,
bool use_ssl, bool use_post, bool debug); bool use_ssl, bool use_post,
const CString& proxy, bool proxy_ssl_verify,
bool debug);
#endif // USE_CURL #endif // USE_CURL
/** /**
@ -663,9 +665,7 @@ class CPushMod : public CModule
#ifdef USE_CURL #ifdef USE_CURL
PutDebug("using libcurl"); PutDebug("using libcurl");
params["proxy"] = options["proxy"]; make_curl_request(service_host, service_url, service_auth, params, use_port, use_ssl, use_post, options["proxy"], options["proxy_ssl_verify"] != "no", options["debug"] == "on");
params["proxy_ssl_verify"] = options["proxy_ssl_verify"];
make_curl_request(service_host, service_url, service_auth, params, use_port, use_ssl, use_post, options["debug"] == "on");
#else #else
PutDebug("NOT using libcurl"); PutDebug("NOT using libcurl");
// Create the socket connection, write to it, and add it to the queue // Create the socket connection, write to it, and add it to the queue
@ -1714,11 +1714,8 @@ class CPushMod : public CModule
return; return;
} }
params["proxy"] = options["proxy"];
params["proxy_ssl_verify"] = options["proxy_ssl_verify"];
#ifdef USE_CURL #ifdef USE_CURL
make_curl_request(service_host, service_url, service_auth, params, use_port, use_ssl, use_post, options["debug"] == "on"); make_curl_request(service_host, service_url, service_auth, params, use_port, use_ssl, use_post, options["proxy"], options["proxy_ssl_verify"] != "no", options["debug"] == "on");
#else #else
// Create the socket connection, write to it, and add it to the queue // Create the socket connection, write to it, and add it to the queue
CPushSocket *sock = new CPushSocket(this); CPushSocket *sock = new CPushSocket(this);
@ -1805,7 +1802,9 @@ CString build_query_string(MCString& params)
*/ */
CURLcode make_curl_request(const CString& service_host, const CString& service_url, CURLcode make_curl_request(const CString& service_host, const CString& service_url,
const CString& service_auth, MCString& params, int port, const CString& service_auth, MCString& params, int port,
bool use_ssl, bool use_post, bool debug) bool use_ssl, bool use_post,
const CString& proxy, bool proxy_ssl_verify,
bool debug)
{ {
CURL *curl; CURL *curl;
CURLcode result; CURLcode result;
@ -1843,10 +1842,10 @@ CURLcode make_curl_request(const CString& service_host, const CString& service_u
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, query.length()); curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, query.length());
} }
if (params["proxy"] != "") { if (proxy != "") {
curl_easy_setopt(curl, CURLOPT_PROXY, params["proxy"].c_str()); curl_easy_setopt(curl, CURLOPT_PROXY, proxy.c_str());
if (params["proxy_ssl_verify"] == "no") { if (!proxy_ssl_verify) {
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
} }
} }