Remove DEFAULT_HOST (#153)
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.
This commit is contained in:
committed by
GitHub
parent
fec79dcef3
commit
e8c3403f7b
@@ -8,7 +8,6 @@ use crate::Proxy;
|
||||
|
||||
use url::Url;
|
||||
|
||||
pub const DEFAULT_HOST: &str = "localhost";
|
||||
const DEFAULT_MAX_IDLE_CONNECTIONS: usize = 100;
|
||||
const DEFAULT_MAX_IDLE_CONNECTIONS_PER_HOST: usize = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user