curl-library
Re: CURL :: The headre len is not cleared between subsequent calls to curl_easy_perform()
Date: Sun, 27 Jan 2002 12:45:15 +0100 (MET)
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-01-27