Skip to main content

Module disposition

Module disposition 

Source
Expand description

Content-Disposition (RFC 6266, and its use in multipart/form-data part headers, RFC 7578 section 4.2).

§Examples

use parse_net as pn;

let cd = pn::parse_content_disposition(
    b"attachment; filename=\"EURO rates.txt\"; filename*=utf-8''%e2%82%ac%20rates.txt")?;
assert_eq!(cd.kind(), pn::DispositionType::Attachment);
let mut buf = [0u8; 64];
assert_eq!(cd.filename().expect("present").decode_into(&mut buf)?, "\u{20ac} rates.txt");

Structs§

ContentDisposition
A validated Content-Disposition value.

Enums§

DispositionType
The disposition type.
Filename
A file name from Content-Disposition or a Link title.

Functions§

parse
Parses disposition-type *( OWS ";" OWS disposition-parm ).
parse_content_disposition
Parses Content-Disposition with the default Limits.
write_attachment
Writes attachment; filename="<ASCII fallback>", followed by ; filename*=UTF-8''<encoded> when the name is not plain printable ASCII without " and \. The fallback replaces each such character with _.