Allow sub-second timeouts where feasible
This implements the suggestion made in #264 to check for CURL_VERSION_ASYNCHDNS to determine whether timeouts of less than 1 second will work.
See also: https://core.trac.wordpress.org/ticket/63547
Pull Request Type
- [x] I have checked there is no other PR open for the same change.
This is a:
- [x] Bug fix
- [ ] New feature
- [ ] Documentation improvement
- [ ] Code quality improvement
Context
The goal is to allow timeouts of less than one second on systems where this is feasible. This might not be possible for all systems, but it should be achievable for on machines with cURL which has been built with support for asynchronous DNS lookups.
Detailed Description
This PR simply adds the check for CURL_VERSION_ASYNCHDNS previously discussed in #264, to allow timeouts of less than 1 second on systems where this will work, i.e., those not using the (synchronous) system resolver.
Note that the conversation in #264 went on to discuss some other things, which this PR does not attempt to address. This PR only adds the check for CURL_VERSION_ASYNCHDNS.
Quality assurance
- [x] This change does NOT contain a breaking change (fix or feature that would cause existing functionality to change).
- [x] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have added unit tests to accompany this PR.
- [x] The (new/existing) tests cover this PR 100%.
- [x] I have (manually) tested this code to the best of my abilities.
- [x] My code follows the style guidelines of this project.
Documentation
For new features:
The PR changes are working fine. I have created the related test report on https://core.trac.wordpress.org/ticket/63547#comment:17