From 348259a14bae2ad8cd88ef71733b8915d066b368 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 4 Feb 2021 15:31:57 +0900 Subject: [PATCH] Care about error case --- plume-common/src/activity_pub/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 539af143..179f9864 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -153,10 +153,12 @@ where warn!("Inbox doesn't have host: {:?}", &inbox); continue; }; - headers.insert( - "Host", - HeaderValue::from_str(&url.host_str().unwrap()).unwrap(), - ); + let host_header_value = HeaderValue::from_str(&url.host_str().expect("Unreachable")); + if host_header_value.is_err() { + warn!("Header valid is invalid: {:?}", url.host_str()); + continue; + } + headers.insert("Host", host_header_value.unwrap()); headers.insert("Digest", request::Digest::digest(&body)); rt.spawn( client