Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 support #586

Open
netmilk opened this issue Aug 2, 2016 · 4 comments
Open

IPv6 support #586

netmilk opened this issue Aug 2, 2016 · 4 comments

Comments

@netmilk
Copy link
Contributor

netmilk commented Aug 2, 2016

Dredd is resolving hostnames always to the IPv4 address. When the backend is listening on IPv6 localhost ::1 and Dredd's server parameter is a hostname http://localhost:3000 the hostname is resolved to the IPv4 address 127.0.0.1 and all tests will fail with ECONNREFUSED:

error: Error connecting to server under test!

Some servers in some constellations are listening on the IPv6 only by default. The workaround solution is to force them to listen on the IPv4 localhost with some equivalent of:

rails server --binding=127.0.0.1
@philsturgeon
Copy link

🙌

@netmilk
Copy link
Contributor Author

netmilk commented Aug 4, 2016

The reasoning why this is happening: https://groups.google.com/forum/#!topic/nodejs/0W6UqKy_klk

@netmilk
Copy link
Contributor Author

netmilk commented Aug 4, 2016

I just realised this could be similar to this very old and closed issue: #126

@honzajavorek
Copy link
Contributor

Could we do some kind of fallbacking and try/catching?

  1. If Dredd gets a string localhost, it resolves it automatically to ::1 and tries to connect.
  2. If ::1 fails to connect, Dredd tries 127.0.0.1.
  3. If 127.0.0.1 fails to connect, then just pass localhost to the system and let it resolve ¯\_(ツ)_/¯

But that brings quite some overhead of reconnecting. This would have to happen just once, in the beginning, and then Dredd would need to respect the selected strategy for the rest of the requests.

Also, this could be an option:

  1. If localhost is given to Dredd, let the system to resolve it.
  2. If Dredd gets ECONNREFUSED, then try again with ::1 instead of localhost.

Again, Dredd would remember the selected strategy for all requests within the test run.

qdot added a commit to buttplugio/buttplug-js that referenced this issue Mar 8, 2019
Sometimes name resolution can get weird (looking at you, macOS), so
it's easier to just set 127.0.0.1 as the local address. See
apiaryio/dredd#586.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants