Closed pjenvey closed 5 years ago
Running the above commands currently errors out at cargo update because of version conflicts with ring. I've seen this before. It requires choosing versions of all dependencies which depend on ring such that they all depend on the same version of ring. So, this will take some work to investigate a working combination of versions.
Looks like actix-web is working on 1.0.0 which updates a bunch of that.
Unfortunately. looks like there are also a number of breaking changes.
So, most of the changes are reasonably easy to deal with in the code. Two are a lot less so.
Apparently actix dropped rolling your own middleware, and having a TestServer.
actix-web's migration to 1.0 doc:
https://github.com/actix/actix-web/blob/master/MIGRATION.md
describes many of the App's initialization call changes that affects us, e.g. App::with_state(T) -> App.new().data(T)
A couple examples of conversion of custom Middleware -> Transform trait here:
The first rc is slated for release after the current beta3: https://github.com/actix/actix-web/issues/722#issuecomment-489384976
I'm postponing this upgrade for now. The upgrade of everything except middleware isn't too bad. We have an extensive use of middleware that calls into our extractors (FromRequest) and the 1.0 upgrade complicates this.
actix-web 1.0 upgrade requirements:
impl Future
vs actix-web's FutureResponsefor the middleware:
Middleware
trait to the new more low level Service
Trait + an associated Transform
start
/response
methods to a single call
method (like a Python decorator). Some of this is doneService::call
methods call into an inner service (a chain of Services). Some of our middlewares seem to require wrapping the inner service in a Rc<RefCell<S>>
HttpRequest
(and thus our associated extractors we heavily call in middlewares) is now discouraged from use within Service::call
. You can get an HttpRequest
by consuming a ServiceRequest
: but then you're unable to reconstruct a ServiceResponse
, a required argument to the next Service
call. DbTransaction
and PreConditionCheck
call into extractors numerous times. Allowing reconstruction of the original ServiceRequest
is unsafe. Solving this requires a large change for these 2 middlewares. Nikolay's looking into alternatives (like maybe FromRequest
can take a ServiceRequest
?)🎉🏆💯🎆
Edit: switched out this issue to solely focus on upgrading actix-web 1.0