Fix AddrParseError when the incoming connection's remote_addr is not known.

This commit is contained in:
Jeb Rosen 2020-02-12 16:28:37 -08:00 committed by Sergio Benitez
parent 2ca15b663a
commit 71b888c2fa
1 changed files with 1 additions and 1 deletions

View File

@ -746,7 +746,7 @@ impl Rocket {
let rocket = Arc::new(self);
let service = hyper::make_service_fn(move |connection: &<L as Listener>::Connection| {
let rocket = rocket.clone();
let remote_addr = connection.remote_addr().unwrap_or_else(|| "0.0.0.0".parse().unwrap());
let remote_addr = connection.remote_addr().unwrap_or_else(|| ([0, 0, 0, 0], 0).into());
async move {
Ok::<_, std::convert::Infallible>(hyper::service_fn(move |req| {
hyper_service_fn(rocket.clone(), remote_addr, req)