httpcomponents-client icon indicating copy to clipboard operation
httpcomponents-client copied to clipboard

[HTTPCLIENT-2178] Implement Happy Eyeballs V2 (RFC 8305)

Open arturobernalg opened this issue 5 months ago • 8 comments

This pull request introduces a minimal implementation of Happy Eyeballs Version 2 (RFC 8305) for the asynchronous client connection operator in Apache HttpComponents Client 5.x. It focuses on a simple, straightforward approach to dual-stack (IPv6/IPv4) address resolution and staggered connection attempts, while integrating a basic RFC 6724 address selection mechanism.

Key highlights:

  • Minimal RFC 6724 Support: Implements essential rules for address sorting (e.g., precedence, scope, label matching, longest prefix), with source address discovery via UDP probes. Non-critical rules (e.g., deprecated addresses, home addresses) are marked as TODO for future enhancements.

  • Staggered Connections: Uses a single-threaded ScheduledExecutorService for delaying connection attempts (default: 250ms), ensuring compliance with RFC 8305's latency minimization without unnecessary complexity.

  • Integration: Easily configurable via PoolingAsyncClientConnectionManagerBuilder.setConnectionOperator(). Includes shutdown methods for resource management.

arturobernalg avatar Jul 30 '25 15:07 arturobernalg

@rschmitt Could you please take a look at this PR as you are the requester of this feature?

ok2c avatar Aug 03 '25 15:08 ok2c

This is still on my to-do list, I'll get to it when I can.

rschmitt avatar Aug 11 '25 18:08 rschmitt

@ok2c What do you think of the idea of upgrading the existing MultihomeConnectionInitiator/MultihomeIOSessionRequester to support the RFC 8305 connection algorithm?

rschmitt avatar Aug 12 '25 05:08 rschmitt

@ok2c What do you think of the idea of upgrading the existing MultihomeConnectionInitiator/MultihomeIOSessionRequester to support the RFC 8305 connection algorithm?

@arturobernalg @rschmitt I am very much in favor of splitting the change-set into several smaller ones starting with MultihomeConnectionInitiator/MultihomeIOSessionRequester.

ok2c avatar Aug 12 '25 10:08 ok2c

all right @rschmitt .. i do the changes

arturobernalg avatar Aug 13 '25 09:08 arturobernalg

@rschmitt please give another change to the PR

arturobernalg avatar Aug 14 '25 14:08 arturobernalg

@rschmitt @ok2c can we merge the minimal path (staggered multihome + config flag) as experimental and iterate on the rest?

arturobernalg avatar Oct 10 '25 17:10 arturobernalg

@arturobernalg This feature was requested by @rschmitt and do not think i need to get involved unless absolutely necessary. I suppose if one cannot get a complex feature through a review, splitting it into smaller change-sets is the best thing to do.

ok2c avatar Oct 11 '25 10:10 ok2c