Requests icon indicating copy to clipboard operation
Requests copied to clipboard

Allow sub-second timeouts where feasible

Open siliconforks opened this issue 7 months ago • 1 comments

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:

  • [ ] I have added a code example showing how to use this feature to the examples directory.
  • [ ] I have added documentation about this feature to the docs directory. If the documentation is in a new markdown file, I have added a link to this new file to the Docs folder README.md file.

siliconforks avatar Jun 09 '25 13:06 siliconforks

The PR changes are working fine. I have created the related test report on https://core.trac.wordpress.org/ticket/63547#comment:17

pmbaldha avatar Aug 22 '25 09:08 pmbaldha