New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURLOPT_RESOLVE and nearly expired DNS Cache entries: replace old entry #2622

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@ajorajev

ajorajev commented May 30, 2018

We use CURLOPT_RESOLVE to tell Curl to use specific addresses instead of doing real DNS lookup.

when cached address is already there (saved by Curl internally) and close to expire, then by the time next http request is made, it can get expired.

Partial fix would be to mark existing entry as set by CURLOPT_RESOLVE (by setting timestamp to zero). This will keep this entry permanently in the cache as intended.

However, currently, if the cache entry already exists, CURLOPT_RESOLVE just leaves it, thus
an old address remains (while calling code expects new address to be saved).

Let's say that cURL already looked up "example.org" recently and found its IP address to be 1.1.1.1.
As usual, it's stored in the relevant DNS cache. Then, later, we issue a new request that uses the same DNS cache, and that 1.1.1.1 entry is still in the cache.

Then, if we do:
curl_easy_setopt(handle, CURLOPT_RESOLVE, [ "example.org:80:2.2.2.2" ]); and then issue the new request, we want this current request to use 2.2.2.2 as its IP

So it is best if we always override existing entries.

ajorajev and others added some commits May 30, 2018

Merge pull request #1 from curl/master
taking latest to my own fork
@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder May 30, 2018

Member

Thanks, try make checksrc to make sure there's no style warnings. The CI found this nit:

./unit1609.c:128:54: warning: sizeof without parenthesis (SIZEOFNOPAREN)
     int addressnum = sizeof tests[i].address / sizeof *tests[i].address;
                                                      ^
Member

bagder commented May 30, 2018

Thanks, try make checksrc to make sure there's no style warnings. The CI found this nit:

./unit1609.c:128:54: warning: sizeof without parenthesis (SIZEOFNOPAREN)
     int addressnum = sizeof tests[i].address / sizeof *tests[i].address;
                                                      ^
@ajorajev

This comment has been minimized.

Show comment
Hide comment
@ajorajev

ajorajev May 31, 2018

thanks, just fixed now, will always run "make checkrsc" from now on.

ajorajev commented May 31, 2018

thanks, just fixed now, will always run "make checkrsc" from now on.

Show outdated Hide outdated .gitignore
Alibek.Jorajev
removing DS_Store from .gitignore, it turned out that gitignore conta…
…ins wildcards related to Curl build, not local OS
@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Jun 1, 2018

Member

Thanks!

Member

bagder commented Jun 1, 2018

Thanks!

@bagder bagder closed this in f66d97b Jun 1, 2018

@ajorajev

This comment has been minimized.

Show comment
Hide comment
@ajorajev

ajorajev Jun 1, 2018

thank you too.

ajorajev commented Jun 1, 2018

thank you too.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 30, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.