curl-library
Re: libcurl
Date: Mon, 28 Jan 2002 19:37:51 +0100 (MET)
On Mon, 28 Jan 2002, Giaslas Georgios wrote:
(I think this is better dealt with on the libcurl list than on the main curl
list on which this was posted, as this is very much internals and libcurl
interface talk. CC'ed this way.)
Thanks for your insights. Comments follow inlined below:
> 1) i have developed a program with libcurl 7.9.2 and it worked fine, but
> when i upgraded to version 7.9.3 i get a segmentation fault when i execute
> curl_easy_perform(). I don't have changed anyhing to my source code.
You're not the first to report something like this. I am grateful for all
clues you can offer in regard to where this happens, when and what I need to
do to repeat it.
OS and versions are very important too. I currenly investigate a bug I can
only see on a IPv4-only linux (IPv6-linux and IPv4-Solaris both run fine).
I have no real clue yet, as to what is happening. It would be interesting to
know if you see the same bug or another one.
> 2) a nice feature that doesn't exist (yet?) is to get the content-type of
> the downloaded object with curl_easy_getinfo(). i have already patched the
> libcurl source to do that so if you want i can send you the path.
I would be happy to add that feature. Just make sure the memory for the
content-type string is properly allocated and freed.
> 3) when i set the option CURLOPT_FAILONERROR on, there is a problem
> sometimes. For example, if i request the URL:
>
> http://uk.adserver.yahoo.com/a?f=150508014:LREC&p=mail_ukie&
> l=LREC&c=hm&bg=ffffff&site-country=uk&t=1003662209
>
> via a proxy (Microsoft ISA) it returns to me HTTP 404 Not Found and
> immediately the proxy closes the connection.
> The library then, returns from the Curl_readwrite() function without
> setting the size of the header (conn->headerbytecount). Transfer() returns
> also with the error code CURL_HTTP_NOT_FOUND.Then, when Curl_done() is
> called within Curl_perform() it calls curl_http_done and returns
> CURL_GOT_NOTHING since the size of the header is zero. Next, at
> url.c, line 2317
> the check:
>
> if (data->set.reuse_forbid || ((CURLE_OK == result) && conn->bits.close))
>
> fails, since 'result' is CURL_GOT_NOTHING, and the connection to the
> proxy doesn't close.
> So, if libcurl reuses the connection to the proxy, ALL the subsequent
> requests fail. libcurl doesn't understand that the proxy has closed the
> connection in order to make a new one, and tries to send the requests over
> it and of course all of them fail returning "Failed to send request".
Isn't the solution here just to set the headerbytecount just before bailing
out when the 404 is received?
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-01-28