Add $https parsing, fix time parsing
This commit is contained in:
parent
e5d612223b
commit
bb740067f1
|
@ -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<dyn st
|
|||
host: req.host,
|
||||
user_agent: req.user_agent,
|
||||
referrer: req.referrer,
|
||||
secure: req.secure,
|
||||
timestamp: OffsetDateTime::parse(req.timestamp, "%d/%m/%Y:%T %z")?
|
||||
secure: match req.secure.as_str() {
|
||||
"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?;
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue