limiter 0.1.1

Request body limiting for the Iron framework
docs.rs failed to build limiter-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: limiter-0.4.0

limiter

Build Status

This is an example of BeforeMiddleware for the Iron framework. It limits the request body size by checking first the Content-Length header, then the size of the payload. The response is either an HTTP 413 or it continues down the chain.

Include this in your Cargo.toml file:

[dependencies]
limiter = "0.1.0"

Example

extern crate iron;
extern crate limiter;

use iron::prelude::*;

use limiter::BodyLimit;

fn index(_: &mut Request) -> IronResult<Response> {
    Ok(Response::with((iron::status::Ok, "Test")))
}

fn main() {
    let max_request = BodyLimit::new(5000);
    let mut chain = Chain::new(index);
    chain.link_before(max_request);
    Iron::new(chain).http("localhost:3000").unwrap();
}

License

MIT