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

feat(wai-handler-launch): Add function to launch arbitrary URLs #2

Merged
merged 2 commits into from
Jan 16, 2020

Conversation

CRTified
Copy link
Contributor

@CRTified CRTified commented Jan 15, 2020

This commit adds the function runHostPortFullUrl to allow launching
arbitrary URLs instead of the hardcoded base http://127.0.0.1.
It allows using ::1 as the host IP address, while launching http://[::1]/,
where the additional brackets are required to access IPv6 IPs from the browser.

As the generation of the default URL is moved into runHostPortUrl, both the C launch
function and the Haskell launch function can be reduced to (C)String -> IO ()
without breaking backwards compability.

This closes #1

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Todo

  • Check for functionality on Windows systems

This commit adds the function runHostPortFullUrl to allow launching
arbitrary URLs instead of the hardcoded base http://127.0.0.1.
It allows using ::1 as the host IP address, while launching http://[::1]/,
where the additional brackets are required to access IPv6 IPs from the browser.

As the generation of the URL is moved into runHostPortUrl, both the C launch
function and the Haskell launch function can be reduced to (C)String -> IO ()
without breaking backwards compability.
CRTified added a commit to CRTified/wai-handlers that referenced this pull request Jan 15, 2020
@CRTified
Copy link
Contributor Author

Looks like the CI fails are all caused by broken dependencies (QtWebKit) or deprecated functions. I am assuming that they are unrelated to my changes.

Copy link
Member

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment on version numbers. I'll take a crack at getting the CI to pass on master as well.

wai-handler-launch/ChangeLog.md Outdated Show resolved Hide resolved
wai-handler-launch/windows.c Show resolved Hide resolved
@CRTified
Copy link
Contributor Author

Is it preferred to squash the commits together?

Copy link
Member

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@snoyberg snoyberg merged commit 7c94d8c into yesodweb:master Jan 16, 2020
@simonmichael
Copy link
Contributor

simonmichael commented Jan 18, 2020

Unfortunately, this fails to build on Windows, just revealed by hledger's CI:
https://ci.appveyor.com/project/simonmichael/hledger/builds/30196892

@simonmichael
Copy link
Contributor

simonmichael commented Jan 18, 2020

Ah, I think it should be

174 #if WINDOWS
175 launch url = withCString url launch'

snoyberg added a commit that referenced this pull request Jan 18, 2020
@snoyberg
Copy link
Member

Good catch, thanks! I'm uploading the fix shortly.

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

Successfully merging this pull request may close these issues.

Hard-coded IPv4 address makes IPv6 usage inconvenient
3 participants