diff --git a/Cargo.toml b/Cargo.toml index 97ae1a1f..858417c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,6 @@ members = [ "examples/raw_sqlite", "examples/hello_tls", ] + +[replace] +"hyper:0.10.8" = { git = 'https://github.com/SergioBenitez/hyper', branch = "0.10.x" } diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 90b654a3..88c1161e 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -22,7 +22,6 @@ tls = ["rustls", "hyper-rustls"] term-painter = "0.2" log = "0.3" url = "1" -hyper = { version = "0.10.4", default-features = false } toml = { version = "0.2", default-features = false } num_cpus = "1" state = "0.2.1" @@ -35,6 +34,12 @@ pear_codegen = "0.0.8" rustls = { version = "0.5.8", optional = true } cookie = { version = "0.7.4", features = ["percent-encode", "secure"] } +[dependencies.hyper] +git = "https://github.com/SergioBenitez/hyper" +branch = "0.10.x" +version = "0.10.4" +default-features = false + [dependencies.hyper-rustls] git = "https://github.com/SergioBenitez/hyper-rustls" default-features = false diff --git a/lib/src/error.rs b/lib/src/error.rs index 65008a36..4cecd2be 100644 --- a/lib/src/error.rs +++ b/lib/src/error.rs @@ -130,6 +130,13 @@ impl From for LaunchError { } } +impl From for LaunchError { + #[inline] + fn from(error: io::Error) -> LaunchError { + LaunchError::new(LaunchErrorKind::Io(error)) + } +} + impl fmt::Display for LaunchErrorKind { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/lib/src/rocket.rs b/lib/src/rocket.rs index 0131db00..b298578b 100644 --- a/lib/src/rocket.rs +++ b/lib/src/rocket.rs @@ -601,15 +601,20 @@ impl Rocket { let full_addr = format!("{}:{}", self.config.address, self.config.port); serve!(self, &full_addr, |server, proto| { - let server = match server { + let mut server = match server { Ok(server) => server, Err(e) => return LaunchError::from(e) }; + let (addr, port) = match server.local_addr() { + Ok(server_addr) => (&self.config.address, server_addr.port()), + Err(e) => return LaunchError::from(e) + }; + launch_info!("🚀 {} {}{}", White.paint("Rocket has launched from"), White.bold().paint(proto), - White.bold().paint(&full_addr)); + White.bold().paint(&format!("{}:{}", addr, port))); let threads = self.config.workers as usize; if let Err(e) = server.handle_threads(self, threads) {