From ce881b18e189cc8bdbe5b36e9b9b6b33941815d0 Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 29 Sep 2020 20:05:42 -0500 Subject: [PATCH] Switch other spawn blocking call oops --- http-signature-normalization-reqwest/Cargo.toml | 2 +- http-signature-normalization-reqwest/README.md | 2 +- http-signature-normalization-reqwest/src/digest/mod.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/http-signature-normalization-reqwest/Cargo.toml b/http-signature-normalization-reqwest/Cargo.toml index d2f848e..94dace6 100644 --- a/http-signature-normalization-reqwest/Cargo.toml +++ b/http-signature-normalization-reqwest/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "http-signature-normalization-reqwest" description = "An HTTP Signatures library that leaves the signing to you" -version = "0.1.2" +version = "0.1.3" authors = ["asonix "] license-file = "LICENSE" readme = "README.md" diff --git a/http-signature-normalization-reqwest/README.md b/http-signature-normalization-reqwest/README.md index 46d0412..ca00781 100644 --- a/http-signature-normalization-reqwest/README.md +++ b/http-signature-normalization-reqwest/README.md @@ -14,7 +14,7 @@ This crate provides extensions the RequestBuilder type from reqwest #### First, add this crate to your dependencies ```toml thiserror = "0.1" -http-signature-normalization-reqwest = { version = "0.1.1", default-features = false, features = ["sha-2"] } +http-signature-normalization-reqwest = { version = "0.1.3", default-features = false, features = ["sha-2"] } sha2 = "0.9" ``` diff --git a/http-signature-normalization-reqwest/src/digest/mod.rs b/http-signature-normalization-reqwest/src/digest/mod.rs index 3c475d1..a650efb 100644 --- a/http-signature-normalization-reqwest/src/digest/mod.rs +++ b/http-signature-normalization-reqwest/src/digest/mod.rs @@ -105,7 +105,12 @@ impl SignExt for RequestBuilder { Self: Sized, { Box::pin(async move { - let digest = tokio::task::block_in_place(|| digest.compute(v.as_ref())); + let (v, digest) = tokio::task::spawn_blocking(move || { + let digest = digest.compute(v.as_ref()); + (v, digest) + }) + .await + .map_err(|_| SignError::Canceled)?; let c = self .header("Digest", format!("{}={}", D::NAME, digest))