use headers::{HeaderMap, HeaderValue};
use hyper::{Method, Response};
use std::path::PathBuf;
use crate::body::Body;
#[cfg(feature = "mem-cache")]
use crate::mem_cache::cache::MemCacheOpts;
#[cfg(feature = "directory-listing")]
use crate::directory_listing::DirListFmt;
#[cfg(feature = "directory-listing-download")]
use crate::directory_listing::download::DirDownloadFmt;
pub(super) const DEFAULT_INDEX_FILES: &[&str; 1] = &["index.html"];
pub struct HandleOpts<'a> {
pub method: &'a Method,
#[cfg(feature = "mem-cache")]
pub memory_cache: Option<&'a MemCacheOpts>,
pub headers: &'a HeaderMap<HeaderValue>,
pub base_path: &'a PathBuf,
pub uri_path: &'a str,
pub index_files: &'a [&'a str],
pub uri_query: Option<&'a str>,
#[cfg(feature = "directory-listing")]
#[cfg_attr(docsrs, doc(cfg(feature = "directory-listing")))]
pub dir_listing: bool,
#[cfg(feature = "directory-listing")]
#[cfg_attr(docsrs, doc(cfg(feature = "directory-listing")))]
pub dir_listing_order: u8,
#[cfg(feature = "directory-listing")]
#[cfg_attr(docsrs, doc(cfg(feature = "directory-listing")))]
pub dir_listing_format: &'a DirListFmt,
#[cfg(feature = "directory-listing-download")]
#[cfg_attr(docsrs, doc(cfg(feature = "directory-listing-download")))]
pub dir_listing_download: &'a [DirDownloadFmt],
pub redirect_trailing_slash: bool,
pub compression_static: bool,
pub etag: bool,
pub include_hidden: bool,
pub follow_symlinks: bool,
}
pub struct StaticFileResponse {
pub resp: Response<Body>,
pub file_path: PathBuf,
}
impl StaticFileResponse {
pub(super) fn new(resp: Response<Body>, file_path: PathBuf) -> Self {
Self { resp, file_path }
}
}