-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
web: Add IPv6 support #1176
web: Add IPv6 support #1176
Conversation
As soon as yesodweb/wai-handlers#2 merges and is available, we can switch to @simonmichael I'm not used to the tooling. Do I need to add a constraint for |
@Amarandus yes, you'll change |
As yesodweb/wai-handlers#2 is now merged, I tried updating the In the meantime, I checked whether IPv4-mapped addresses work, and this is the case:
|
Hopefully not. stack will pull newer versions of deps from hackage when it needs to. If you're seeing an error while testing stack install in master, maybe I can help. |
This commit introduces IPv6 support (and thus closes simonmichael#1145). It also allows using local hostnames as a parameter for --host. For this, multiple things needed to be changed: - checkWebOpts is dropped, as the supplied parameter is checked later by Network.Socket.getAddrInfo - defbaseurl needs to check if : is used in the host, as this indicates the usage of an IPv6 address. In this case, the host needs to be wrapped in [] for the base URL - To allow opening such a modified base URL, runHostPortFullUrl is used instead of runhostPortUrl, as it allows opening arbitrary URLs instead of a path prefixed with http://127.0.0.1 As checking the host for validity is postponed until the webserver tries to start, an invalid hostname leads to an exception caused by Network.Socket.getAddrInfo. This is still fine, as hledger-web won't start in an undefined state, but will terminate with a nonzero exit code.
018359a
to
4525caf
Compare
Thanks! |
Motivation
This PR closes #1145. It allows
hledger-web
to be reachable over IPv6, e.g. by calling it likeChanges
--host
validation inhledger-web/Hledger/Web/WebOptions.hs
to allow IPv6 addresses[
and]
if an IPv6 address is used (required for proper IPv6-URLs in the browser)Problems
Network.Wai.Handler.Launch.runHostPortUrl
uses the hardcoded host127.0.0.1
to launch the browser. Until there is a solution for Hard-coded IPv4 address makes IPv6 usage inconvenient yesodweb/wai-handlers#1, this PR should probably not be merged, as the server is not reachable over the URL that is opened--serve
is used.