Problem Description
A dns lookup for an improperly set up project could return both ipv6 and ipv4 addresses but with the first one that isn't actually working.
The current behaviour of the proxy is to timeout on the connection and then retry on the ipv4 address, this takes around 4-5 minutes~ while the proxy looks to just be hanging.
An example of service with this issue can be tested with these commands on the terminal:
time curl -4 https://tvspix.com/t.png -o /dev/null
time curl -6 https://tvspix.com/t.png -o /dev/null <---- hangs
Proposal
I would propose to use the same algorithm that browsers use called happy eyeballs where both connections are made (one after a small delay) and the proxy using the one that replies first.
The support for this has been added in python in loop.create_connection with the happy_eyeballs_delay argument.
According to the RFC a sensible default would be 250 milliseconds.
Alternatives
N/A
Additional context
The file to change to make this possible would be in mitmproxy/proxy/server.py in line 211~
if command.connection.transport_protocol == "tcp":
reader, writer = await asyncio.open_connection(
*command.connection.address,
local_addr=command.connection.sockname,
happy_eyeballs_delay=0.25, ## <------- add support for the happy eyeballs algorithm
)
Problem Description
A dns lookup for an improperly set up project could return both
ipv6andipv4addresses but with the first one that isn't actually working.The current behaviour of the proxy is to timeout on the connection and then retry on the
ipv4address, this takes around 4-5 minutes~ while the proxy looks to just be hanging.An example of service with this issue can be tested with these commands on the terminal:
Proposal
I would propose to use the same algorithm that browsers use called
happy eyeballswhere both connections are made (one after a small delay) and the proxy using the one that replies first.The support for this has been added in python in loop.create_connection with the
happy_eyeballs_delayargument.According to the RFC a sensible default would be 250 milliseconds.
Alternatives
N/A
Additional context
The file to change to make this possible would be in
mitmproxy/proxy/server.pyin line 211~