move src/server/h2service.rs into proxmox-rest-server crate
This commit is contained in:
parent
ae18c436dd
commit
f7348a23cd
|
@ -11,8 +11,8 @@ use hyper::{Body, Request, Response, StatusCode};
|
||||||
use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
|
use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
|
||||||
use proxmox::http_err;
|
use proxmox::http_err;
|
||||||
|
|
||||||
use proxmox_rest_server::{normalize_uri_path, WorkerTask};
|
use crate::{normalize_uri_path, WorkerTask};
|
||||||
use proxmox_rest_server::formatter::*;
|
use crate::formatter::*;
|
||||||
|
|
||||||
/// Hyper Service implementation to handle stateful H2 connections.
|
/// Hyper Service implementation to handle stateful H2 connections.
|
||||||
///
|
///
|
||||||
|
@ -59,7 +59,7 @@ impl <E: RpcEnvironment + Clone> H2Service<E> {
|
||||||
future::ok((formatter.format_error)(err)).boxed()
|
future::ok((formatter.format_error)(err)).boxed()
|
||||||
}
|
}
|
||||||
Some(api_method) => {
|
Some(api_method) => {
|
||||||
proxmox_rest_server::handle_api_request(
|
crate::rest::handle_api_request(
|
||||||
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
|
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,11 +30,14 @@ mod api_config;
|
||||||
pub use api_config::ApiConfig;
|
pub use api_config::ApiConfig;
|
||||||
|
|
||||||
mod rest;
|
mod rest;
|
||||||
pub use rest::{RestServer, handle_api_request};
|
pub use rest::RestServer;
|
||||||
|
|
||||||
mod worker_task;
|
mod worker_task;
|
||||||
pub use worker_task::*;
|
pub use worker_task::*;
|
||||||
|
|
||||||
|
mod h2service;
|
||||||
|
pub use h2service::*;
|
||||||
|
|
||||||
pub enum AuthError {
|
pub enum AuthError {
|
||||||
Generic(Error),
|
Generic(Error),
|
||||||
NoData,
|
NoData,
|
||||||
|
|
|
@ -388,7 +388,7 @@ async fn proxy_protected_request(
|
||||||
Ok(resp)
|
Ok(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHasher + Send>(
|
pub(crate) async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHasher + Send>(
|
||||||
mut rpcenv: Env,
|
mut rpcenv: Env,
|
||||||
info: &'static ApiMethod,
|
info: &'static ApiMethod,
|
||||||
formatter: &'static OutputFormatter,
|
formatter: &'static OutputFormatter,
|
||||||
|
|
|
@ -23,9 +23,8 @@ use pbs_datastore::PROXMOX_BACKUP_PROTOCOL_ID_V1;
|
||||||
use pbs_datastore::backup_info::{BackupDir, BackupGroup, BackupInfo};
|
use pbs_datastore::backup_info::{BackupDir, BackupGroup, BackupInfo};
|
||||||
use pbs_datastore::index::IndexFile;
|
use pbs_datastore::index::IndexFile;
|
||||||
use pbs_datastore::manifest::{archive_type, ArchiveType};
|
use pbs_datastore::manifest::{archive_type, ArchiveType};
|
||||||
use proxmox_rest_server::WorkerTask;
|
use proxmox_rest_server::{WorkerTask, H2Service};
|
||||||
|
|
||||||
use crate::server::H2Service;
|
|
||||||
use crate::backup::DataStore;
|
use crate::backup::DataStore;
|
||||||
use pbs_config::CachedUserInfo;
|
use pbs_config::CachedUserInfo;
|
||||||
|
|
||||||
|
|
|
@ -39,15 +39,9 @@ use pbs_datastore::backup_info::BackupDir;
|
||||||
use pbs_datastore::index::IndexFile;
|
use pbs_datastore::index::IndexFile;
|
||||||
use pbs_datastore::manifest::{archive_type, ArchiveType};
|
use pbs_datastore::manifest::{archive_type, ArchiveType};
|
||||||
use pbs_config::CachedUserInfo;
|
use pbs_config::CachedUserInfo;
|
||||||
use proxmox_rest_server::WorkerTask;
|
use proxmox_rest_server::{WorkerTask, H2Service};
|
||||||
|
|
||||||
use crate::{
|
use crate::{api2::helpers, backup::DataStore};
|
||||||
api2::helpers,
|
|
||||||
backup::DataStore,
|
|
||||||
server::{
|
|
||||||
H2Service,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
mod environment;
|
mod environment;
|
||||||
use environment::*;
|
use environment::*;
|
||||||
|
|
|
@ -11,9 +11,6 @@ use proxmox::tools::fs::{create_path, CreateOptions};
|
||||||
|
|
||||||
use pbs_buildcfg;
|
use pbs_buildcfg;
|
||||||
|
|
||||||
mod h2service;
|
|
||||||
pub use h2service::*;
|
|
||||||
|
|
||||||
pub mod jobstate;
|
pub mod jobstate;
|
||||||
|
|
||||||
mod verify_job;
|
mod verify_job;
|
||||||
|
|
Loading…
Reference in New Issue