fix: Ensure the ready inner service is used

Cloning the inner service to use in call can mean a not-ready clone gets
used which violates the tower service preconditions. Replace the cloned
service with the ready service to ensure the right copy gets used. See
https://docs.rs/tower/0.4.13/tower/trait.Service.html#be-careful-when-cloning-inner-services
for more details

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
This commit is contained in:
Sjoerd Simons 2023-04-22 14:56:31 +02:00
parent f628617601
commit 1cec99e522

View file

@ -342,6 +342,9 @@ where
fn call(&mut self, req: Request<ReqBody>) -> Self::Future {
let inner = self.inner.clone();
// take the service that was ready
let inner = std::mem::replace(&mut self.inner, inner);
let auth_fut = self.authorize(req);
ResponseFuture {