[#1303] reports an issue (now fixed) where libcurl would prune CURLOPT_RESOLVE entries after the DNS cache timeout had elapsed.
It looks like the patch is not complete, though. As of version 7.34.1-dev entries are still being incorrectly removed in the following scenario:
The attached program is basically the same one attached to bug report [#1303], except it connects to a server which keeps the connection alive for a short time (debian.org), instead of the other one, which always signaled the client to close it.
Here's the output:
Test started with libcurl/7.34.1-DEV OpenSSL/1.0.1e zlib/1.2.8 libidn/1.28 librtmp/2.3 debug: Added fake.host:80:150.203.164.38 to DNS cache debug: Rebuilt URL to: http://fake.host/ debug: Hostname was found in DNS cache debug: Trying 150.203.164.38... debug: Connected to fake.host (150.203.164.38) port 80 (#0) debug: Server Apache is not blacklisted debug: Connection #0 to host fake.host left intact HTTP transfer completed with status 0 Sleeping for 20 seconds... debug: Added fake.host:80:150.203.164.38 to DNS cache debug: Rebuilt URL to: http://fake.host/ debug: Found bundle for host fake.host: 0xcacc20 debug: Connection 0 seems to be dead! debug: Closing connection 0 debug: Hostname was NOT found in DNS cache debug: getaddrinfo(3) failed for fake.host:80 debug: Couldn't resolve host 'fake.host' debug: Closing connection 1 HTTP transfer completed with status 6
Proposed fix: https://github.com/bagder/curl/pull/88
Lovely, thanks. Have you tried writing up a test case that repeats the problem and verifies the fix?
Daniel, I remember I invested a short time trying to write one when I reported [#1303] and couldn't figure out how to do it. I'll give it another try as soon as I find free time.
Related
Bugs:
#1303What do you think is more appropriate here, a "unit" test or a "libtest"?
I would think that a full libtest is easier to mimic the exact case you explained in this bug report, even though I guess single functions could benefit from unit tests as well!
Thanks, your patch has been merged and pushed. I would still be very glad to see a test for this and I can also help with that. Would you like this issue to be held open as a reminder of that or not?
Keep it open. Thanks.
Daniel, I've written tests to reproduce the bug: https://github.com/bagder/curl/pull/89 . You can close the ticket now.
Thanks, merged and this case is closed!