diff --git a/backends/twitter/HTTPRequest.cpp b/backends/twitter/HTTPRequest.cpp index b2b0c1100e46eb059eb9d6d8d1310d83fff110ff..8518ce88dbf8151695e2cd538e50df9d1a7b4d5e 100644 --- a/backends/twitter/HTTPRequest.cpp +++ b/backends/twitter/HTTPRequest.cpp @@ -11,7 +11,7 @@ bool HTTPRequest::init() curl_easy_setopt(curlhandle, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); return true; } - LOG4CXX_ERROR(logger, "Couldn't Initialize curl!") + LOG4CXX_ERROR(logger, "Couldn't Initialize curl!"); return false; } @@ -25,47 +25,47 @@ void HTTPRequest::setProxy(std::string IP, std::string port, std::string usernam curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, proxyUserPass.c_str()); } } else { - LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized") + LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized"); } } int HTTPRequest::curlCallBack(char* data, size_t size, size_t nmemb, HTTPRequest* obj) { - int writtenSize = 0; - if(obj && data) { - obj->callbackdata.append(data, size*nmemb); - writtenSize = (int)(size*nmemb); - } - return writtenSize; + int writtenSize = 0; + if(obj && data) { + obj->callbackdata.append(data, size*nmemb); + writtenSize = (int)(size*nmemb); + } + return writtenSize; } -bool HTTPRequest::GET(std::string url, std::string &data) +bool HTTPRequest::GET(std::string url, std::string &data) { if(curlhandle) { curl_easy_setopt(curlhandle, CURLOPT_CUSTOMREQUEST, NULL); curl_easy_setopt(curlhandle, CURLOPT_ENCODING, ""); - + data = ""; callbackdata = ""; memset(curl_errorbuffer, 0, 1024); - + curl_easy_setopt(curlhandle, CURLOPT_ERRORBUFFER, curl_errorbuffer); curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, curlCallBack); curl_easy_setopt(curlhandle, CURLOPT_WRITEDATA, this); - + /* Set http request and url */ curl_easy_setopt(curlhandle, CURLOPT_HTTPGET, 1); -// curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1); +// curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1); curl_easy_setopt(curlhandle, CURLOPT_URL, url.c_str()); - + /* Send http request and return status*/ if(CURLE_OK == curl_easy_perform(curlhandle)) { data = callbackdata; return true; } } else { - LOG4CXX_ERROR(logger, "CURL not initialized!") + LOG4CXX_ERROR(logger, "CURL not initialized!"); strcpy(curl_errorbuffer, "CURL not initialized!"); } return false;