Skip to main content

Module multipart

Module multipart 

Available on crate features http and multipart and std only.
Expand description

Sans-IO multipart/form-data codec (RFC 7578, framing per RFC 2046 §5.1.1).

Parser turns body chunks into Events and Encoder renders the framing of a body, neither doing any I/O of its own. Part data is handed out as slices of the chunks that were fed, so a body can be read, or rewritten while it streams through a proxy, without buffering or copying what its parts hold.

To rewrite a body in flight, step the parser and answer each event: forward a part by passing its headers to Encoder::part and its Event::Data chunks through as they are, drop a part by skipping its events, replace its data by writing other bytes, add a part by calling Encoder::part with headers of your own, and close the body with Encoder::finish. The output is framed afresh: preamble, epilogue and transport padding of the input are not carried over.

The server-side extractor built on this parser is Multipart, the client-side form builder lives in crate::service::client::multipart.

Structs§

Boundary
A validated multipart boundary, the boundary parameter of the body’s Content-Type.
Encoder
Sans-IO writer of the framing of a multipart/form-data body.
FormData
The parameters of a form-data disposition that name a part.
InvalidBoundary
The boundary cannot frame a multipart body.
InvalidContentDisposition
The value is not a well-formed form-data disposition.
Parser
Sans-IO parser of a multipart/form-data body.

Enums§

Event
A step of progress through a multipart/form-data body.
ParseError
Why a body is not a well-formed multipart/form-data body.