Remove unused
This commit is contained in:
@@ -205,8 +205,8 @@ async fn http_service_try(req: Request<Body>, node_config: &NodeConfigCached) ->
|
||||
if req.method() == Method::GET {
|
||||
let ret = serde_json::json!({
|
||||
"data_api_version": {
|
||||
"major": 4,
|
||||
"minor": 0,
|
||||
"major": 4u32,
|
||||
"minor": 0u32,
|
||||
},
|
||||
});
|
||||
Ok(response(StatusCode::OK).body(Body::from(serde_json::to_vec(&ret)?))?)
|
||||
@@ -279,12 +279,6 @@ async fn http_service_try(req: Request<Body>, node_config: &NodeConfigCached) ->
|
||||
} else {
|
||||
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
|
||||
}
|
||||
} else if path == "/api/4/ca_connect_1" {
|
||||
if req.method() == Method::GET {
|
||||
Ok(ca_connect_1(req, &node_config).await?)
|
||||
} else {
|
||||
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
|
||||
}
|
||||
} else if path == "/api/4/archapp/files/scan/msgs" {
|
||||
if req.method() == Method::GET {
|
||||
Ok(archapp_scan_files(req, &node_config).await?)
|
||||
@@ -922,22 +916,6 @@ pub fn status_board() -> Result<RwLockWriteGuard<'static, StatusBoard>, Error> {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn ca_connect_1(req: Request<Body>, node_config: &NodeConfigCached) -> Result<Response<Body>, Error> {
|
||||
let url = Url::parse(&format!("dummy:{}", req.uri()))?;
|
||||
let pairs = get_url_query_pairs(&url);
|
||||
let res = netfetch::ca::ca_connect_1(pairs, node_config).await?;
|
||||
let ret = response(StatusCode::OK)
|
||||
.header(http::header::CONTENT_TYPE, APP_JSON_LINES)
|
||||
.body(Body::wrap_stream(res.map(|k| match serde_json::to_string(&k) {
|
||||
Ok(mut item) => {
|
||||
item.push('\n');
|
||||
Ok(item)
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
})))?;
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
pub async fn archapp_scan_files(req: Request<Body>, node_config: &NodeConfigCached) -> Result<Response<Body>, Error> {
|
||||
let url = Url::parse(&format!("dummy:{}", req.uri()))?;
|
||||
let pairs = get_url_query_pairs(&url);
|
||||
|
||||
@@ -454,7 +454,52 @@ pub async fn proxy_api1_single_backend_query(
|
||||
_req: Request<Body>,
|
||||
_proxy_config: &ProxyConfig,
|
||||
) -> Result<Response<Body>, Error> {
|
||||
panic!()
|
||||
// TODO
|
||||
/*
|
||||
if let Some(back) = proxy_config.backends_event_download.first() {
|
||||
let is_tls = req
|
||||
.uri()
|
||||
.scheme()
|
||||
.ok_or_else(|| Error::with_msg_no_trace("no uri scheme"))?
|
||||
== &http::uri::Scheme::HTTPS;
|
||||
let bld = Request::builder().method(req.method());
|
||||
let bld = bld.uri(req.uri());
|
||||
// TODO to proxy events over multiple backends, we also have to concat results from different backends.
|
||||
// TODO Carry on needed headers (but should not simply append all)
|
||||
for (k, v) in req.headers() {
|
||||
bld.header(k, v);
|
||||
}
|
||||
{
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
let mut hasher = DefaultHasher::new();
|
||||
proxy_config.name.hash(&mut hasher);
|
||||
let mid = hasher.finish();
|
||||
bld.header(format!("proxy-mark-{mid:0x}"), proxy_config.name);
|
||||
}
|
||||
let body_data = hyper::body::to_bytes(req.into_body()).await?;
|
||||
let reqout = bld.body(Body::from(body_data))?;
|
||||
let resfut = {
|
||||
use hyper::Client;
|
||||
if is_tls {
|
||||
let https = HttpsConnector::new();
|
||||
let client = Client::builder().build::<_, Body>(https);
|
||||
let req = client.request(reqout);
|
||||
let req = Box::pin(req) as Pin<Box<dyn Future<Output = Result<Response<Body>, hyper::Error>> + Send>>;
|
||||
req
|
||||
} else {
|
||||
let client = Client::new();
|
||||
let req = client.request(reqout);
|
||||
let req = Box::pin(req) as _;
|
||||
req
|
||||
}
|
||||
};
|
||||
resfut.timeout();
|
||||
} else {
|
||||
Err(Error::with_msg_no_trace(format!("no api1 event backend configured")))
|
||||
}
|
||||
*/
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub async fn proxy_single_backend_query<QT>(
|
||||
|
||||
Reference in New Issue
Block a user