cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [patch] libcurl 7.12.2-20040917 and CURLOPT_VERBOSE may read free()ed data

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 29 Sep 2004 14:10:15 +0200 (CEST)

On Wed, 29 Sep 2004, Bertrand Demiddelaer wrote:

>> I fail to understand how that is possible. Unless the connection is told to
>> get closed, you don't call resolv_unlock() for that dns entry. Why isn't
>> that entry then remaining locked?
>
> That's exactly what I want: a resolv_unlock() call when the connection is
> closed.

That's what I want too. And that's why I think the resolv_unlock() call should
be moved to Curl_disconnect() and called unconditionally from within it.

Curl_disconnect() is called when the connection is to be disconnected. That
happens after all requests are done on that connection.

You made the call to resolv_unlock() conditional on a condition that may not
happen and thus you may not unlock the dns_entry and therefor it might be left
"locked". Do you agree or disagree with me on this analysis?

> You are right to notice that a side effect of this new behaviour is that
> entries in dns cache can remain valid longer,

I don't have a problem with the entries being kept longer, I think it makes
sense to have them kept while there are still live connections against the
host.

> they finally get pruned when every connection using them is closed.

Only if the final request on that connection gets a "Connection: close", which
you cannot be sure will happen.

Or am I wrong?

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