72 releases (12 stable)

3.0.4 Mar 9, 2022
3.0.0 Feb 25, 2022
3.0.0-beta.17 Dec 27, 2021
3.0.0-beta.14 Nov 30, 2021
0.1.0-alpha.2 Mar 30, 2019

#1 in WebSocket

Download history 73812/week @ 2022-01-30 68962/week @ 2022-02-06 71347/week @ 2022-02-13 69811/week @ 2022-02-20 70411/week @ 2022-02-27 74549/week @ 2022-03-06 69207/week @ 2022-03-13 68719/week @ 2022-03-20 82118/week @ 2022-03-27 77574/week @ 2022-04-03 79081/week @ 2022-04-10 79639/week @ 2022-04-17 82359/week @ 2022-04-24 68406/week @ 2022-05-01 78540/week @ 2022-05-08 77511/week @ 2022-05-15

311,888 downloads per month
Used in 568 crates (98 directly)

MIT/Apache

570KB
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 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

~8–19MB
~416K SLoC