Add $https parsing, fix time parsing
This commit is contained in:
parent
e5d612223b
commit
bb740067f1
|
@ -17,11 +17,11 @@ pub struct RawRequest {
|
||||||
host: String,
|
host: String,
|
||||||
user_agent: String,
|
user_agent: String,
|
||||||
referrer: String,
|
referrer: String,
|
||||||
secure: bool,
|
secure: String,
|
||||||
timestamp: String,
|
timestamp: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[derive(Serialize)]
|
#[derive(Debug)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
size: i32,
|
size: i32,
|
||||||
path: String,
|
path: String,
|
||||||
|
@ -93,8 +93,12 @@ async fn receive_message(pool: &PgPool, message: &[u8]) -> Result<(), Box<dyn st
|
||||||
host: req.host,
|
host: req.host,
|
||||||
user_agent: req.user_agent,
|
user_agent: req.user_agent,
|
||||||
referrer: req.referrer,
|
referrer: req.referrer,
|
||||||
secure: req.secure,
|
secure: match req.secure.as_str() {
|
||||||
timestamp: OffsetDateTime::parse(req.timestamp, "%d/%m/%Y:%T %z")?
|
"on" => 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?;
|
db::insert(pool, req).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue