You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is that you can’t have a username without a host, but an empty host is not the same as no host. It’s not clear whether empty hosts make sense though, so I don’t know if it’s a good idea to rely on them. (The spec might change to forbid them and I’ll update rust-url to follow.) set_host(Some("localhost")) would be safe, though.
Activity
nox commentedon Jun 14, 2015
You are trying to parse an URL with an authority (scheme://authority), an authority must include a non-empty host.
nox commentedon Jun 14, 2015
Oh wait, no, I stand corrected:
frewsxcv commentedon Aug 17, 2015
FWIW
is
truefor both Firefox and ChromeSimonSapin commentedon Aug 17, 2015
@alexcrichton Not sure why I didn’t respond to this a year ago, sorry. To use "non-standard" schemes like
postgres:you probably want a custom "scheme type mapper" https://servo.github.io/rust-url/url/struct.UrlParser.html#method.scheme_type_mapper .@nox Where is that quote from? This crates implements http://url.spec.whatwg.org/ which sometimes diverges from the various relevant IETF RFCs.
@frewsxcv The Rust API of this crate and its behavior is not necessarily the same as https://url.spec.whatwg.org/#api (which is designed for JavaScript and web compat) as long as it enables Servo to implement it on top.
frewsxcv commentedon Aug 17, 2015
I thought about that possibility, but wasn't sure. Thanks for clarifying 👍
Fix a corner case of Url::set_host
Fix a corner case of Url::set_host
SimonSapin commentedon Apr 21, 2016
This passes in 1.0:
The idea is that you can’t have a username without a host, but an empty host is not the same as no host. It’s not clear whether empty hosts make sense though, so I don’t know if it’s a good idea to rely on them. (The spec might change to forbid them and I’ll update rust-url to follow.)
set_host(Some("localhost"))would be safe, though.