cURL / Mailing Lists / curl-library / Single Mail

curl-library

Seg fault with FOLLOWLOCATION turns on

From: Evan Tsang <evan_at_redswoosh.com>
Date: Thu, 5 Jul 2001 23:47:24 -0700

This is basically the example persistant.c
change both URLs to "http://www.sourceforge.net/"
and add curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
The code seg fault in Curl_perform() on the second call.
Did I misunderstand how to use the library?
I am using libcurl 7.8 on Linux.

----
Evan
----------------------------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
/* This example REQUIRES libcurl 7.7 or later */
#if (LIBCURL_VERSION_NUM < 0x070700)
#error Too old libcurl version, upgrade or stay away.
#endif
int main(int argc, char **argv)
{
  CURL *curl;
  CURLcode res;
#ifdef MALLOCDEBUG
  /* this sends all memory debug messages to a specified logfile */
  curl_memdebug("memdump");
#endif
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl, CURLOPT_HEADER, 1);
    /* get the first document */
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.sourceforge.net/");
    res = curl_easy_perform(curl);
    /* get another document from the same server using the same
       connection */
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.sourceforge.net/");
    res = curl_easy_perform(curl);
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}
_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-07-06