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

Overview

Actix Web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust

crates.io Documentation Version MIT or Apache 2.0 licensed Dependency Status
build status codecov downloads Chat on Discord

Features

  • Supports HTTP/1.x and HTTP/2
  • Streaming and pipelining
  • Keep-alive and slow requests handling
  • Client/server WebSockets support
  • Transparent content compression/decompression (br, gzip, deflate)
  • Powerful request routing
  • Multipart streams
  • Static assets
  • SSL support using OpenSSL or Rustls
  • Middlewares (Logger, Session, CORS, etc)
  • Includes an async HTTP client
  • Runs on stable Rust 1.46+

Documentation

Example

Dependencies:

[dependencies]
actix-web = "3"

Code:

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

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

#[actix_web::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

One of the fastest web frameworks available according to the TechEmpower Framework Benchmark.

License

This project is licensed under either of

at your option.

Code of Conduct

Contribution to the actix-web repo is organized under the terms of the Contributor Covenant. The Actix team promises to intervene to uphold that code of conduct.

Issues
  • Project future

    Project future

    I realized, a lot of people depends on actix. And it would be unfair to just delete repos. I promote @JohnTitor to project leader. He did very good job helping me for the last year. I hope new community of developers emerge. And good luck!

    opened by fafhrd91 142
  • Connection not closed correctly

    Connection not closed correctly

    Connection are not closed correctly by default What I means is: if you do a "netstat -ano" you will see connection list growing and growing. Not all old connection get closed.

    Tested with StaticFile handler ( HTTP2 or not ) on a website with ~20k+ daily users

    With the default config -> Not closed correctly With .keep_alive(None) -> Not closed correctly With .keep_alive(server::KeepAlive::Timeout(5)) -> All connections are closed correctly

    Initially detected in this ticket #426 but it was not the main issue

    C-bug needs-investigation 
    opened by neowutran 116
  • StaticFile & memory leak

    StaticFile & memory leak

    Hi, I am playing a bit with rust/actix-web on my personal website. The code is very basic https://git.neowutran.ovh:8080/neowutran/Website/src/master/src/main.rs

      server::new(|| {
        App::new()
         // .middleware(middleware::Logger::default())
          .resource("/store_stats", |r| {
            r.method(Method::POST)
              .with_config(store_statistics, |config| {
                config.limit(MAX_SIZE_STATS);
              })
          })
        .resource("/store_packets", |r| {
          r.method(Method::POST)
            .with_config(store_packets, |config| {
                config.0.limit(MAX_SIZE_PACKET);
            })
        })
        .handler("/updates",StaticFiles::new("/home/gl0/updates/").unwrap().show_files_listing())
        .handler("/others",StaticFiles::new("/home/gl0/others/").unwrap().show_files_listing())
        .handler("/teraDB",StaticFiles::new("/home/gl0/teraDB/").unwrap().show_files_listing())
        .handler("/",StaticFiles::new("/home/http/neowutran/").unwrap().show_files_listing().index_file("index.html"))
      })
    

    I run 2 instance of this exact same code. One on port 443, one on port 8083

    On port 8083, only /store_packets and /store_stats are used. 0.2% of server memory, stable. Actively used ( ~thousands request by hours, gigabytes uploaded ). Ok.

    On port 443, only the StaticFiles handler are used: /updates, /others, /teraDB, / ( TLS + HTTP2 ) Very actively used (~15k user use the /updates to download things). When I launched it yesterday, it used 0.2% of server memory. Memory used increased over time. Now, after ~15h, it now use 10% of server memory. With the command netstat -ano, I see that a lot of connections (hundreds) are "ESTABLISHED" on the service. Maybe in the case of HTTP2 / TLS, some issues with connection not being released or something like that ? ( For the same thing with apache httpd, ~0.2% of server memory, stable )

    Thanks

    opened by neowutran 53
  • actix-web 1.0

    actix-web 1.0

    I am planing to move 0.7 to separate branch and move 1.0 to master in 1 week.

    Any thoughts, concerns?

    High level tasks:

    • [x] Move 0.7 to separate branch
    • [x] Move 1.0 to master
    • [x] actix-files tidy up #730
    • [x] Migration guide 0.7 -> 1.0
    • [x] Upgrade the book
    • [x] Upgrade example
    opened by fafhrd91 51
  • Remove several usages of 'unsafe'

    Remove several usages of 'unsafe'

    This PR removes several different usages of unsafe (specifically, UnsafeCell), and replaces them with safe code. While these changes technically add some amount of overhead (Copying a type instead of taking a reference, and runtime RefCell checks), it should be so small as to be invisible on any benchmark.

    By replacing UnsafeCell with the safe Cell/UnsafeCell types, we ensure that any mistakes will lead to a panic! at worst, instead of undefined behavior.

    Each commit modifies a single file, and describes the changes made.

    opened by Aaron1011 41
  • bug: actix_web client unable to connect to any host on windows

    bug: actix_web client unable to connect to any host on windows

    Following example code always produces Error: Connect(Timeout):

    use actix_rt::System;
    use awc::Client;
    use futures::future::{
        Future,
        lazy
    };
    
    fn main() {
        System::new("weight_version").block_on(lazy(|| {
    
            awc::Client::new().get("https://google.com") //any address here
                .header("User-Agent", "Actix-web")
                .send()
                .map_err(|error| {
                    println!("Error: {:?}", error);
                })
                .and_then(|response| {
                    println!("Response: {:?}", response);
                    Ok(())
                })
        }));
    }
    

    actix_web::client::Client also produces same error:

    use actix_rt::System;
    use actix_web::client::Client;
    use futures::future::{
        Future,
        lazy
    };
    
    fn main() {
        System::new("weight_version").block_on(lazy(|| {
            let client = Client::default();
    
            client.get("https://www.rust-lang.org/")
                .header("User-Agent", "Actix-web")
                .send()
                .map_err(|error| {
                    println!("Error: {:?}", error);
                    //Err(error)
                })
                .and_then(|response| {
                    println!("Response: {:?}", response);
                    Ok(())
                })
        }));
    }
    

    Tested on 3 totally different windows machines with following:

    openssl version
    OpenSSL 1.1.1c  28 May 2019
    
    O-macos O-windows P-awc needs-investigation v1.x 
    opened by calirofpn 38
  • Type-safe path/query parameter handling, using serde

    Type-safe path/query parameter handling, using serde

    Users should be able to define structures that hold parameters that need to be passed to a request handler. We could use the serde Deserialize trait. The goal is to make it easier for users to access parameters without having to deal with error-handling themselves, and hopefully to avoid the current situation where making a typo in your handler vs your route means that you get a runtime error instead of a compile-time error.

    The goal is to somehow allow the user to type this:

    #[derive(Deserialize)]
    struct MyParams {
        name: String,
    }
    

    and then, define a handler like this:

    fn my_handler(req: HttpRequest<_>, my_params: MyParams) -> _ {
    }
    

    or, alternatively:

    fn my_hadler(req: HttpRequest<_>) -> _ {
        let my_params = req.get_params::<MyParams>();
    }
    

    This will require some way to declare the route for my_handler with MyParams.

    opened by radix 37
  • Call to Community and Participation

    Call to Community and Participation

    Until now i made most of project related decisions. But unfortunately, i dont have much time anymore, also i'd like to spend more time outside of opensource. supporting of this large and complex project is time consuming so i'd like to hand it to contributors, who'd like to spend some time on the project. I am still planing to work on actix, but can not afford to spend that much time as before.

    @actix/contributors

    opened by fafhrd91 37
  • UDP Socket Leak

    UDP Socket Leak

    I have a service that after ~18 - 24 hours runs out of file descriptors after a lot of investigation and some production debugging we were able to track it down to being leaked UDP sockets. My first thought is something about DNS resolution is wrong. When caught in the act the server had 418 UDP sockets open and it climbs up to the ulimit of 1024 and then server CPU spikes and the health check fails and the container is cycled.

    C-bug-upstream 
    opened by glademiller 35
  • multipart upload is very slow

    multipart upload is very slow

    I have compiled https://github.com/actix/examples/blob/master/multipart/src/main.rs as is (without any changes) and issues:

    $ time curl localhost:8080 -F [email protected]/main.rs
    [3380]
    real	0m1.022s
    user	0m0.006s
    sys	0m0.005s
    

    It took over a second to process pretty small file. What could be the reason?

    opened by kanekv 34
  • `Route::service`

    `Route::service`

    PR Type

    Feature

    PR Checklist

    • [ ] Tests for the changes have been added / updated.
    • [ ] Documentation comments have been added / updated.
    • [ ] A changelog entry has been made for the appropriate packages.
    • [x] Format code with the latest stable rustfmt.
    • [x] (Team) Label with affected crates and semver status.

    Overview

    Add a method to register service factories under a route directly.

    P-web semver-patch 
    opened by ibraheemdev 0
  • [RFC] fix app_data in middleware of scope

    [RFC] fix app_data in middleware of scope

    PR Type

    Bug fix

    PR Checklist

    • [ ] Tests for the changes have been added / updated.
    • [ ] Documentation comments have been added / updated.
    • [ ] A changelog entry has been made for the appropriate packages.
    • [ ] Format code with the latest stable rustfmt.
    • [ ] (Team) Label with affected crates and semver status.

    Overview

    This is my take on #1790

    This simply wraps the scope endpoint with a middleware that indroduces app_data early in the middleware chain! I'm unsure about the performance, though.

    Resource has the same problem.

    Closes #1790

    opened by aliemjay 0
  • files: inline disposition for application/javascript

    files: inline disposition for application/javascript

    PR Type

    Bug fix

    PR Checklist

    • [x] Tests for the changes have been added / updated.
    • [x] Documentation comments have been added / updated.
    • [ ] A changelog entry has been made for the appropriate packages.
    • [x] Format code with the latest stable rustfmt.
    • [x] (Team) Label with affected crates and semver status.

    Overview

    Closes #610

    P-files semver-patch 
    opened by aliemjay 6
  • [Windows] Web Client is unreasonably slow

    [Windows] Web Client is unreasonably slow

    Reproduce snippet:

    #[actix_web::main]
    async fn main() -> std::io::Result<()> {
        let sys_time = std::time::SystemTime::now();
        let start_time = sys_time.elapsed().unwrap();
    
        let client = actix_web::client::Client::builder()
            .connector(actix_web::client::Connector::new()
                .timeout(Duration::from_secs(35))
                .finish())
            .timeout(Duration::from_secs(35))
            .finish();
    
        let response = client.get("https://google.com")
            .send()
            .await
            .unwrap()
            .body()
            .await
            .unwrap();
        let end_time = sys_time.elapsed().unwrap();
        let secs = end_time - start_time;
        println!("{}", secs.as_secs());
        return Ok(());
    }
    

    This code prints "20" on Windows, i.e. get request to Google takes 20 seconds.

    Same code on Linux (WSL2) takes 0 seconds.

    I don't have any clues what might be wrong, but perhaps it's related to DNS resolution?

    Cargo.toml:

    // ...
    
    [dependencies]
    actix-web = { version = "3", features = ["rustls"] }
    
    opened by kateabr 1
  • Add suggestion for incorrect data extractor type

    Add suggestion for incorrect data extractor type

    Expected Behavior

    [2021-06-06T17:49:53Z DEBUG actix_web::data] Failed to construct App-level Data extractor. Request path: "/start" (type: std::sync::mutex::Mutex<futures_channel::mpsc::Sender<battlesnake::Board>>) ... <suggestion>
    

    Suggestion could be like missed wrapping T within Data (which happened to me, took me half an hour to figure this out). It's in the example but I didn't look closely at this part since I thought it should work since it compiled. The logging message is correct but I don't know why it failed, the type is correct but just without the Data so I didn't know that is an issue.

    #[actix_web::main]
    async fn main() -> std::io::Result<()> {
        let counter = web::Data::new(AppStateWithCounter {
            counter: Mutex::new(0),
        });
    
        HttpServer::new(move || {
            // move counter into the closure
            App::new()
                // Note: using app_data instead of data
                .app_data(counter.clone()) // <- register the created data
                .route("/", web::get().to(index))
        })
        .bind("127.0.0.1:8080")?
        .run()
        .await
    }
    

    Current Behavior

    [2021-06-06T17:49:53Z DEBUG actix_web::data] Failed to construct App-level Data extractor. Request path: "/start" (type: std::sync::mutex::Mutex<futures_channel::mpsc::Sender<battlesnake::Board>>)
    

    Possible Solution

    Add a suggestion on what is the expected type and the code change required. Ideally this should be done compile time but that's another issue.

    Context

    This will be very helpful for newcomers and even developers who made some mistakes and ease them.

    Your Environment

    • Rust Version (I.e, output of rustc -V): rustc 1.52.1 (9bc8c42bb 2021-05-09)
    • Actix Web Version: 3.3.2
    opened by pickfire 0
  • refined error model

    refined error model

    PR Type

    Refactor

    PR Checklist

    • [x] Tests for the changes have been added / updated.
    • [x] Documentation comments have been added / updated.
    • [x] A changelog entry has been made for the appropriate packages.
    • [x] Format code with the latest stable rustfmt.
    • [x] (Team) Label with affected crates and semver status.

    Overview

    • actix_http::Error is an opaque enum-ish error type.
    • actix_web::Error is the original Box<dyn ResponseError> type.
    • ResponseError trait is back to returning HttpResponse.
    P-awc P-http P-web semver-major 
    opened by robjtede 0
  • Select compression algorithm using features flags

    Select compression algorithm using features flags

    PR Type

    Refactor

    PR Checklist

    • [x] Tests for the changes have been added / updated.
    • [x] Documentation comments have been added / updated.
    • [x] A changelog entry has been made for the appropriate packages.
    • [x] Format code with the latest stable rustfmt.
    • [x] (Team) Label with affected crates and semver status.

    Overview

    Update compress feature flag to allow selection of enabled algorithms with compress-br, compress-gz and compress-zstd flags.

    Breaking change

    I totaly remove compress flag and replace it by compress-<alg> flags.

    Having both compress flag and compress-<alg> flags may lead to invalid selection:

    • Example 1: compress enabled but not algorithm selected
    • Example 2: algorithm selected but compress disabled

    Actix-web user helpers

    I also add compress-all "meta" flag for user who do not care about technical details and just want to have compression enabled.

    I did not call this flag just compress (like it was before), to show user behavior has actually change.

    Change for developpers

    For developper, checking if compression is enabled or not became unfortunately more verbose. So if anyone has any good idea to improve this, feel free to share it.

    Before it was:

    #[cfg(feature = "compress")]
    

    Now it is:

    #[cfg(any(
        feature = "compress-br",
        feature = "compress-gz",
        feature = "compress-zstd"
    ))]
    

    This PR follow works that has been started in PR [#2244].

    P-awc P-http P-web semver-major 
    opened by arthurlm 3
  • Single client would run out of connection pool's limit if any io error always happens

    Single client would run out of connection pool's limit if any io error always happens

    On release web-v3.2.0, when using a client repeatly in a loop to do request and get io error, the client will run out of connection pool's limit, and any other request by the client would be blocked and get timeout error.

    Expected Behavior

    Always print error, Failed to connect to host: Connection refused (os error 111)

    Current Behavior

    Print "error, Failed to connect to host: Connection refused (os error 111)" for "limit(10)" times And then always print error, Timeout while waiting for response

    Possible Solution

    In actix-http-2.2.0/src/client/pool.rs line 130 to 134, the guard(which I thought is used to realse when io error occured) should be made before connector.call(req).await?;

    Steps to Reproduce (for bugs)

    use actix_web::client::{Client, Connector};
    use actix_web::rt;
    use std::time::Duration;
    #[actix_web::main]
    async fn main() -> std::io::Result<()> {
        let conector = Connector::new().limit(10).finish();
        let client = Client::builder().connector(conector).finish();
        loop {
            // unopened port 2333
            let uri = format!("http://127.0.0.1:2333");
            match client.get(uri).send().await {
                Ok(mut resp) => {
                    let _payload = resp.body().await;
                }
                Err(e) => {
                    println!("error, {}", e);
                }
            };
            rt::time::delay_for(Duration::from_millis(100)).await;
        }
    }
    

    Context

    I use client to fetch data from many different backends periodly, now I have to renew the client instance to work around this bug.

    Your Environment

    • Rust Version (I.e, output of rustc -V):rustc 1.52.1 (9bc8c42bb 2021-05-09)
    • Actix Web Version:web-v3.2.0
    opened by hikaricai 0
  • [RFC] percent-encoding in URL path paramters

    [RFC] percent-encoding in URL path paramters

    The problem

    When extracting URL path parameters from Path extractor, the user is expected to be aware of percent-encoding because he would get some encoded characters. To date, all chars are decoded except for /, +, %.

    This behavior is quite surprising for the user because of the lack of documentation and is also quite unusual for a web framework - percent-encoding is a different level of abstraction that the user should not be concerned about (Query extractor deals with this correctly).

    The whole reason for this behavior is that the router stores URL as a single string with slash separated segments and matches a single regex against it. This is why / need to be escaped, to not change semantics.

    Related: #182 #209 #556 #1157

    The proposal

    What i think is a proper implementation is to store the url path and the matching pattern (ResourceDef) as array of segments with each pattern segment matches a single url path segment. This has the benefit of simplifying code by offloading uand even making regex an optional dependency, but it also would not allow patterns, such as "/user/u{id:.*}", that span multiple segments. Path tail patterns (e.g. "/files/{path:.*}") can be implemented as a special case but they should then be de-serialized into Vec<_> not String.

    An alternative easier implementation is to percent decode the matched url parameters when de-serializing Path, but then multi-segment matches should also be prohibited.

    opened by aliemjay 0
  • Server doesn't finish receiving `payload` when streaming with `reqwest`

    Server doesn't finish receiving `payload` when streaming with `reqwest`

    Following up on this gitter thread I have an example where proxying a streaming request to an actix-web server times out because the payload stream never completes.

    Expected Behavior

    The server receives the entire payload.

    Current Behavior

    The server never leaves the loop that's polling the payload.

    Steps to Reproduce (for bugs)

    Reproduction steps outlined here.

    Context

    Your Environment

    Reproduced with Rust version 1.52.1 and:

    1. actix-web 3, reqwest 0.10, and tokio 0.2
    2. actix-web 4, reqwest 0.11, and tokio 1
    opened by mlodato517 4
Releases(test-v0.1.0-beta.2)
  • test-v0.1.0-beta.2(Apr 17, 2021)

  • web-v4.0.0-beta.6(Apr 17, 2021)

  • awc-v3.0.0-beta.5(Apr 17, 2021)

  • http-v3.0.0-beta.6(Apr 17, 2021)

    Added

    • impl<T: MessageBody> MessageBody for Pin<Box<T>>. #2152
    • Response::{ok, bad_request, not_found, internal_server_error}. #2159
    • Helper body::to_bytes for async collecting message body into Bytes. #2158

    Changes

    • The type parameter of Response no longer has a default. #2152
    • The Message variant of body::Body is now Pin<Box<dyn MessageBody>>. #2152
    • BodyStream and SizedStream are no longer restricted to Unpin types. #2152
    • Error enum types are marked #[non_exhaustive]. #2161

    Removed

    • cookies feature flag. #2065
    • Top-level cookies mod (re-export). #2065
    • HttpMessage trait loses the cookies and cookie methods. #2065
    • impl ResponseError for CookieParseError. #2065
    • Deprecated methods on ResponseBuilder: if_true, if_some. #2148
    • ResponseBuilder::json. #2148
    • ResponseBuilder::{set_header, header}. #2148
    • impl From<serde_json::Value> for Body. #2148
    • Response::build_from. #2159
    • Most of the status code builders on Response. #2159
    Source code(tar.gz)
    Source code(zip)
  • test-v0.1.0-beta.1(Apr 2, 2021)

  • actors-v4.0.0-beta.4(Apr 2, 2021)

  • multipart-v0.4.0-beta.4(Apr 2, 2021)

  • http-test-v3.0.0-beta.4(Apr 2, 2021)

  • files-v0.6.0-beta.4(Apr 2, 2021)

  • awc-v3.0.0-beta.4(Apr 2, 2021)

    Added

    • Add Client::headers to get default mut reference of HeaderMap of client object. #2114

    Changed

    • ConnectorService type is renamed to BoxConnectorService. #2081
    • Fix http/https encoding when enabling compress feature. #2116
    • Rename TestResponse::header to append_header, set to insert_header. TestResponse header methods now take IntoHeaderPair tuples. #2094
    Source code(tar.gz)
    Source code(zip)
  • web-v4.0.0-beta.5(Apr 2, 2021)

    Added

    • Header extractor for extracting common HTTP headers in handlers. #2094
    • Added TestServer::client_headers method. #2097

    Fixed

    • Double ampersand in Logger format is escaped correctly. #2067

    Changed

    • CustomResponder would return error as HttpResponse when CustomResponder::with_header failed instead of skipping. (Only the first error is kept when multiple error occur) #2093

    Removed

    • The client mod was removed. Clients should now use awc directly. 871ca5e4
    • Integration testing was moved to new actix-test crate. Namely these items from the test module: TestServer, TestServerConfig, start, start_with, and unused_addr. #2112
    Source code(tar.gz)
    Source code(zip)
  • http-v3.0.0-beta.5(Apr 2, 2021)

    Added

    • client::Connector::handshake_timeout method for customizing TLS connection handshake timeout. #2081
    • client::ConnectorService as client::Connector::finish method's return type #2081
    • client::ConnectionIo trait alias #2081

    Changed

    • client::Connector type now only have one generic type for actix_service::Service. #2063

    Removed

    • Common typed HTTP headers were moved to actix-web. [2094]
    • ResponseError impl for actix_utils::timeout::TimeoutError. #2127
    Source code(tar.gz)
    Source code(zip)
  • multipart-v0.4.0-beta.3(Mar 9, 2021)

  • web-actors-v4.0.0-beta.3(Mar 9, 2021)

  • files-v0.6.0-beta.3(Mar 9, 2021)

  • web-v4.0.0-beta.4(Mar 9, 2021)

    Changed

    • Feature cookies is now optional and enabled by default. #1981
    • JsonBody::new returns a default limit of 32kB to be consistent with JsonConfig and the default behaviour of the web::Json<T> extractor. #2010
    Source code(tar.gz)
    Source code(zip)
  • http-test-v3.0.0-beta.3(Mar 9, 2021)

  • codegen-v0.5.0-beta.2(Mar 9, 2021)

  • http-v3.0.0-beta.4(Mar 8, 2021)

    Changed

    • Feature cookies is now optional and disabled by default. #1981
    • ws::hash_key now returns array. #2035
    • ResponseBuilder::json now takes impl Serialize. #2052

    Removed

    • Re-export of futures_channel::oneshot::Canceled is removed from error mod. #1994
    • ResponseError impl for futures_channel::oneshot::Canceled is removed. #1994
    Source code(tar.gz)
    Source code(zip)
  • awc-v3.0.0-beta.3(Mar 8, 2021)

    Added

    • ClientResponse::timeout for set the timeout of collecting response body. #1931
    • ClientBuilder::local_address for bind to a local ip address for this client. #2024

    Changed

    • Feature cookies is now optional and enabled by default. #1981
    • ClientBuilder::connector method would take actix_http::client::Connector<T, U> type. #2008
    • Basic auth password now takes blank passwords as an empty string instead of Option. #2050

    Removed

    • ClientBuilder::default function #2008
    Source code(tar.gz)
    Source code(zip)
  • http-v3.0.0-beta.3(Feb 10, 2021)

  • web-v4.0.0-beta.3(Feb 10, 2021)

  • codegen-v0.5.0-beta.1(Feb 10, 2021)

  • actors-v4.0.0-beta.2(Feb 10, 2021)

  • multipart-v0.4.0-beta.2(Feb 10, 2021)

  • files-v0.6.0-beta.2(Feb 10, 2021)

  • web-v4.0.0-beta.2(Feb 10, 2021)

    Added

    • The method Either<web::Json<T>, web::Form<T>>::into_inner() which returns the inner type for whichever variant was created. Also works for Either<web::Form<T>, web::Json<T>>. #1894
    • Add services! macro for helping register multiple services to App. #1933
    • Enable registering a vec of services of the same type to App #1933

    Changed

    • Rework Responder trait to be sync and returns Response/HttpResponse directly. Making it simpler and more performant. #1891
    • ServiceRequest::into_parts and ServiceRequest::from_parts can no longer fail. #1893
    • ServiceRequest::from_request can no longer fail. #1893
    • Our Either type now uses Left/Right variants (instead of A/B) #1894
    • test::{call_service, read_response, read_response_json, send_request} take &Service in argument #1905
    • App::wrap_fn, Resource::wrap_fn and Scope::wrap_fn provide &Service in closure argument. #1905
    • web::block no longer requires the output is a Result. #1957

    Fixed

    • Multiple calls to App::data with the same type now keeps the latest call's data. #1906

    Removed

    • Public field of web::Path has been made private. #1894
    • Public field of web::Query has been made private. #1894
    • TestRequest::with_header; use TestRequest::default().insert_header(). #1869
    • AppService::set_service_data; for custom HTTP service factories adding application data, use the layered data model by calling ServiceRequest::add_data_container when handling requests instead. #1906
    Source code(tar.gz)
    Source code(zip)
  • http-test-v3.0.0-beta.2(Feb 10, 2021)

  • awc-v3.0.0-beta.2(Feb 10, 2021)

    Added

    • ClientRequest::insert_header method which allows using typed headers. #1869
    • ClientRequest::append_header method which allows using typed headers. #1869
    • trust-dns optional feature to enable trust-dns-resolver as client dns resolver. #1969

    Changed

    • Relax default timeout for Connector to 5 seconds(original 1 second). #1905

    Removed

    • ClientRequest::set; use ClientRequest::insert_header. #1869
    • ClientRequest::set_header; use ClientRequest::insert_header. #1869
    • ClientRequest::set_header_if_none; use ClientRequest::insert_header_if_none. #1869
    • ClientRequest::header; use ClientRequest::append_header. #1869
    Source code(tar.gz)
    Source code(zip)
  • http-v3.0.0-beta.2(Feb 10, 2021)

    Added

    • IntoHeaderPair trait that allows using typed and untyped headers in the same methods. #1869
    • ResponseBuilder::insert_header method which allows using typed headers. #1869
    • ResponseBuilder::append_header method which allows using typed headers. #1869
    • TestRequest::insert_header method which allows using typed headers. #1869
    • ContentEncoding implements all necessary header traits. #1912
    • HeaderMap::len_keys has the behavior of the old len method. #1964
    • HeaderMap::drain as an efficient draining iterator. #1964
    • Implement IntoIterator for owned HeaderMap. #1964
    • trust-dns optional feature to enable trust-dns-resolver as client dns resolver. #1969

    Changed

    • ResponseBuilder::content_type now takes an impl IntoHeaderValue to support using typed mime types. #1894
    • Renamed IntoHeaderValue::{try_into => try_into_value} to avoid ambiguity with std TryInto trait. #1894
    • Extensions::insert returns Option of replaced item. #1904
    • Remove HttpResponseBuilder::json2(). #1903
    • Enable HttpResponseBuilder::json() to receive data by value and reference. #1903
    • client::error::ConnectError Resolver variant contains Box<dyn std::error::Error> type. #1905
    • client::ConnectorConfig default timeout changed to 5 seconds. #1905
    • Simplify BlockingError type to a unit struct. It's now only triggered when blocking thread pool is dead. #1957
    • HeaderMap::len now returns number of values instead of number of keys. #1964
    • HeaderMap::insert now returns iterator of removed values. #1964
    • HeaderMap::remove now returns iterator of removed values. #1964

    Removed

    • ResponseBuilder::set; use ResponseBuilder::insert_header. #1869
    • ResponseBuilder::set_header; use ResponseBuilder::insert_header. #1869
    • ResponseBuilder::header; use ResponseBuilder::append_header. #1869
    • TestRequest::with_hdr; use TestRequest::default().insert_header(). #1869
    • TestRequest::with_header; use TestRequest::default().insert_header(). #1869
    • actors optional feature. #1969
    • ResponseError impl for actix::MailboxError. #1969

    Documentation

    • Vastly improve docs and add examples for HeaderMap. #1964
    Source code(tar.gz)
    Source code(zip)
Owner
Actix
Actix - web and actor frameworks for Rust
Actix
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

Peter 604 Jun 11, 2021
Rust / Wasm framework for building client web apps

Yew Rust / Wasm client web app framework Documentation (stable) | Documentation (latest) | Examples | Changelog | Roadmap | 简体中文文档 | 繁體中文文檔 | ドキュメント A

Yew Stack 16k Jun 13, 2021
A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

null 30 May 24, 2021
A html document syntax and operation library written in Rust, use APIs similar to jQuery.

Visdom A server-side html document syntax and operation library written in Rust, it uses apis similar to jQuery, left off the parts thoes only worked

轩子 34 Apr 22, 2021
A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

null 175 Feb 10, 2021
A web framework for Rust.

Rocket Rocket is an async web framework for Rust with a focus on usability, security, extensibility, and speed. #[macro_use] extern crate rocket; #[g

Sergio Benitez 13.8k Jun 13, 2021
A fast static site generator in a single binary with everything built-in. https://www.getzola.org

zola (né Gutenberg) A fast static site generator in a single binary with everything built-in. Documentation is available on its site or in the docs/co

Zola 6.9k Jun 13, 2021
Grape is a REST-like API framework for Ruby

Grape is a REST-like API framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.

Ruby Grape 9.3k Jun 13, 2021
Sauron is an html web framework for building web-apps. It is heavily inspired by elm.

sauron Guide Sauron is an web framework for creating fast and interactive client side web application, as well as server-side rendering for back-end w

Jovansonlee Cesar 1.3k Jun 11, 2021
📮 An elegant Telegram bots framework for Rust

teloxide A full-featured framework that empowers you to easily build Telegram bots using the async/.await syntax in Rust. It handles all the difficult

teloxide 718 Jun 13, 2021
A super-easy, composable, web server framework for warp speeds.

warp A super-easy, composable, web server framework for warp speeds. The fundamental building block of warp is the Filter: they can be combined and co

Sean McArthur 4.9k Jun 14, 2021
Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome! Ping us on gitter to know more

Sōzu · Sōzu is a lightweight, fast, always-up reverse proxy server. Why use Sōzu? Hot configurable: Sozu can receive configuration changes at runtime

sōzu 1.4k Jun 12, 2021
Starlight is a JS engine in Rust which focuses on performance rather than ensuring 100% safety of JS runtime.

starlight Starlight is a JS engine in Rust which focuses on performance rather than ensuring 100% safety of JS runtime. Features Bytecode interpreter

null 260 Jun 16, 2021
问卷反馈收集, 前端脚手架安装向导, rust, gtk3, win32, dll

scaffold-wizard 这是一款加持了【图形用户界面】的npm - inquirer(名曰:问卷)。即,根据【问卷】配置文件,以人-机交互的形式,收集终端用户的【回答结果】。这里提到的【问卷配置】与【回答结果】都是*.json格式的字符串(或文件)。 【问卷】既能够作为.exe文件被双击运行

Stuart Zhang 25 Jun 6, 2021