serve
Avril 4 years ago
parent 20656ce80e
commit 7fe14a8e18
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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()

Loading…
Cancel
Save