From bb740067f1573d2e915871f9367adf23629cdbb6 Mon Sep 17 00:00:00 2001 From: Emelie Graven Date: Sat, 19 Feb 2022 22:45:52 +0100 Subject: [PATCH] Add $https parsing, fix time parsing --- ingest/src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ingest/src/main.rs b/ingest/src/main.rs index 255ad49..4650572 100644 --- a/ingest/src/main.rs +++ b/ingest/src/main.rs @@ -17,11 +17,11 @@ pub struct RawRequest { host: String, user_agent: String, referrer: String, - secure: bool, + secure: String, timestamp: String, } -//#[derive(Serialize)] +#[derive(Debug)] pub struct Request { size: i32, path: String, @@ -93,8 +93,12 @@ async fn receive_message(pool: &PgPool, message: &[u8]) -> Result<(), Box true, + "" => false, + _ => return Err(String::from("Unexpected content in $https").into()), + }, + timestamp: OffsetDateTime::parse(req.timestamp, "%d/%b/%Y:%T %z")? }; db::insert(pool, req).await?; Ok(())