Struct rocket_cgi::CGIDir
source · pub struct CGIDir { /* private fields */ }Expand description
Custom handler to execute CGIScripts
This handler will execute any script within the directory
Implementations§
source§impl CGIDir
impl CGIDir
sourcepub fn clear_file_types(self) -> Self
pub fn clear_file_types(self) -> Self
Clear file type associations, and disables directly running executables
sourcepub fn add_file_type(
self,
extension: impl Into<Cow<'static, str>>,
executable: impl Into<Cow<'static, Path>>
) -> Self
pub fn add_file_type(
self,
extension: impl Into<Cow<'static, str>>,
executable: impl Into<Cow<'static, Path>>
) -> Self
Add a file type association for executing a file
sourcepub fn only_python(self) -> Self
pub fn only_python(self) -> Self
Only allow executing python scripts
sourcepub fn shell_interpreter(self, executable: impl Into<Cow<'static, Path>>) -> Self
pub fn shell_interpreter(self, executable: impl Into<Cow<'static, Path>>) -> Self
Sets the shell interpreter
Default is sh
sourcepub fn add_windows_scripts(self) -> Self
pub fn add_windows_scripts(self) -> Self
Adds default Windows Shell Script types:
- cmd.exe: .cmd, .bat
- powershell.exe: .ps1
- cscript.exe: .wsf, .vbs, .js
sourcepub fn direct_executables(self, allow: bool) -> Self
pub fn direct_executables(self, allow: bool) -> Self
Whether to allow directly executable files. This may allow scripts with execute
permissions and a shebang (#!) to be executed, on some systems.
The CGI spec requires this to be false, which is the default
sourcepub fn unencoded_equals(self, allow: bool) -> Self
pub fn unencoded_equals(self, allow: bool) -> Self
Whether to pass parameters that contain unencoded =
The CGI spec requires this to be false, which is the default
sourcepub fn dot_files(self, allow: bool) -> Self
pub fn dot_files(self, allow: bool) -> Self
Whether to allow serving unix hidden files (files starting with a .)
Defaults to false
Whether to allow serving hidden files
Defaults to false, only applies to Windows
sourcepub fn setuid_files(self, allow: bool) -> Self
pub fn setuid_files(self, allow: bool) -> Self
Whether to allow serving files with setuid & setgid bits set
Defaults to false, only has an effect on Unix systems. Note this does not prevent a script from executing a setuid bit binary, but rather only protects against Rocket starting a setuid binary
Trait Implementations§
source§impl Handler for CGIDir
impl Handler for CGIDir
source§fn handle<'r, 'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'r Request<'life1>,
data: Data<'r>
) -> Pin<Box<dyn Future<Output = Outcome<'r>> + Send + 'async_trait>>where
Self: 'async_trait,
'r: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'r, 'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'r Request<'life1>,
data: Data<'r>
) -> Pin<Box<dyn Future<Output = Outcome<'r>> + Send + 'async_trait>>where
Self: 'async_trait,
'r: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Request with its associated Data should be
handled by this handler. Read moresource§impl PartialEq<CGIDir> for CGIDir
impl PartialEq<CGIDir> for CGIDir
impl Eq for CGIDir
impl StructuralEq for CGIDir
impl StructuralPartialEq for CGIDir
Auto Trait Implementations§
impl RefUnwindSafe for CGIDir
impl Send for CGIDir
impl Sync for CGIDir
impl Unpin for CGIDir
impl UnwindSafe for CGIDir
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
§fn into_collection<A>(self) -> SmallVec<A>where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A>where
A: Array<Item = T>,
self into a collection.