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

HostPreference not binding correctly for !6 and * special values #78

Open
laurenceisla opened this issue Feb 22, 2024 · 1 comment
Open

Comments

@laurenceisla
Copy link

We stumbled with this problem via Warp and opened an issue there: yesodweb/wai#976 (comment). But the problem was with how HostPreference was behaving which is defined in this project.

I'll copy the issue here:

Issue

When setting a !6 host preference it does not seem to bind to ipv6 exclusively, because ipv4 requests do not fail. Also, when setting the preference to *, ipv6 requests fail when they shouldn't.

I included a simple example with Warp in this Gist: https://gist.github.com/laurenceisla/61af763fb028437f24e5a869225eb1f8

These are the results I got:

It allows both ipv4 and ipv6 requests when setHost !6

$ curl "http://localhost:3000" --ipv4 -I
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Thu, 08 Feb 2024 01:19:54 GMT
Server: Warp/3.4.0
Content-Type: text/plain

It does not allow ipv6 requests when setHost *

$ curl "http://localhost:3000" --ipv6 -I
curl: (7) Failed to connect to localhost port 3000 after 0 ms: Couldn't connect to server

setHost !4 working as expected

$ curl "http://localhost:3000" --ipv6 -I
curl: (7) Failed to connect to localhost port 3000 after 0 ms: Couldn't connect to server
@laurenceisla
Copy link
Author

Here are more detailed results on how the HostPreference is behaving:

yesodweb/wai#976 (comment)

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

1 participant