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

Remove DEFAULT_HOST #153

Merged
merged 6 commits into from
Sep 27, 2020
Merged

Remove DEFAULT_HOST #153

merged 6 commits into from
Sep 27, 2020

Conversation

jsha
Copy link
Collaborator

@jsha jsha commented Sep 20, 2020

In a few places we relied on "localhost" as a default if a URL's host was not set, but I think it's better to error out in these cases.

In general, there are a few places in Unit that assumed there is a host as part of the URL. I've made that explicit by doing a check at the beginning of connect(). I've also tried to plumb through the semantics of "host is always present" by changing the parameter types of some of the functions that use the hostname.

I considered a more thorough way to express this with types - for instance implementing an HttpUrl struct that embeds a Url, and exports most of the same methods, but guarantees that host is always present. However, that was more invasive than this so I did a smaller change to start.

@jsha jsha merged commit e8c3403 into algesten:master Sep 27, 2020
@jsha jsha deleted the no-default branch September 27, 2020 17:07
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.

2 participants