Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Actix web is a small, pragmatic, and extremely fast rust web framework.
Rust
Branch: master
Clone or download
Aaron1011 and JohnTitor Use `Pin<Box<S>>` in `BodyStream` and `SizedStream` (#1328)
Fixes #1321

A better fix would be to change `MessageBody` to take a `Pin<&mut
Self>`, rather than a `Pin<&mut Self>`. This will avoid requiring the
use of `Box` for all consumers by allowing the caller to determine how
to pin the `MessageBody` implementation (e.g. via stack pinning).

However, doing so is a breaking change that will affect every user of
`MessageBody`. By pinning the inner stream ourselves, we can fix the
undefined behavior without breaking the API.

I've included @sebzim4500's reproduction case as a new test case.
However, due to the nature of undefined behavior, this could pass (and
not segfault) even if underlying issue were to regress.

Unfortunately, until rust-lang/unsafe-code-guidelines#148 is resolved,
it's not even possible to write a Miri test that will pass when the bug
is fixed.

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
Latest commit fe13789 Jan 31, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Don't use cache in Windows CI (#1327) Jan 29, 2020
actix-cors allow to specify multi pattern for resources Dec 25, 2019
actix-files Fixed documentation typo for actix-files (#1278) Jan 15, 2020
actix-framed prep actix-framed release Dec 25, 2019
actix-http Use `Pin<Box<S>>` in `BodyStream` and `SizedStream` (#1328) Jan 31, 2020
actix-identity Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
actix-multipart Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
actix-session Long lasting auto-prolonged session (#1292) Jan 29, 2020
actix-web-actors update changes Dec 20, 2019
actix-web-codegen Add ability to name a handler function as 'config' (#1290) Jan 25, 2020
awc Rename HttpServer::start() to HttpServer::run() Dec 22, 2019
benches Add benchmark for full stack request lifecycle (#1298) Jan 24, 2020
examples Rename HttpServer::start() to HttpServer::run() Dec 22, 2019
src Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
test-server Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
tests Use `Pin<Box<S>>` in `BodyStream` and `SizedStream` (#1328) Jan 31, 2020
.appveyor.yml update deps Oct 9, 2018
.gitignore start working on guide Nov 28, 2017
.travis.yml use actix_rt::test for test setup Nov 26, 2019
CHANGES.md Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
CODE_OF_CONDUCT.md code of conduct Jan 21, 2018
Cargo.toml Upgrade `time` to 0.2.5 (#1254) Jan 28, 2020
LICENSE-APACHE add mit license Dec 17, 2017
LICENSE-MIT spelling check Mar 24, 2018
MIGRATION.md allow explicit SameSite=None cookies (#1282) Jan 23, 2020
README.md Add dependencies instruction (#1281) Jan 16, 2020
codecov.yml Remove codecoverage for tests and examples (#1299) Jan 23, 2020
rustfmt.toml copy actix-web2 Mar 2, 2019

README.md

Actix web

Actix web is a small, pragmatic, and extremely fast rust web framework

Build Status codecov crates.io Join the chat at https://gitter.im/actix/actix Documentation Download Version License

Website | Chat | Examples


Actix web is a simple, pragmatic and extremely fast web framework for Rust.

Example

Dependencies:

[dependencies]
actix-web = "2"
actix-rt = "1"

Code:

use actix_web::{get, web, App, HttpServer, Responder};

#[get("/{id}/{name}/index.html")]
async fn index(info: web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", info.1, info.0)
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| App::new().service(index))
        .bind("127.0.0.1:8080")?
        .run()
        .await
}

More examples

You may consider checking out this directory for more examples.

Benchmarks

License

This project is licensed under either of

at your option.

Code of Conduct

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

You can’t perform that action at this time.