Struct wmproxy::FileServer
source · pub struct FileServer {Show 15 fields
pub root: Option<String>,
pub prefix: String,
pub default_mimetype: String,
pub ext_mimetype: HashMap<String, String>,
pub cache_time: Option<ConfigDuration>,
pub robots: Option<String>,
pub path404: Option<String>,
pub hide: Vec<String>,
pub index: Vec<String>,
pub status: u16,
pub precompressed: Vec<String>,
pub disable_compress: bool,
pub browse: bool,
pub cors: bool,
pub comm: CommonConfig,
}
Expand description
代理类, 一个代理类启动一种类型的代理
Fields§
§root: Option<String>
§prefix: String
§default_mimetype: String
§ext_mimetype: HashMap<String, String>
§cache_time: Option<ConfigDuration>
§robots: Option<String>
§path404: Option<String>
§hide: Vec<String>
§index: Vec<String>
§status: u16
§precompressed: Vec<String>
§disable_compress: bool
§browse: bool
§cors: bool
通过“Access-Control-Allow-Origin“标头启用 CORS
comm: CommonConfig
Implementations§
source§impl FileServer
impl FileServer
pub fn new(root: String, prefix: String) -> Self
pub fn fix_default(&mut self)
pub fn set_common(&mut self, common: CommonConfig)
pub fn set_prefix(&mut self, prefix: String)
pub fn set_browse(&mut self, browse: bool)
pub fn set_disable_compress(&mut self, disable: bool)
pub fn is_hide_path(&self, path: &Path) -> bool
pub fn get_mimetype(&self, extension: &String) -> String
pub fn calc_etag(data: &Metadata) -> String
pub fn to_rfc2822(utc: DateTime<Utc>) -> String
pub fn calc_lastmodifed(val: &str) -> u64
pub async fn build_response_by_file( &self, req: &mut RecvRequest, real_path: PathBuf ) -> ProtResult<Option<RecvResponse>>
pub async fn try_cache( &self, req: &mut RecvRequest, metadata: &Metadata ) -> Option<RecvResponse>
pub fn calc_bytes_range(val: &str, len: u64) -> Option<(u64, u64)>
pub async fn after_file_response( &self, req: &mut RecvRequest, res: &mut RecvResponse, metadata: Option<&Metadata> ) -> ProtResult<()>
pub async fn deal_request( &self, req: &mut RecvRequest ) -> ProtResult<Response<Body>>
Trait Implementations§
source§impl Clone for FileServer
impl Clone for FileServer
source§fn clone(&self) -> FileServer
fn clone(&self) -> FileServer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FileServer
impl Debug for FileServer
source§impl<'de> Deserialize<'de> for FileServer
impl<'de> Deserialize<'de> for FileServer
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for FileServer
impl PartialEq for FileServer
source§fn eq(&self, other: &FileServer) -> bool
fn eq(&self, other: &FileServer) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for FileServer
impl Serialize for FileServer
impl StructuralPartialEq for FileServer
Auto Trait Implementations§
impl RefUnwindSafe for FileServer
impl Send for FileServer
impl Sync for FileServer
impl Unpin for FileServer
impl UnwindSafe for FileServer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more