http
http copied to clipboard
Convenience methods to create URL authority from its parts
Currently, the only way to build an Authority
object is to parse a string in the form <host>:<port>
. This can be a bit inconvenient: In the case the host is an ipv6 address, it needs to be enclosed in []
, and the developer will have to do a somewhat complex dance to go from a Host/Port pair to a proper authority string.
It'd be nice to have additional convenience methods, e.g.
// From a host and a port
impl TryFrom<(&str, u16)> for Authority {}
This way, if &str
is an IPv6 address (which can be detected by trying to parse it with Ipv6Addr::parse
), it can automatically be bracketed.