A super-easy, composable, web server framework for warp speeds.

Overview

warp

crates.io Released API docs MIT licensed GHA Build Status Discord chat

A super-easy, composable, web server framework for warp speeds.

The fundamental building block of warp is the Filter: they can be combined and composed to express rich requirements on requests.

Thanks to its Filter system, warp provides these out of the box:

  • Path routing and parameter extraction
  • Header requirements and extraction
  • Query string deserialization
  • JSON and Form bodies
  • Multipart form data
  • Static Files and Directories
  • Websockets
  • Access logging
  • Gzip, Deflate, and Brotli compression

Since it builds on top of hyper, you automatically get:

  • HTTP/1
  • HTTP/2
  • Asynchronous
  • One of the fastest HTTP implementations
  • Tested and correct

Example

Add warp and Tokio to your dependencies:

tokio = { version = "1", features = ["full"] }
warp = "0.3"

And then get started in your main.rs:

use warp::Filter;

#[tokio::main]
async fn main() {
    // GET /hello/warp => 200 OK with body "Hello, warp!"
    let hello = warp::path!("hello" / String)
        .map(|name| format!("Hello, {}!", name));

    warp::serve(hello)
        .run(([127, 0, 0, 1], 3030))
        .await;
}

For more information you can check the docs or the examples.

Comments
  • Upgrade to Tokio 1.0

    Upgrade to Tokio 1.0

    Similar to @Urhengulas' PR #741, although more complete, this PR aims to upgrade to Tokio v1.0.

    I can successfully run all tests with all features enabled: cargo test --all-features.

    This is my first time trying to contribute to warp, and I'm not super familiar with the internals, so please consider it a best effort :)

    Fixes #725.

    opened by aknuds1 30
  • Upgrade to Tokio v1

    Upgrade to Tokio v1

    Dependencies which need to upgrade

    • [x] hyper (hyperium/hyper#2369)
    • [x] tokio-rustls (tokio-rs/tls#46)
    • [x] tokio-tungstenite (snapview/tokio-tungstenite#142)
    feature 
    opened by Urhengulas 26
  • Why warp is so slow? (compared to nginx)

    Why warp is so slow? (compared to nginx)

    Hi.

    I have been testing warp and nginx with a minimal content (just a "hello world" message) and noticed warp is very slow, but I'm not sure if the slowness is related to warp or something I'm doing wrong.

    The nginx config and content:

    nginx -v
    
    nginx version: nginx/1.16.1
    
    cat /etc/nginx/nginx.conf
    
    worker_processes auto;
    worker_cpu_affinity auto;
    events {
        worker_connections  10000;
    }
    http {
        access_log off;
        keepalive_timeout 65;
        server {
            listen 8080 default_server;
    ...
    
    cat /usr/share/nginx/html/index.html
    Hello World
    
    curl -v http://localhost:8080
    *   Trying ::1:8080...
    * TCP_NODELAY set
    * connect to ::1 port 8080 failed: Connection refused
    *   Trying 127.0.0.1:8080...
    * TCP_NODELAY set
    * Connected to localhost (127.0.0.1) port 8080 (#0)
    > GET / HTTP/1.1
    > Host: localhost:8080
    > User-Agent: curl/7.65.3
    > Accept: */*
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Server: nginx/1.16.1
    < Date: Thu, 30 Apr 2020 22:43:42 GMT
    < Content-Type: text/html
    < Content-Length: 12
    < Last-Modified: Thu, 30 Apr 2020 21:16:45 GMT
    < Connection: keep-alive
    < ETag: "5eab403d-c"
    < Accept-Ranges: bytes
    < 
    Hello World
    * Connection #0 to host localhost left intact
    

    The warp stuff:

    rustc --version
    rustc 1.43.0-nightly (2890b37b8 2020-03-06)
    
    cat examples/hello.rs 
    #![deny(warnings)]
    use warp::Filter;
    
    #[tokio::main]
    async fn main() {
        let routes = warp::any().map(|| "Hello World");
        warp::serve(routes).run(([0, 0, 0, 0], 8080)).await;
    }
    
    cargo build --release
    
    sudo ./target/release/examples/hello
    # using sudo just to get all kernel configurations
    
    curl -v http://localhost:8080
    *   Trying ::1:8080...
    * TCP_NODELAY set
    * connect to ::1 port 8080 failed: Connection refused
    *   Trying 127.0.0.1:8080...
    * TCP_NODELAY set
    * Connected to localhost (127.0.0.1) port 8080 (#0)
    > GET / HTTP/1.1
    > Host: localhost:8080
    > User-Agent: curl/7.65.3
    > Accept: */*
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < content-type: text/plain; charset=utf-8
    < content-length: 11
    < date: Thu, 30 Apr 2020 22:43:13 GMT
    < 
    * Connection #0 to host localhost left intact
    

    Environment

    lscpu
    
    Architecture:        x86_64
    CPU op-mode(s):      32-bit, 64-bit
    Byte Order:          Little Endian
    Address sizes:       43 bits physical, 48 bits virtual
    CPU(s):              8
    On-line CPU(s) list: 0-7
    Thread(s) per core:  2
    Core(s) per socket:  4
    Socket(s):           1
    NUMA node(s):        1
    Vendor ID:           AuthenticAMD
    CPU family:          23
    Model:               24
    Model name:          AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
    Stepping:            1
    CPU MHz:             1295.685
    CPU max MHz:         2300.0000
    CPU min MHz:         1400.0000
    BogoMIPS:            4591.23
    Virtualization:      AMD-V
    L1d cache:           32K
    L1i cache:           64K
    L2 cache:            512K
    L3 cache:            4096K
    NUMA node0 CPU(s):   0-7
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
    
    lsb_release -a
    
    LSB Version: core-4.1-amd64:core-4.1-noarch
    Distributor ID: Fedora
    Description: Fedora release 30 (Thirty)
    Release: 30
    Codename: Thirty
    

    Finally, the tests using wrk!

    wrk results (avg, after three intervaled tests) for nginx

    ./wrk -t10 -c1000 -d10s --latency http://127.0.0.1:8080/
    Running 10s test @ http://127.0.0.1:8080/
      10 threads and 1000 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    14.48ms   16.27ms 285.61ms   90.53%
        Req/Sec     8.12k     1.59k   15.99k    78.23%
      Latency Distribution
         50%   10.07ms
         75%   16.66ms
         90%   29.94ms
         99%   72.74ms
      807992 requests in 10.10s, 190.29MB read
    Requests/sec:  79976.39
    Transfer/sec:     18.84MB
    

    wrk results (avg) for warp

    ./wrk -t10 -c1000 -d10s --latency http://127.0.0.1:8080/
    Running 10s test @ http://127.0.0.1:8080/
      10 threads and 1000 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    32.43ms    2.92ms  41.16ms   70.49%
        Req/Sec     3.08k   325.14     3.97k    72.20%
      Latency Distribution
         50%   32.07ms
         75%   34.20ms
         90%   36.97ms
         99%   39.35ms
      306502 requests in 10.06s, 37.41MB read
    Requests/sec:  30474.16
    Transfer/sec:      3.72MB
    

    (using wrk compiled by sources on Fedora30 with Clang 8.0)

    Notice warp is about three times slower than nginx.

    P.S. 1.: I did more tests using ApacheBench and JMeter with five machines (clients) connected to an external server remotely (with some limits due to internet bandwidth) providing a larger content (around 150 kB), but got slower results in warp again. 😕

    P.S. 2: Notice the nginx.conf on top of this message. How to apply those configs in warp? (specially worker_processes, worker_cpu_affinity and worker_connections).

    Why?

    I don't know if there is any specific configuration to increase the warp speed. I would appreciate it and retest to get better results.

    TIA for any help!

    opened by silvioprog 24
  • trailing slash redirect

    trailing slash redirect

    Every day something new. Today I discovered the "trailing slash" dilemma. I use Warp to reply dynamic content:

    warp::path!("cargo_crev_web" / "info" ).map(|| {
            let info_data = proof_index_mod::InfoData::new();
            let html_file = info_data.render_html_file("templates/");
            warp::reply::html(html_file)
    

    This 2 routes seems the same: https://bestia.dev/cargo_crev_web/info/ https://bestia.dev/cargo_crev_web/info But unfortunately there are some subtle (unpredictable) differences. On the page there is a relative link:

    <div><a style="color:white" href="group_by_crate">group by crate</a></div>
    

    So if you click on the link "group by crate" there is a difference how the relative routes are calculated. With the first route with trailing slash, the link is correct: https://bestia.dev/cargo_crev_web/info/group_by_crate The relative link is added. This is what I want. But with the second link without trailing slashes, the link is invalid: https://bestia.dev/cargo_crev_web/group_by_crate The /info/ part is completely missing. It was a surprise to me. Not a good one. The recommended thing to do is a redirect from without slash to trailing slash. Do you have some experience how to solve this in Warp?

    feature 
    opened by bestia-dev 22
  • Improved rejections

    Improved rejections

    I get the impression that the rejection system in this crate ought to be severely refactored. The rejections example does not show a simple way of handling functions which return Results:

    async fn login(credentials: Credentials) -> Result<UserSession, LoginError> {
        ...
    }
    

    which is the standard way of handling Errors in Rust. The suggested way of handling this seems to be to

    • implement Reject for LoginError (which requires me to own the LoginError type)
    • call recover after the handling filter with a "rejection handler" function, which converts rejections into a Reply type which can be sent by warp

    This causes a lot of cognitive and syntactic overhead, and I think the crate would benefit a lot from a refactor like this.

    feature 
    opened by mankinskin 20
  • Add a tracing filter which enables contextual, structured logging

    Add a tracing filter which enables contextual, structured logging

    Tracing enables us to keep track of some contextual state throughout the lifetime of a request. This means that any logging done when processing a request will automatically also log the context. This is especially useful when processing requests in parallel because it means that one can separate intertwined logs.

    The author of tracing made a good and informative video about the subject, and showing off some of the benefits.

    This is based upon @emschwartz issue and his previous work.

    This is mainly a rough first implementation to see if you would like this feature. If you are interested in this feature I was planning to go through all uses of log in the crate to replace with appropriate span's and event's. What do you think @seanmonstar ?

    Closes #288

    opened by barskern 20
  • Implemented `Filter::then`

    Implemented `Filter::then`

    Tipping point for me to jump into Future type hell to implement this was this comment - but I'd say it's worth it. I've used it in my personal project for a while, and the code I've been able to write is much cleaner, I think.

    Changes:

    • Added Filter::then() and complementary type Then. Exactly like map, but async. The name is meant to reflect future's then() function.
    • Filter::and_then() documentation now points to Filter::then() as an alternative, since my understanding is that:

      Rejections are meant to say "this filter didn't accept the request, maybe another can."

    Fix #712 Fix #594

    Providing Reply implementations for Result would also be very useful, so this is loosely related to #458


    Post-edit note: This function was renamed from map_async to then to more closely match future's api. However it is worth noting that just as Filter::map isn't exactly like future's map on account of rejections, Filter::then isn't exactly like future's then. However Filter::then is the same, conceptually, as future's then, so this seems like the best choice.

    opened by gtsiam 18
  • Add multipart filters

    Add multipart filters

    It would be nice to include some built-in filters in warp::multipart (or warp::body?). I'm not sure what the API should look like. Some things that come to mind that a user could want to do:

    • Decode a multipart body via serde::Deserialize.
    • Receive a file upload.
    • Receive multiple file uploads.
    • Allow streaming of the data, since buffering an entire file upload in memory could be bad if the files are huge.
    feature 
    opened by seanmonstar 18
  • Custom `with` filters

    Custom `with` filters

    Under the current api, Filter::with requires that the type be W: Wrap however the Wrap trait is sealed making it difficult to write custom wrapping filters. For instance, I'm trying to write a filter that will forward a header from a request to the response. So far I've come up with the filter to generate the either grab the request id or generate a new one:

    let req_id = warp::header::<String>("x-request-id").or_else(|_| Ok(("generated".to_owned(),)))
    

    But I can't figure out using the combinators provided how to store the request-id in the filter and use it on the response.

    It also seems that you cannot call map after returning a warp::reply in the combinator chain so I can't even make the above work with boiler plate something like

    let my_route = req_id.map(warp::reply).map(|id: String, reply: warp::Reply| {
        reply.set_header("x-request-id", id)
    })
    
    rfc 
    opened by bbatha 17
  • Compile time is in minutes...

    Compile time is in minutes...

    I'm seeing compile times on the order of minutes for a small < 10 route service.

        Finished dev [unoptimized + debuginfo] target(s) in 3m 12s
         Running `target/debug/mtbox-warp-admin`
    

    What are some things that I could look for to help shrink this to something more manageable?

    opened by scull7 14
  • warp 0.2 is slow in benchmarks

    warp 0.2 is slow in benchmarks

    In Framework Benchmarks, warp 0.2 is very very slow (check for entry called warp-rust): https://www.techempower.com/benchmarks/#section=test&runid=7f65c127-fad2-4a88-a6cb-5333c68362ef&hw=ph&test=plaintext

    This isn't the issue with warp 0.1 (again, check for entry called warp-rust): https://www.techempower.com/benchmarks/#section=test&runid=d13756ac-4638-4c62-b1b4-cde1fd47a72a&hw=ph&test=plaintext

    250,000 performance score seems much worse than 1,800,000. PHP running with php-fpm and nginx is faster than warp 0.2. It may be worth looking into why, because that's really unexpected.

    Benchmark code: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Rust/warp-rust/src/main.rs

    opened by xfix 14
  • Master branch fails `cargo test` on current nightly

    Master branch fails `cargo test` on current nightly

    I just tried to rebase #909 and CI failed.

    I tested again with nightly-2022-09-27 and the tests passed, but the master branch fails cargo test with current nightly.

    Seems some of the examples/tests are now errors (correctly so, at least at first glance).

    bug 
    opened by gtsiam 0
  • #1002 Performance of Rejections::into_response is improved.

    #1002 Performance of Rejections::into_response is improved.

    The present PR improves the performance of Rejections::into_response(). Compared to the original approach it calls status only for known or custom instances, which allows to avoid exponential complexity. A test is added to check that the response is computed in a reasonable time, with the original implementation the test fails to complete in 1 minute.

    opened by alexeiakimov 1
  • `warp::filters::ws::Message::to_str(&self)` should have more verbose errors

    `warp::filters::ws::Message::to_str(&self)` should have more verbose errors

    Is your feature request related to a problem? Please describe. i keep geting errors that error converting to string with no context as to why it couldent.

    Describe the solution you'd like instead of returning Result<&str, ()> return Result<&str, impl std::error::Error>

    Describe alternatives you've considered n/a

    Additional context i see from scrolling through the src code that its prob because my data is not of type String but ether way a error type of () is not acceptible.

    feature 
    opened by makerio90 0
  • Two way TLS handshake error

    Two way TLS handshake error

    Version warp = {version = "0.3.3", features = ["tls"]}

    Platform macOS 12.5

    Description I am trying to setup dual TLS for warp, however the TLS handshake fails on client authorization.

    Code snippet:

        async fn handler() -> Result<impl Reply, Rejection> {
            Ok("success".to_string())
        }
    
        #[tokio::main]
        pub async fn web_service() {
            let metrics_route = warp::path("metrics").and(warp::get()).and(warp::path::end()).and_then(handler);
            warp::serve(metrics_route)
                .tls()
                .cert_path("server/cert.pem")
                .key_path("server/rsaprivkey.pem")
                .client_auth_required_path("client/cert.pem")
                .run(([0, 0, 0, 0], 9100)).await;
        }
    

    Private keys and certificate generation (separately in client and server folders):

    openssl genrsa -out rsaprivkey.pem 2048
    openssl pkcs8 -topk8 -inform PEM -outform PEM -in rsaprivkey.pem -out rsaprivkey8.pem -nocrypt
    openssl req -new -x509 -key rsaprivkey8.pem -out cert.pem
    rm rsaprivkey.pem 
    mv rsaprivkey8.pem rsaprivkey.pem 
    
    

    To test:

    1. start web_service
    2. in terminal: run openssl s_client -connect localhost:9100 -cert client/cert.pem -key client/rsaprivkey.pem -CAfile server/cert.pem -debug output:
    ***
    4377953664:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:ssl/record/rec_layer_s3.c:1544:SSL alert number 40
    

    OR

    run curl -k -iv --cert client/cert.pem --key client/rsaprivkey.pem --cacert server/cert.pem https://localhost:9100 output:

    *   Trying 127.0.0.1:9100...
    * Connected to localhost (127.0.0.1) port 9100 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *  CAfile: server/cert.pem
    *  CApath: none
    * (304) (OUT), TLS handshake, Client hello (1):
    * (304) (IN), TLS handshake, Server hello (2):
    * (304) (IN), TLS handshake, Unknown (8):
    * (304) (IN), TLS handshake, Request CERT (13):
    * (304) (IN), TLS handshake, Certificate (11):
    * (304) (IN), TLS handshake, CERT verify (15):
    * (304) (IN), TLS handshake, Finished (20):
    * (304) (OUT), TLS handshake, Certificate (11):
    * (304) (OUT), TLS handshake, CERT verify (15):
    * (304) (OUT), TLS handshake, Finished (20):
    * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
    * ALPN, server accepted to use h2
    * Server certificate:
    *  subject: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd
    *  start date: Nov  8 08:38:26 2022 GMT
    *  expire date: Dec  8 08:38:26 2022 GMT
    *  issuer: C=AU; ST=Some-State; O=Internet Widgits Pty Ltd
    *  SSL certificate verify ok.
    * Using HTTP2, server supports multiplexing
    * Connection state changed (HTTP/2 confirmed)
    * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
    * Using Stream ID: 1 (easy handle 0x140014000)
    > GET / HTTP/2
    > Host: localhost:9100
    > user-agent: curl/7.79.1
    > accept: */*
    > 
    * LibreSSL SSL_read: error:1404C410:SSL routines:ST_OK:sslv3 alert handshake failure, errno 0
    * Failed receiving HTTP2 data
    * LibreSSL SSL_write: SSL_ERROR_SYSCALL, errno 0
    * Failed sending HTTP2 data
    * Connection #0 to host localhost left intact
    curl: (56) LibreSSL SSL_read: error:1404C410:SSL routines:ST_OK:sslv3 alert handshake failure, errno 0
    

    Everything works fine when I disable client authentication. It may be that I misunderstand the way dual TLS should be used, but I spent a lot of time trying to make this work (including different ways and types of ssl keys and certificates)

    bug 
    opened by hank179 0
Releases(v0.3.2)
  • v0.3.2(Nov 9, 2021)

    Features:

    • Add Filter::then(), which is like Filter::map() in that it's infallible, but is async like Filter::and_then().
    • Add redirect::found() reply helper that returns 302 Found.
    • Add compression-brotli and compression-gzip cargo features to enable only the compression you need.
    • Allow HEAD requests to be served to fs::dir() filters.
    • Allow path!() with no arguments.

    Fixes:

    • Update private dependencies Tungstenite and Multipart.
    • Replaces uses of futures with futures-util, which is a smaller dependency.

    New Contributors

    • @viraptor made their first contribution in https://github.com/seanmonstar/warp/pull/825
    • @zenria made their first contribution in https://github.com/seanmonstar/warp/pull/835
    • @Aankhen made their first contribution in https://github.com/seanmonstar/warp/pull/849
    • @FlorianDr made their first contribution in https://github.com/seanmonstar/warp/pull/843
    • @adamchalmers made their first contribution in https://github.com/seanmonstar/warp/pull/858
    • @ekzhang made their first contribution in https://github.com/seanmonstar/warp/pull/860
    • @utkarshkukreti made their first contribution in https://github.com/seanmonstar/warp/pull/696
    • @johannescpk made their first contribution in https://github.com/seanmonstar/warp/pull/861
    • @sindreij made their first contribution in https://github.com/seanmonstar/warp/pull/864
    • @haileys made their first contribution in https://github.com/seanmonstar/warp/pull/701
    • @In-line made their first contribution in https://github.com/seanmonstar/warp/pull/836
    • @0xdeafbeef made their first contribution in https://github.com/seanmonstar/warp/pull/839
    • @emesterhazy made their first contribution in https://github.com/seanmonstar/warp/pull/866
    • @joseluisq made their first contribution in https://github.com/seanmonstar/warp/pull/869
    • @JasterV made their first contribution in https://github.com/seanmonstar/warp/pull/873
    • @aujxn made their first contribution in https://github.com/seanmonstar/warp/pull/876
    • @simonborje made their first contribution in https://github.com/seanmonstar/warp/pull/883
    • @yaymukund made their first contribution in https://github.com/seanmonstar/warp/pull/885
    • @SeanChao made their first contribution in https://github.com/seanmonstar/warp/pull/890
    • @e-user made their first contribution in https://github.com/seanmonstar/warp/pull/877
    • @gtsiam made their first contribution in https://github.com/seanmonstar/warp/pull/878
    • @bkgood made their first contribution in https://github.com/seanmonstar/warp/pull/896
    • @nylonicious made their first contribution in https://github.com/seanmonstar/warp/pull/906
    • @Some-Dood made their first contribution in https://github.com/seanmonstar/warp/pull/912
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Mar 25, 2021)

    • Features:
      • Add pong constructor to websocket messages.
      • Add redirect::see_other and redirect::permanent helpers.
    • Fixes:
      • Fix fs filters sometimes having an off-by-one error with range requests.
      • Fix CORS to allow spaces when checking Access-Control-Request-Headers.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jan 19, 2021)

    • Features:
      • Add TLS client authentication support.
      • Add TLS OCSP stapling support.
      • Add From<Reject> for Rejection.
      • Add close_frame accessor to ws::Message.
    • Changes:
      • Update to Tokio v1.
      • Update to Bytes v1.
      • Update to hyper v0.14.
      • Rework sse filter to be more like ws, with a single Event type and builder.
      • Change cookie filter to extract a generic FromStr value.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.5(Aug 31, 2020)

    • Features:
      • Add wrap_fn, which can be used to create a Wrap from a closure. These in turn are used with Filter::with().
      • Add warp::host filters to deal with Host/:authority headers.
      • Relax some lifetime bounds on Server.
    • Fixes:
      • Fix panic when URI doesn't have a slash (for example, CONNECT foo.bar).
    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Jul 20, 2020)

    • Features:
      • Add tracing internals in place of log (log is still emitted for backwards compatibility).
      • Add warp::trace module set of filters to customize tracing dianostics.
      • Add path method to warp::fs::File reply.
      • Add source implementation for BodyDeserializeError.
      • Make warp::ws::MissingConnectionUpgrade rejection public.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(May 19, 2020)

    • Features:
      • Add warp::compression filters, which will compress response bodies.
      • Add warp::header::value() filter to get a request HeaderValue.
      • Add request_headers method to warp::log::Info.
      • Add max_frame_size to warp::ws::Ws builder.
      • Add remote_addr to warp::test::RequestBuilder.
      • Add try_bind_with_graceful_shutdown to warp::Server builder.
      • Add serve_incoming_with_graceful_shutdown to warp::Server builder.
    • Fixes:
      • Fix warp::addr::remote when used with Server::tls.
      • Fix panic in warp::path::{peek, tail, full} filters when the request URI is in authority-form or asterisk-form.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(May 19, 2020)

    • Features:
      • Implement Reply for all Box<T> where T: Reply.
      • Add name methods to MissingHeader, InvalidHeader, and MissingCookie rejections.
      • Add warp::ext::optional() filter that optionally retrieves an extension from the request.
    • Fixes:
      • Fix the sending of pings when a user sends a ws::Message::ping().
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Jan 23, 2020)

  • v0.2.0(Jan 16, 2020)

    • Features:
      • Update to std::future, adding async/await support!
      • Add warp::service() to convert a Filter into a tower::Service.
      • Implement Reply for Box<dyn Reply>.
    • Changes:
      • Refactored Rejection system (#311).
      • Change path! macro to assume a path::end() by default, with explicit / .. to allow building a prefix (#359).
      • Change warp::path(str) to accept any AsRef<str> argument.
      • Rename "2"-suffixed filters and types (get2 to get, ws2 to ws, etc).
      • Filter::{or, or_else, recover} now require Self::Error=Rejection. This helps catch filters that didn't make sense (like warp::any().or(warp::get())).
      • Change several warp::body filters (#345).
      • Change warp::cors() to return a warp::cors::Builder which still implements Wrap, but can also build a cheaper-to-clone wrapper.
      • Change warp::multipart stream API to allow for errors when streaming.
      • Change warp::sse to no longer return a Filter, adds warp::sse::reply to do what Sse::reply did.
      • Change Server::tls() to return a TLS server builder (#340).
      • Change internal warp::never::Never usage with std::convert::Infallible.
      • Remove warp::ext::set() function (#222).
      • Remove deprecated warp::cookie::optional_value().
    Source code(tar.gz)
    Source code(zip)
  • v0.1.20(Jan 16, 2020)

  • v0.1.19(Jan 16, 2020)

    • Features:
      • Make warp::multipart and warp::ws support optional, though enabled by default.
    • Fixes:
      • Fix warp::fs::dir filter to reject paths containing backslashes.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.18(Jul 26, 2019)

  • v0.1.17(Jul 26, 2019)

  • v0.1.16(Jul 26, 2019)

    • Features:
      • Unseal the Reply trait: custom types can now implement Reply.
      • Add warp::sse::keep_alive() replacement for warp::sse::keep() which allows customizing keep-alive behavior.
      • Add warp::log::Info::host() accessor.
    • Fixes:
      • Fix warp::fs filters from sending some headers for 304 responses.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.15(Jul 26, 2019)

  • v0.1.14(Jul 26, 2019)

  • v0.1.13(Jul 26, 2019)

    • Features:
      • Implement Reply for Vec<u8> and &'static [u8].
      • Set content-type header automatically for string and bytes replies.
      • Add expose_headers to warp::cors filter.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.12(Jan 29, 2019)

    • Features:
      • Implement PartialEq, Eq, and Clone for warp::ws::Message.
    • Fixes:
      • Fix panic when incoming request URI may not have a path (such as CONNECT requests).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.11(Jan 14, 2019)

    • Features:
      • Add warp::sse filters for handling Server-Sent-Events.
      • Add allow_headers to warp::cors filter.
    • Fixes:
      • Fix TLS handshake to close the connection if handshake fails.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.10(Dec 29, 2018)

    • Features:
      • Add optional TLS support. Enable the tls feature, and then use Server::tls.
      • Add warp::cors filter for CORS support.
      • Add warp::addr::remote to access the remote address of a request.
      • Add warp::log::custom to support customizing of access logging.
      • Add warp::test::ws to improve testing Websocket filters.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.9(Oct 31, 2018)

    • Features:
      • Add warp::ext::get and warp::ext::set to set request extensions.
      • Add Filter::untuple_one to unroll nested tuple layers from extractions.
      • Add Ws2::max_send_queue configuration method.
      • Add ws::Message::is_ping method, and yield pings to user code.
    • Fixes:
      • Fix panic in debug mode when receiving a websocket ping.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.8(Oct 25, 2018)

    • Features:
      • Improved flexibility of Rejection system.

        The Rejection type can now nest and combine arbitrary rejections, so it is no longer bound to a small set of meanings. The ranking of status codes is still used to determine which rejection gets priority.

        A different priority can be implemented by handling rejections with a Filter::recover, and searching for causes in order via Rejection::find_cause.

        • Adds warp::reject::custom() to create a Rejection with any Into<Box<std::error::Error>>. These rejections should be handled with an eventual Filter::recover. Any unhandled custom rejections are considered a server error.
        • Deprecates Rejection::with. Use custom rejections instead.
        • Deprecates Rejection::into_cause, as it can no longer work. Always returns Err(Rejection).
        • Deprecates Rejection::json, since the format needed is too generic. The errors.rs example shows how to send custom JSON when recovering from rejections.
        • Deprecates warp::reject(), since it current signals a 400 Bad Request, but in newer versions, it will signal 404 Not Found. It's deprecated simply to warn that the semantics are changing, but the function won't actually go away.
        • Deprecates reject::bad_request(), reject::forbidden(), and reject::server_error(). Uses custom rejections instead.
      • Renamed warp::path::index to warp::path::end.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.7(Oct 15, 2018)

    • Features:

      • Export the types returned from the warp::body::stream() filter, BodyStream and StreamBuf.
      • Deprecated Rejection::into_cause, since an upcoming Rejection refactor will make it impossible to support.
    • Fixes:

      • Fix websocket filters to do a case-insensitive match of the Connection header.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.6(Oct 5, 2018)

    • Features:
      • Add Conditional and Range request support for warp::fs filters.
      • Relaxed bounds on Rejection::with to no longer need to be Sized.
      • Add warp::path::peek() which gets the unmatched tail without adjusting the currently matched path.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.5(Oct 3, 2018)

    • Features:

      • Serve index.html automatically with warp::fs::dir filter.
      • Include last-modified header with warp::fs filters.
      • Add warp::redirect to easily reply with redirections.
      • Add warp::reply::{with_status, with_header} to wrap impl Replys directly with a new status code or header.
      • Add support for running a warp Server with a custom source of incoming connections.
        • Server::run_incoming to have the runtime started automatically.
        • Server::serve_incoming to get a future to run on existing runtime.
        • These can be used to support Unix Domain Sockets, TLS, and other transports.
      • Add Rejection::into_cause() to retrieve the original error of a rejection back.
      • Add Rejection::json() to convert a rejection into a JSON response.
    • Fixes

      • Internal errors in warp that result in rendering a 500 Internal Server Error are now also logged at the error level.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(Oct 3, 2018)

    • Features:
      • Add warp::reply::with::headers(HeaderMap) filter wrapper.
      • Add warp::cookie::optional() to get an optional cookie value.
      • Add warp::path::full() to be able to extract the full request path without affecting route matching.
      • Add graceful shutdown support to the Server.
      • Allow empty query strings to be treated as for warp::query().
    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Oct 3, 2018)

    • Features:
      • Add warp::reject::forbidden() to represent 403 Forbidden responses.
      • Add Rejection::with(cause) to customize rejection messages.
    • Fixes:
      • Fix warp::body::form to allow charsets in the content-type header.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Oct 3, 2018)

    • Features:
      • Implemented Reply for Response<impl Into<hyper::Body>, allowing streaming response bodies.
      • Add warp::body::stream() filter to access the request body as an impl Stream.
      • Add warp::ws2() as a more flexible websocket filter.
        • This allows passing other extracted values to the upgrade callback, such as a value from a header or path.
        • Deprecates warp::ws(), and ws2() will become ws() in 0.2.
      • Add warp::get2(), warp::post2(), warp::put2(), and warp::delete2() as more standard method filters that are used via chaining instead of nesting.
        • get(), post(), put(), and delete() are deprecated, and the new versions will become them in 0.2.
      • Add Filter::unify() for when a filter returns Either<T, T>, converting the Either into the inner T, regardless of which variant it was.
        • This requires that both sides of the Either be the same type.

        • This can be useful when extracting a value that might be present in different places of the request.

          // Allow `MyId` to be a path parameter or a header...
          let id = warp::path::param::<MyId>()
              .or(warp::header::<MyId>())
              .unify();
          
          // A way of providing default values...
          let dnt = warp::header::<bool>("dnt")
              .or(warp::any().map(|| true))
              .unify();
          
      • Add content-type header automatically to replies from file and dir filters based on file extension.
      • Add warp::head(), warp::options(), and warp::patch() as new Method filters.
      • Try to use OS blocksize in warp::fs filters.
    • Fixes:
      • Chaining filters that try to consume the request body will log that the body is already consumed, and return a 500 Internal Server Error rejection.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Aug 8, 2018)

    • Features:
      • add warp::query::raw() filter to get query as a String.
      • add Filter::recover() to ease customizing of rejected responses.
      • add warp::header::headers_clone() filter to get a clone of request's HeaderMap.
      • add warp::path::tail() filter to get remaining "tail" of the request path.
    • Fixes:
      • URL decode path segments in warp::fs filters.
    Source code(tar.gz)
    Source code(zip)
A very basic "clone" of Reddit's r/place written in Rust using warp

r(usty)/place A very basic "clone" of r/place written in Rust using warp. Instead of rendering the image on the client side, the image is encoded as P

canta slaus 3 Dec 27, 2022
Super Fast & High Performance minimalist web framework for rust

Super Fast & High Performance minimalist web framework for rust

null 6 Oct 12, 2022
A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Poem Web 2.2k Jan 6, 2023
Hot reload static web server for deploying mutiple static web site with version control.

SPA-SERVER It is to provide a static web http server with cache and hot reload. 中文 README Feature Built with Hyper and Warp, fast and small! SSL with

null 7 Dec 18, 2022
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.7k Dec 26, 2022
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

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

Actix 16.2k Jan 2, 2023
A (flash) message framework for actix-web. A port to Rust of Django's message framework.

actix-web-flash-messages Flash messages for actix-web Web applications sometimes need to show a one-time notification to the user - e.g. an error mess

Luca Palmieri 31 Dec 29, 2022
Trulang is an interpreted language that is designed to be a simple, easy to learn, and easy to use programming language.

Trulang is an interpreted language that is designed to be a simple, easy to learn, and easy to use programming language.

Bunch-of-cells 2 Nov 23, 2022
Markdown LSP server for easy note-taking with cross-references and diagnostics.

Zeta Note is a language server that helps you write and manage notes. The primary focus is to support Zettelkasten-like1, 2 note taking by providing an easy way to cross-reference notes (see more about features below).

Artem Pyanykh 4 Oct 27, 2022
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 179 Dec 25, 2022
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 32 Apr 11, 2022
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 19.4k Jan 4, 2023
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 25.8k Jan 2, 2023
Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

null 913 Dec 27, 2022
Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability

arctic_hen7 1.2k Jan 8, 2023
Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

null 3.6k Jan 6, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
Axum web framework tutorial for beginners.

Axum Tutorial For Beginners Hello web developers! This tutorial will cover how to write simple web applications in rust with axum framework. If you ar

Eray Karatay 46 Jan 5, 2023
Ergonomic and modular web framework built with Tokio, Tower, and Hyper

axum axum is a web application framework that focuses on ergonomics and modularity. More information about this crate can be found in the crate docume

Tokio 7.9k Dec 31, 2022