[−][src]Struct multipart::server::iron::Intercept
A BeforeMiddleware
for Iron which will intercept and read-out multipart requests and store
the result in the request.
Successful reads will be placed in the extensions: TypeMap
field of iron::Request
as an
Entries
instance (as both key-type and value):
extern crate iron; extern crate multipart; use iron::prelude::*; use multipart::server::Entries; use multipart::server::iron::Intercept; fn main() { let mut chain = Chain::new(|req: &mut Request| if let Some(entries) = req.extensions.get::<Entries>() { Ok(Response::with(format!("{:?}", entries))) } else { Ok(Response::with("Not a multipart request")) }); chain.link_before(Intercept::default()); Iron::new(chain).http("localhost:80").unwrap(); }
Any errors during which occur during reading will be passed on as IronError
.
Fields
temp_dir_path: Option<PathBuf>
The parent directory for all temporary directories created by this middleware. Will be created if it doesn't exist (lazy).
If omitted, uses the OS temporary directory.
Default value: None
.
file_size_limit: u64
The size limit of uploaded files, in bytes.
Files which exceed this size will be rejected.
See the limit_behavior
field for more info.
Default value: DEFAULT_FILE_SIZE_LIMIT
file_count_limit: u32
The limit on the number of files which will be saved from the request. Requests which exceed this count will be rejected.
Default value: DEFAULT_FILE_COUNT_LIMT
limit_behavior: LimitBehavior
What to do when a file count or size limit has been exceeded.
See LimitBehavior
for more info.
Implementations
impl Intercept
[src]
pub fn temp_dir_path<P: Into<PathBuf>>(self, path: P) -> Self
[src]
Set the temp_dir_path
for this middleware.
pub fn file_size_limit(self, limit: u64) -> Self
[src]
Set the file_size_limit
for this middleware.
pub fn file_count_limit(self, limit: u32) -> Self
[src]
Set the file_count_limit
for this middleware.
pub fn limit_behavior(self, behavior: LimitBehavior) -> Self
[src]
Set the limit_behavior
for this middleware.
Trait Implementations
impl BeforeMiddleware for Intercept
[src]
pub fn before(&self, req: &mut IronRequest<'_, '_>) -> IronResult<()>
[src]
pub fn catch(
&self,
&mut Request<'_, '_>,
err: IronError
) -> Result<(), IronError>
[src]
&self,
&mut Request<'_, '_>,
err: IronError
) -> Result<(), IronError>
impl Debug for Intercept
[src]
impl Default for Intercept
[src]
Auto Trait Implementations
impl RefUnwindSafe for Intercept
[src]
impl Send for Intercept
[src]
impl Sync for Intercept
[src]
impl Unpin for Intercept
[src]
impl UnwindSafe for Intercept
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,