Through usage of 0.1, some breaking changes have been found to be needed. This is to track that all are dealt with when 0.2 is released.
get, post, put, and delete with the new get2, post2, put2, and delete2 filters.warp::cookie::optional_value.ws with ws2, Ws with Ws2.reject module.Rejection::cause().warp::path::index.Transport bound to Server::serve_incoming and Server::run_incoming.Also path::param should be replaced with path::param2, it from 25e6c4e09c898c103c0da0a6ddecf8625bfa762e
path::param2
I feel on the fence about it, personally. I could be convinced otherwise, but here's my thoughts:
param2 means it can't be the empty rejection set. If there are multiple of them, they don't combine for free.It is currently possibly to do what param2 does via param and and_then:
let route = warp::path::param::<String>()
.and_then(|param_s| {
param_s
.parse::<MyParamThing>()
.map_err(warp::reject::custom)
})
@seanmonstar I think we need a benchmark to see the performance penalty related to error handling.
I will do it this week.
Benchmarks for param vs param2: https://gist.github.com/dmexe/f8c51065785d18926f3daaeacd9c3efb
Result
test filters::path::benches::bench_param ... bench: 63 ns/iter (+/- 5)
test filters::path::benches::bench_param2 ... bench: 207 ns/iter (+/- 33)
param2 looks quite slowly in comparison to param
@seanmonstar The api was broken, starting a new project, not knowing how to choose, when will the 0.2 version be released?
Re: run_incoming - my current use-case for this framework is to run it behind a proxy so that I can easily restart the webserver without disrupting existing connections. I don't want to parse the HTTP traffic twice, so my solution was to just have the source IP be the first 4 bytes of the stream; however, it turned out that without editing the framework itself I couldn't actually set the source IP. It'd be really nice if it was possible to use a stream of i.e. (Option<SocketAddr>, impl AsyncRead+AsyncWrite) because the implementation is pretty much almost there, you just need to add an extra OptionLiftIo struct. I'm not sure if this needs an extra function, or if the existing one can be changed.
Most of these have been merged into master, there should be an alpha this week.
Most helpful comment
Most of these have been merged into master, there should be an alpha this week.