fix(async): clone Ref to avoid holding it across a suspend point

This commit is contained in:
Orhun Parmaksız 2021-12-05 14:13:25 +03:00
parent dbda1bb94a
commit 5cbb41c247
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -87,7 +87,7 @@ async fn upload(
client: web::Data<Client>, client: web::Data<Client>,
config: web::Data<Arc<Mutex<Config>>>, config: web::Data<Arc<Mutex<Config>>>,
) -> Result<HttpResponse, Error> { ) -> Result<HttpResponse, Error> {
let connection = request.connection_info(); let connection = request.connection_info().clone();
let host = connection.remote_addr().unwrap_or("unknown host"); let host = connection.remote_addr().unwrap_or("unknown host");
auth::check(host, request.headers(), env::var("AUTH_TOKEN").ok())?; auth::check(host, request.headers(), env::var("AUTH_TOKEN").ok())?;
let expiry_date = header::parse_expiry_date(request.headers())?; let expiry_date = header::parse_expiry_date(request.headers())?;