57 releases (6 stable)

new 3.0.0-beta.14 Nov 30, 2021
3.0.0-beta.11 Oct 20, 2021
3.0.0-beta.8 Jun 26, 2021
3.0.0-beta.4 Mar 8, 2021
0.1.0-alpha.2 Mar 30, 2019

#16 in WebSocket

Download history 64734/week @ 2021-08-13 49576/week @ 2021-08-20 52256/week @ 2021-08-27 48658/week @ 2021-09-03 63799/week @ 2021-09-10 66068/week @ 2021-09-17 67485/week @ 2021-09-24 64077/week @ 2021-10-01 74207/week @ 2021-10-08 75949/week @ 2021-10-15 62387/week @ 2021-10-22 54946/week @ 2021-10-29 59491/week @ 2021-11-05 67166/week @ 2021-11-12 62026/week @ 2021-11-19 65315/week @ 2021-11-26

265,266 downloads per month
Used in 477 crates (80 directly)

MIT/Apache

515KB
13K 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

~23MB
~525K SLoC