mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Format component of url
This commit is contained in:
parent
9070d4bc65
commit
812d4a479a
2 changed files with 25 additions and 15 deletions
|
@ -18,10 +18,13 @@ pub enum ImmutableOrigin {
|
|||
/// Consists of the URL's scheme, host and port
|
||||
Tuple(
|
||||
String,
|
||||
#[serde(deserialize_with = "url_serde::deserialize", serialize_with = "url_serde::serialize")]
|
||||
#[serde(
|
||||
deserialize_with = "url_serde::deserialize",
|
||||
serialize_with = "url_serde::serialize"
|
||||
)]
|
||||
Host,
|
||||
u16,
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
impl ImmutableOrigin {
|
||||
|
@ -160,7 +163,8 @@ impl MutableOrigin {
|
|||
}
|
||||
|
||||
pub fn effective_domain(&self) -> Option<Host> {
|
||||
self.immutable().host()
|
||||
self.immutable()
|
||||
.host()
|
||||
.map(|host| self.domain().unwrap_or_else(|| host.clone()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue