From 7e967b22afa6d61ede641f5f9ab732f775f795e1 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 9 Dec 2021 17:07:27 -0500 Subject: [PATCH] more url fixes --- veilid-core/src/intf/native/network/mod.rs | 10 +--------- veilid-core/src/intf/native/network/protocol/ws.rs | 6 +++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/veilid-core/src/intf/native/network/mod.rs b/veilid-core/src/intf/native/network/mod.rs index 4552d14d..f78854bd 100644 --- a/veilid-core/src/intf/native/network/mod.rs +++ b/veilid-core/src/intf/native/network/mod.rs @@ -869,9 +869,6 @@ impl Network { ) }; trace!("WS: starting listener at {:?}", listen_address); - let (host, port) = split_port(&listen_address) - .map_err(|_| "invalid WS listen address, port not specified correctly".to_owned())?; - let port = port.ok_or_else(|| "port must be specified for WS address".to_owned())?; let addresses = self .start_tcp_listener( listen_address.clone(), @@ -914,19 +911,14 @@ impl Network { pub async fn start_wss_listeners(&self) -> Result<(), String> { let routing_table = self.routing_table(); - let (listen_address, url, path) = { + let (listen_address, url) = { let c = self.config.get(); ( c.network.protocol.wss.listen_address.clone(), c.network.protocol.wss.url.clone(), - c.network.protocol.wss.path.clone(), ) }; trace!("WSS: starting listener at {}", listen_address); - let (host, port) = split_port(&listen_address) - .map_err(|_| "invalid WSS listen address, port not specified correctly".to_owned())?; - let port = port.ok_or_else(|| "port must be specified for WSS address".to_owned())?; - let _ = self .start_tcp_listener( listen_address.clone(), diff --git a/veilid-core/src/intf/native/network/protocol/ws.rs b/veilid-core/src/intf/native/network/protocol/ws.rs index 946cf8c1..7468795b 100644 --- a/veilid-core/src/intf/native/network/protocol/ws.rs +++ b/veilid-core/src/intf/native/network/protocol/ws.rs @@ -145,7 +145,11 @@ impl WebsocketProtocolHandler { pub fn new(network_manager: NetworkManager, tls: bool, local_address: SocketAddr) -> Self { let config = network_manager.config(); let c = config.get(); - let path = format!("GET {}", c.network.protocol.ws.path.trim_end_matches('/')); + let path = if tls { + format!("GET {}", c.network.protocol.ws.path.trim_end_matches('/')) + } else { + format!("GET {}", c.network.protocol.wss.path.trim_end_matches('/')) + }; let connection_initial_timeout = if tls { c.network.tls.connection_initial_timeout } else {