#form-data #hyper #iron #http #upload

bin+lib multipart

A backend-agnostic extension for HTTP libraries that provides support for POST multipart/form-data requests on both client and server

54 releases

0.16.1 Jan 28, 2019
0.15.4 Nov 30, 2018
0.15.2 Jul 30, 2018
0.14.2 Mar 1, 2018
0.1.0 Nov 29, 2014

#10 in HTTP server

Download history 2556/week @ 2019-03-25 2828/week @ 2019-04-01 3108/week @ 2019-04-08 2818/week @ 2019-04-15 2586/week @ 2019-04-22 2672/week @ 2019-04-29 2724/week @ 2019-05-06 3074/week @ 2019-05-13 3243/week @ 2019-05-20 2898/week @ 2019-05-27 3342/week @ 2019-06-03 3135/week @ 2019-06-10 2946/week @ 2019-06-17 3023/week @ 2019-06-24 2958/week @ 2019-07-01

11,858 downloads per month
Used in 55 crates (23 directly)

MIT/Apache

172KB
3K SLoC

Multipart Build Status On Crates.io

Client- and server-side abstractions for HTTP file uploads (POST requests with Content-Type: multipart/form-data).

Supports several different (synchronous API) HTTP crates. Asynchronous (i.e. futures-based) API support will be provided by multipart-async.

Minimum supported Rust version: 1.24.1

Documentation

Integrations

Example files demonstrating how to use multipart with these crates are available under examples/.

Hyper

via the hyper feature (enabled by default).

Note: Hyper 0.9, 0.10 (synchronous API) only; support for asynchronous APIs will be provided by multipart-async.

Client integration includes support for regular hyper::client::Request objects via multipart::client::Multipart, as well as integration with the new hyper::Client API via multipart::client::lazy::Multipart (new in 0.5).

Server integration for hyper::server::Request via multipart::server::Multipart.

Iron

via the iron feature.

Provides regular server-side integration with iron::Request via multipart::server::Multipart, as well as a convenient BeforeMiddleware implementation in multipart::server::iron::Intercept.

Nickel returning to multipart in 0.14!

via the nickel feature.

Provides server-side integration with &mut nickel::Request via multipart::server::Multipart.

tiny_http

via the tiny_http feature.

Provides server-side integration with tiny_http::Request via multipart::server::Multipart.

Rocket

Direct integration is not provided as the Rocket folks seem to want to handle multipart/form-data behind the scenes which would supercede any integration with multipart. However, an example is available showing how to use multipart on a Rocket server: examples/rocket.rs

⚡ Powered By ⚡

buf_redux

Customizable drop-in std::io::BufReader replacement, created to be used in this crate. Needed because it can read more bytes into the buffer without the buffer being empty, necessary when a boundary falls across two reads. (It was easier to author a new crate than try to get this added to std::io::BufReader.)

httparse

Fast, zero-copy HTTP header parsing, used to read field headers in multipart/form-data request bodies.

twoway

Fast string and byte-string search. Used to find boundaries in the request body. Uses SIMD acceleration when possible.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~7.5MB
~143K SLoC