From 7170f95825c83d98491faf7a606d79fbb006023d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 28 Dec 2015 12:18:16 +0100 Subject: [PATCH] BM header helpers: Add get_url_from_header() --- src/module/bm/header.rs | 4 ++++ src/module/helpers/header/mod.rs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/module/bm/header.rs b/src/module/bm/header.rs index 2d974749..0f0f9076 100644 --- a/src/module/bm/header.rs +++ b/src/module/bm/header.rs @@ -30,3 +30,7 @@ pub fn get_tags_from_header(header: &FHD) -> Vec { headerhelpers::tags::data::get_tags_from_header(header) } +pub fn get_url_from_header(header: &FHD) -> Option { + headerhelpers::data::get_url_from_header(header) +} + diff --git a/src/module/helpers/header/mod.rs b/src/module/helpers/header/mod.rs index 0d4ba67d..250decc2 100644 --- a/src/module/helpers/header/mod.rs +++ b/src/module/helpers/header/mod.rs @@ -19,7 +19,15 @@ pub mod data { } }).and_then(|urlkey| { match urlkey.deref().clone() { - FHD::Text(s) => Some(s), + FHD::Key{name: _, value: ref v} => { + match v.deref().clone() { + FHD::Text(s) => Some(s), + _ => { + warn!("Malformed Header Data: Expected Text, found non-Text"); + None + }, + } + } _ => { warn!("Malformed Header Data: Expected Text, found non-Text"); None