more url fixes

This commit is contained in:
John Smith 2021-12-09 17:07:27 -05:00
parent feb54071f2
commit 7e967b22af
2 changed files with 6 additions and 10 deletions

View File

@ -869,9 +869,6 @@ impl Network {
) )
}; };
trace!("WS: starting listener at {:?}", listen_address); 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 let addresses = self
.start_tcp_listener( .start_tcp_listener(
listen_address.clone(), listen_address.clone(),
@ -914,19 +911,14 @@ impl Network {
pub async fn start_wss_listeners(&self) -> Result<(), String> { pub async fn start_wss_listeners(&self) -> Result<(), String> {
let routing_table = self.routing_table(); let routing_table = self.routing_table();
let (listen_address, url, path) = { let (listen_address, url) = {
let c = self.config.get(); let c = self.config.get();
( (
c.network.protocol.wss.listen_address.clone(), c.network.protocol.wss.listen_address.clone(),
c.network.protocol.wss.url.clone(), c.network.protocol.wss.url.clone(),
c.network.protocol.wss.path.clone(),
) )
}; };
trace!("WSS: starting listener at {}", listen_address); 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 let _ = self
.start_tcp_listener( .start_tcp_listener(
listen_address.clone(), listen_address.clone(),

View File

@ -145,7 +145,11 @@ impl WebsocketProtocolHandler {
pub fn new(network_manager: NetworkManager, tls: bool, local_address: SocketAddr) -> Self { pub fn new(network_manager: NetworkManager, tls: bool, local_address: SocketAddr) -> Self {
let config = network_manager.config(); let config = network_manager.config();
let c = config.get(); 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 { let connection_initial_timeout = if tls {
c.network.tls.connection_initial_timeout c.network.tls.connection_initial_timeout
} else { } else {