Check message length
[?]
Dec 18, 2018, 8:47 PM
3PDAOBBMGX6OYMFX6YZW4QJE77MW3MCCUXBIGB23YXFWD5WAPVCACDependencies
- [2]
ZJ4QKTJRFixed body reading - [3]
EOHEZXX3Move request processing to structure - [4]
MOXHYSQ3Use more common error type\n\nMove to failure::Error after https://github.com/rust-lang-nursery/failure/pull/283 landed. - [5]
UCY2DO3DTry to read request body - [*]
FVVPKFTLInitial commit
Change contents
- replacement in src/main.rs at line 86[3.266]→[2.589:682](∅→∅),[2.682]→[3.928:2045](∅→∅),[3.928]→[3.928:2045](∅→∅),[3.2045]→[2.683:825](∅→∅),[2.825]→[3.2147:2182](∅→∅),[3.2147]→[3.2147:2182](∅→∅)
.and_then(move |_msg: String| {cmd_send.clone().send(XmppCommand { xmpp_to }).then(|r| match r {Ok(_) => tokio::prelude::future::ok(Response::new(Body::from("Accepted",))),Err(e) => {error!("Command sent error: {}", e);tokio::prelude::future::result(Response::builder().status(hyper::StatusCode::BAD_REQUEST).body(Body::from(format!("Command sent error: {}",e))),)}}).map_err(|e| {Box::new(e)as Box<dyn std::error::Error + Sync + Send + 'static>}).and_then(move |msg: String| {if !msg.is_empty() {Box::new(cmd_send.clone().send(XmppCommand { xmpp_to }).then(|r| match r {Ok(_) => tokio::prelude::future::ok(Response::new(Body::from("Accepted"),)),Err(e) => {error!("Command sent error: {}", e);tokio::prelude::future::result(Response::builder().status(hyper::StatusCode::BAD_REQUEST).body(Body::from(format!("Command sent error: {}",e))),)}}).map_err(|e| {Box::new(e)as Box<dyn std::error::Error + Sync + Send + 'static,>}),)} else {warn!("Empty message");Box::new(tokio::prelude::future::result(Response::builder().status(hyper::StatusCode::BAD_REQUEST).body(Body::from("Empty message")).map_err(|e| {Box::new(e)as Box<dyn std::error::Error + Sync + Send + 'static,>}),))as Box<Future<Item = _, Error = _> + Send + 'static>}