45 releases (5 stable)

3.0.0-beta.3 Feb 10, 2021
2.2.0 Nov 25, 2020
2.0.0-beta.2 Jul 22, 2020
2.0.0-alpha.2 Mar 7, 2020
0.1.0-alpha.2 Mar 30, 2019

#61 in HTTP server

Download history 32994/week @ 2020-11-04 30730/week @ 2020-11-11 34169/week @ 2020-11-18 32996/week @ 2020-11-25 34062/week @ 2020-12-02 34600/week @ 2020-12-09 30274/week @ 2020-12-16 18945/week @ 2020-12-23 22364/week @ 2020-12-30 36132/week @ 2021-01-06 38668/week @ 2021-01-13 38144/week @ 2021-01-20 39127/week @ 2021-01-27 39466/week @ 2021-02-03 38146/week @ 2021-02-10 37006/week @ 2021-02-17

141,324 downloads per month
Used in 326 crates (63 directly)

MIT/Apache

710KB
17K SLoC

actix-http

HTTP primitives for the Actix ecosystem.

crates.io Documentation Version MIT or Apache 2.0 licensed
dependency status Download Join the chat at https://gitter.im/actix/actix

Documentation & Resources

Example

use std::{env, io};

use actix_http::{HttpService, Response};
use actix_server::Server;
use futures_util::future;
use http::header::HeaderValue;
use log::info;

#[actix_rt::main]
async fn main() -> io::Result<()> {
    env::set_var("RUST_LOG", "hello_world=info");
    env_logger::init();

    Server::build()
        .bind("hello-world", "127.0.0.1:8080", || {
            HttpService::build()
                .client_timeout(1000)
                .client_disconnect(1000)
                .finish(|_req| {
                    info!("{:?}", _req);
                    let mut res = Response::Ok();
                    res.header("x-head", HeaderValue::from_static("dummy value!"));
                    future::ok::<_, ()>(res.body("Hello world!"))
                })
                .tcp()
        })?
        .run()
        .await
}

License

This project is licensed under either of

at your option.

Code of Conduct

Contribution to the actix-http crate is organized under the terms of the Contributor Covenant, the maintainer of actix-http, @fafhrd91, promises to intervene to uphold that code of conduct.

Dependencies

~16–21MB
~496K SLoC