pub data: Result<WebResponseData, AE>,
}
-pub type WebResponseData = Vec<u8>;
+pub type WebResponseData = FrameQueueBuf;
+pub type WebResponseBody = BufBody<FrameQueueBuf>;
pub async fn handle(
conn: Arc<String>,
global: Arc<Global>,
req: hyper::Request<hyper::Body>
-) -> Result<hyper::Response<hyper::Body>, hyper::http::Error> {
+) -> Result<hyper::Response<WebResponseBody>, 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()
//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)
&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"#)
hyper::Response::builder()
.status(hyper::StatusCode::BAD_REQUEST)
.header("Content-Type", r#"text/plain; charset="utf-8""#)
- .body(errmsg.into())
+ .body(BufBody::display(errmsg))
})
}