cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE : get several pages instead of one with cookies

From: Ilann Cohen <ilann_at_ilann.net>
Date: Sat, 11 Dec 2004 14:22:00 +0100

OK it works, thanks again for your help Daniel, I indeed didn't clean
the curl buffer before performing a page fetch. At the beginning of my
perform function, I added the following code:

    if (mem->memory)
    {
        free(mem->memory);
    }
    mem->size = 0;
    mem->memory = NULL;

It works perfectly now !

ilann

-----Message d'origine-----
De : curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] De la part de Daniel Stenberg
Envoyé : samedi 11 décembre 2004 12:16
À : libcurl development
Objet : Re: get several pages instead of one with cookies

On Sat, 11 Dec 2004, Ilann Cohen wrote:

> [curl/libcurl v7.11.1 on a Windows i686 with Cygwin system]

7.11.1 is pretty old. Consider updating.

> It works fine, except that when I fetch page 2, I get pages 1 to 2,
when I
> fetch page 3, I get pages 1 to 3 etc. I mean that libcurl returns a
buffer
> containing all previous pages, concatenated to each other !!

That's not what libcurl does. It is your code that appends the contents
of
page 2 to to the contents of page 1.

Based on your snippet, it looks like a modified getinmemory.c example
where
you don't reset things in between the requests.

> What's going on when you call curl_easy_setopt(curl_handle,
CURLOPT_URL,
> url_name) several times with the same handle ?

Every time you set CURLOPT_URL, it clears the previous setting and
stores the
new one you provide. Setting it multiple times before you call
curl_easy_perform() would only be stupid.

> Do I have to clean something before setting a new url ?

No.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-11