cURL / Mailing Lists / curl-library / Single Mail


Re: problem with return value of curl_easy_getinfo

From: Daniel Stenberg <>
Date: Thu, 1 Sep 2005 22:42:40 +0200 (CEST)

On Thu, 1 Sep 2005, Milo? Zubal wrote:

> i am experiencing a problem when getting effective url...

Ok, I converted your program into a fully working source snippet. I get no
problems at all when I run this, neither with 7.14.0 or with the latest CVS
version. I also tried to disable the FOLLOWLOCATION (since in my case google
redirects me to when I run this).

Are you getting the same problem with this exact program?

#include <curl/curl.h>

int main(void)
   CURL *curl;
   CURLcode res;
   curl = curl_easy_init();
   if(curl) {
     curl_easy_setopt(curl, CURLOPT_URL, "");
     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) {
       return res;

     char* info = NULL;
     res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &info);
     if((CURLE_OK == res) && info) {
       printf("URL: %s\n", info);
   return 0;

  Commercial curl and libcurl Technical Support:
Received on 2005-09-01