Refactor, inspect bin write index helper

This commit is contained in:
Dominik Werder
2025-03-21 14:45:49 +01:00
parent f8b3c1533b
commit 272cc77a32
24 changed files with 870 additions and 137 deletions
+9 -9
View File
@@ -8,20 +8,20 @@ use bytes::BytesMut;
use daqbuf_err as err;
use futures_util::Stream;
use futures_util::StreamExt;
use http::header;
use http::Request;
use http::Response;
use http::StatusCode;
use http::header;
use http_body::Frame;
use http_body_util::combinators::BoxBody;
use http_body_util::BodyExt;
use http_body_util::combinators::BoxBody;
use hyper::body::Body;
use hyper::body::Incoming;
use hyper::client::conn::http1::SendRequest;
use netpod::log::*;
use netpod::ReqCtx;
use netpod::APP_JSON;
use netpod::ReqCtx;
use netpod::X_DAQBUF_REQID;
use netpod::log::*;
use serde::Serialize;
use std::fmt;
use std::pin::Pin;
@@ -123,6 +123,10 @@ pub fn internal_error() -> http::Response<StreamBody> {
res
}
pub fn bad_request_response(msg: String, reqid: impl AsRef<str>) -> http::Response<StreamBody> {
error_status_response(StatusCode::BAD_REQUEST, msg, reqid)
}
pub fn error_response(msg: String, reqid: impl AsRef<str>) -> http::Response<StreamBody> {
error_status_response(StatusCode::INTERNAL_SERVER_ERROR, msg, reqid)
}
@@ -361,11 +365,7 @@ where
let host = uri.host().ok_or_else(|| Error::NoHostInUrl)?;
let port = uri.port_u16().unwrap_or_else(|| {
// NOTE known issue: url::Url will "forget" the port if it was the default port.
if scheme == "https" {
443
} else {
80
}
if scheme == "https" { 443 } else { 80 }
});
let stream = TcpStream::connect(format!("{host}:{port}")).await?;
if false {