return false;
}
+bool CCurlFile::GetCookies(const CURL &url, std::string &cookies)
+{
+ std::string cookiesStr;
+ struct curl_slist* curlCookies;
+ XCURL::CURL_HANDLE* easyHandle;
+ XCURL::CURLM* multiHandle;
+
+ // get the cookies list
+ g_curlInterface.easy_aquire(url.GetProtocol(), url.GetHostName(), &easyHandle, &multiHandle);
+ if (CURLE_OK == g_curlInterface.easy_getinfo(easyHandle, CURLINFO_COOKIELIST, &curlCookies))
+ {
+ // iterate over each cookie and format it into an RFC 2109 formatted Set-Cookie string
+ struct curl_slist* curlCookieIter = curlCookies;
+ while(curlCookieIter)
+ {
+ // tokenize the CURL cookie string
+ std::vector<std::string> valuesVec;
+ StringUtils::Tokenize(curlCookieIter->data, valuesVec, "\t");
+
+ // ensure the length is valid
+ if (valuesVec.size() < 7)
+ {
+ CLog::Log(LOGERROR, "CCurlFile::GetCookies - invalid cookie: '%s'", curlCookieIter->data);
+ continue;
+ }
+
+ // create a http-header formatted cookie string
+ std::string cookieStr = valuesVec[5] + "=" + valuesVec[6] +
+ "; path=" + valuesVec[2] +
+ "; domain=" + valuesVec[0];
+
+ // append this cookie to the string containing all cookies
+ if (!cookiesStr.empty())
+ cookiesStr += "\n";
+ cookiesStr += cookieStr;
+
+ // move on to the next cookie
+ curlCookieIter = curlCookieIter->next;
+ }
+
+ // free the curl cookies
+ g_curlInterface.slist_free_all(curlCookies);
+
+ // release our handles
+ g_curlInterface.easy_release(&easyHandle, &multiHandle);
+
+ // if we have a non-empty cookie string, return it
+ if (!cookiesStr.empty())
+ {
+ cookies = cookiesStr;
+ return true;
+ }
+ }
+
+ // no cookies to return
+ return false;
+}
+
int CCurlFile::IoControl(EIoControl request, void* param)
{
if(request == IOCTRL_SEEK_POSSIBLE)