curl-library
problem with return value of curl_easy_getinfo
Date: Thu, 01 Sep 2005 10:25:03 +0200 (CEST)
Hi,
i am experiencing a problem when getting effective url...
All i want to do is to get effective url without downloading
body. I get strange string in info variable after call to
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &info). Problem
is that this function return CURLE_OK while passing pointer to
strange data. Potentional hint could be that this "bug" occurs
only when passing url without path (i.e. http://www.google.com).
code looks this way:
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, url->BuildURI().GetData());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5);
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
#ifdef MYLOG
wxLogStatus("%s could not be resolved. Error code: %d",
url->BuildURI().c_str(), res); #endif // MYLOG
return RESOLVE_URL_FAILED;
}
char* info = NULL;
res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &info);
if((CURLE_OK == res) && info) {
url->Create(info);
}
debug output looks this way:
10:25:26: Status: resolving url: http://www.idnes.cz
10:25:26: Status: resolved to:
http://%80b%0f%01%98b%0f%01%e8*%0f%01
could anybody help me with this problem?
thanks in advance...
Miloš Zubal
Received on 2005-09-01