X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=server%2Fsweb.rs;h=0176e46afba58b28d0add5581b7b073d1e0b7fb5;hb=3f8e8476596ac11aba24a3bcc427107a56f9a2df;hp=d4e825e0886f60b093cf99e455379cc38b6a6153;hpb=e62243a72a3cba960db7ba7e02fffc3fb5f76059;p=hippotat.git diff --git a/server/sweb.rs b/server/sweb.rs index d4e825e..0176e46 100644 --- a/server/sweb.rs +++ b/server/sweb.rs @@ -30,15 +30,16 @@ pub struct WebResponse { pub data: Result, } -pub type WebResponseData = Vec; +pub type WebResponseData = FrameQueueBuf; +pub type WebResponseBody = BufBody; pub async fn handle( conn: Arc, global: Arc, req: hyper::Request -) -> Result, hyper::http::Error> { +) -> Result, hyper::http::Error> { if req.method() == Method::GET { - let mut resp = hyper::Response::new(hyper::Body::from("hippotat\r\n")); + let mut resp = hyper::Response::new(BufBody::display("hippotat\r\n")); resp.headers_mut().insert( "Content-Type", "text/plain; charset=US-ASCII".try_into().unwrap() @@ -149,7 +150,7 @@ pub async fn handle( //dbg!(DumpHex(hmac_got), hmac_ok, client_exists); if ! bool::from(hmac_ok & client_exists) { debug!("{} rejected client {}", &conn, &client_name); - let body = hyper::Body::from("Not authorised\r\n"); + let body = BufBody::display("Not authorised\r\n"); return Ok( hyper::Response::builder() .status(hyper::StatusCode::FORBIDDEN) @@ -208,7 +209,7 @@ pub async fn handle( &warnings.warnings); } - let data = hyper::Body::from(data); + let data = BufBody::new(data); Ok::<_,AE>( hyper::Response::builder() .header("Content-Type", r#"application/octet-stream"#) @@ -223,6 +224,6 @@ pub async fn handle( hyper::Response::builder() .status(hyper::StatusCode::BAD_REQUEST) .header("Content-Type", r#"text/plain; charset="utf-8""#) - .body(errmsg.into()) + .body(BufBody::display(errmsg)) }) }