for work reasons, I used the strace command to track the whole process of curl and wget requests, and the conclusion about DNS domain name resolution is as follows. Some of them do not understand, and the source code does not understand (operation and maintenance one), please give assistance, thank you!
assume that the total domain name is test.domain.com, and DNS is configured with 2 A records
Test commands:
strace curl-v test.domain.com
strace wget test.domain.com
my conclusion:
(1) curl is implemented through libcurl cross-platform database. I don"t understand how or how curl changes from domain name to IP address. However, curl is used to request many times. From the result of strace, it does not poll the IP address that requests two A records.
(2) compared with curl, a wget request spends a lot of time on domain name resolution. In the case of finding hosts files in vain, obtain all ip addresses by parsing in a dig-like way and select one of them to request data, and test many times. The result: it can poll and use DNS parsed (2 A record IP) to request resources.
my question:
I want to learn more about the principles of curl and wget (especially curl) about DNS domain name resolution