diff --git a/backends/twitter/Requests/ProfileImageRequest.h b/backends/twitter/Requests/ProfileImageRequest.h index 1f4e8b4eb634d02db365f038a4dd0af007a9ed45..1a1721174ef04de8150d0a5e4d0dffc9c2ca7308 100644 --- a/backends/twitter/Requests/ProfileImageRequest.h +++ b/backends/twitter/Requests/ProfileImageRequest.h @@ -2,7 +2,6 @@ #define PROFILEIMAGE_H #include "../ThreadPool.h" -#include "../libtwitcurl/curl/curl.h" #include "../TwitterResponseParser.h" #include "transport/logging.h" #include "transport/config.h" @@ -25,49 +24,27 @@ class ProfileImageRequest : public Thread unsigned int reqID; boost::function< void (std::string&, std::string&, std::string&, int, std::string&) > callBack; + std::string ip, port, puser, ppasswd; bool success; - CURL *curlhandle; - + std::string error; std::string callbackdata; - char curl_errorbuffer[1024]; - bool fetchImage(); - static int curlCallback( char* data, size_t size, size_t nmemb, ProfileImageRequest *obj); public: ProfileImageRequest(Config *config, const std::string &_user, const std::string &_buddy, const std::string &_url, unsigned int _reqID, boost::function< void (std::string&, std::string&, std::string&, int, std::string&) > cb) { - - curlhandle = curl_easy_init(); - curl_easy_setopt(curlhandle, CURLOPT_PROXY, NULL); - curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, NULL); - curl_easy_setopt(curlhandle, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); - /************ Set proxy if available *****************************************/ if(CONFIG_HAS_KEY(config,"proxy.server")) { - std::string ip = CONFIG_STRING(config,"proxy.server"); + ip = CONFIG_STRING(config,"proxy.server"); std::ostringstream out; out << CONFIG_INT(config,"proxy.port"); - std::string port = out.str(); - - std::string puser = CONFIG_STRING(config,"proxy.user"); - std::string ppasswd = CONFIG_STRING(config,"proxy.password"); - - if(ip != "localhost" && port != "0") { - /* Set proxy details in cURL */ - std::string proxyIpPort = ip + ":" + port; - curl_easy_setopt(curlhandle, CURLOPT_PROXY, proxyIpPort.c_str()); + port = out.str(); - /* Prepare username and password for proxy server */ - if(puser.length() && ppasswd.length()) { - std::string proxyUserPass = puser + ":" + ppasswd; - curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, proxyUserPass.c_str()); - } - } + puser = CONFIG_STRING(config,"proxy.user"); + ppasswd = CONFIG_STRING(config,"proxy.password"); } - /*****************************************************************************/ user = _user; buddy = _buddy; @@ -77,10 +54,6 @@ class ProfileImageRequest : public Thread } ~ProfileImageRequest() { - if(curlhandle) { - curl_easy_cleanup(curlhandle); - curlhandle = NULL; - } } void run();