77 releases (17 stable)

3.3.0 Jan 21, 2023
3.2.2 Sep 11, 2022
3.2.1 Jul 2, 2022
3.0.4 Mar 9, 2022
0.1.0-alpha.2 Mar 30, 2019

#9 in Web programming

Download history 85141/week @ 2022-10-14 85065/week @ 2022-10-21 84642/week @ 2022-10-28 103250/week @ 2022-11-04 103329/week @ 2022-11-11 81218/week @ 2022-11-18 83179/week @ 2022-11-25 85152/week @ 2022-12-02 85132/week @ 2022-12-09 81240/week @ 2022-12-16 49409/week @ 2022-12-23 59469/week @ 2022-12-30 86922/week @ 2023-01-06 89867/week @ 2023-01-13 95699/week @ 2023-01-20 84609/week @ 2023-01-27

369,657 downloads per month
Used in 725 crates (113 directly)

MIT/Apache

585KB
14K SLoC

actix-http

HTTP primitives for the Actix ecosystem.

crates.io Documentation Version MIT or Apache 2.0 licensed
dependency status Download Chat on Discord

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 tracing::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

~8–18MB
~391K SLoC