cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURL :: The headre len is not cleared between subsequent call s to curl_easy_perform()

From: Joel Schaubert <joel.schaubert_at_etrade.com>
Date: Wed, 6 Feb 2002 10:48:04 -0500

Daniel,
Thanks for the help!
We patched our 7.92 and retested and everything is working fine.

Great package, we love it.

Joel Schaubert
E*TRADE

-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Sunday, January 27, 2002 5:45 AM
To: Krishnendu Majumdar
Cc: libcurl Mailing list; Joel Schaubert
Subject: Re: CURL :: The headre len is not cleared between subsequent
calls to curl_easy_perform()

On Fri, 25 Jan 2002, Krishnendu Majumdar wrote:

> We are facing a problem though .
> Platform :: curl version 7.92 .
> OS :: SunOS 5.7
> We have a program like this ::

[snip]

> curl_easy_getinfo(*curl,CURLINFO_HEADER_SIZE,&(mem->header_len));
> printf( " THe HEADER LENGTH is %d\n",mem->header_len);

> The header len seems to be cumulatively adding up . The result looks like
::
> THE HEADER LENGTH is 100
> THE HEADER LENGTH is 200
> THE HEADER LENGTH is 300
> THE HEADER LENGTH is 400
> THE HEADER LENGTH is 500 .... for the same site .
>
> ** The way we have solved it for now , is to call curl_easy_init() and
> curl_easy_cleanup() each time .

Yes, this seems to be a bug. See the patch below.

> Though the header length is wrong in our test , there seems to be a
> significant performance gain in not calling curl_easy_init() all the time.

Yes, that's the encouraged way to do multiple requests. Re-use the same
handle as much as possible.

> We found some input in http://curl.haxx.se/mail/lib-2001-01/0021.html. But
> that was long back ( JAnuary 2001 ) . I was wondering whether this problem
> has already been solved .

That mail was posted before libcurl supported multiple requests on the same
handle without init/cleanup between so it doesn't apply any more.

Patch I think solves this problem:

RCS file: /cvsroot/curl/curl/lib/getinfo.c,v
retrieving revision 1.15
diff -u -r1.15 getinfo.c
--- getinfo.c 2001/11/20 15:00:50 1.15
+++ getinfo.c 2002/01/27 11:42:34
@@ -48,6 +48,8 @@
   info->httpcode = 0;
   info->httpversion=0;
   info->filetime=-1; /* -1 is an illegal time and thus means unknown */
+ info->header_size = 0;
+ info->request_size = 0;

   return CURLE_OK;
 }

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-02-06