From 29a57bf172d78dbeb0e23766eaf55330ba7d97db Mon Sep 17 00:00:00 2001 From: Andy Duplain Date: Fri, 17 Oct 2025 15:37:07 +0100 Subject: [PATCH] VPN-4262: Update `Url` to return `url` and `front` fields. The VPN client is using the `Url` type alot now and in order to avoid double URL-parsing we would like the content of the `Url` type exposed. --- common/http-api-client/src/url.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/http-api-client/src/url.rs b/common/http-api-client/src/url.rs index d964a6a3f4..8b3b1a65b8 100644 --- a/common/http-api-client/src/url.rs +++ b/common/http-api-client/src/url.rs @@ -183,6 +183,11 @@ impl Url { }) } + /// Returns the underlying URL + pub fn inner_url(&self) -> &url::Url { + &self.url + } + /// Returns true if the URL has a front domain set pub fn has_front(&self) -> bool { if let Some(fronts) = &self.fronts { @@ -201,6 +206,11 @@ impl Url { .and_then(|url| url.host_str()) } + /// Returns the fronts + pub fn fronts(&self) -> Option<&[url::Url]> { + self.fronts.as_deref() + } + /// Return the string representation of the host (domain or IP address) for this URL, if any. pub fn host_str(&self) -> Option<&str> { self.url.host_str()