|
|
|
@ -9,7 +9,6 @@ use warp::{
|
|
|
|
|
Filter,
|
|
|
|
|
Buf,
|
|
|
|
|
reply::Response,
|
|
|
|
|
http,
|
|
|
|
|
};
|
|
|
|
|
use hyper::Body;
|
|
|
|
|
use std::{
|
|
|
|
@ -30,6 +29,12 @@ use tokio::{
|
|
|
|
|
};
|
|
|
|
|
use cfg_if::cfg_if;
|
|
|
|
|
|
|
|
|
|
macro_rules! status {
|
|
|
|
|
($code:expr) => {
|
|
|
|
|
::warp::http::status::StatusCode::from_u16($code).unwrap()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature="trust-x-forwarded-for")]
|
|
|
|
|
mod forwarded_list;
|
|
|
|
|
#[cfg(feature="trust-x-forwarded-for")]
|
|
|
|
@ -131,14 +136,10 @@ async fn main() {
|
|
|
|
|
.and_then(|chain: Arc<RwLock<Chain<String>>>, host: IpAddr, buf| {
|
|
|
|
|
async move {
|
|
|
|
|
full_body(&host, chain, buf).await
|
|
|
|
|
.map(|x| format!("{} bytes fed", x))
|
|
|
|
|
.map(|_| warp::reply::with_status(warp::reply(), status!(201)))
|
|
|
|
|
.map_err(warp::reject::custom)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.map(|x| http::Response::builder()
|
|
|
|
|
.status(201)
|
|
|
|
|
.body(x)
|
|
|
|
|
.unwrap())
|
|
|
|
|
.with(warp::log("markov::put"));
|
|
|
|
|
|
|
|
|
|
let read = warp::get()
|
|
|
|
|