diff --git a/Cargo.lock b/Cargo.lock index 9d8d0c24a..53e8afb68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,9 +169,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "aws-config" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a636c44c77fa18bdba56126a34d30cfe5538fe88f7d34988fa731fee143ddd" +checksum = "e7688e1dfbb9f7804fab0a830820d7e827b8d973906763cf1a855ce4719292f5" dependencies = [ "aws-http", "aws-sdk-sso", @@ -197,9 +197,9 @@ dependencies = [ [[package]] name = "aws-endpoint" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ca8f374874f6459aaa88dc861d7f5d834ca1ff97668eae190e97266b5f6c3fb" +checksum = "253d7cd480bfa59a5323390e9e91885a8f06a275e0517d81eeb1070b6aa7d271" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -211,9 +211,9 @@ dependencies = [ [[package]] name = "aws-http" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d41e19e779b73463f5f0c21b3aacc995f4ba783ab13a7ae9f5dfb159a551b4" +checksum = "4cd1b83859383e46ea8fda633378f9f3f02e6e3a446fd89f0240b5c3662716c9" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -229,9 +229,9 @@ dependencies = [ [[package]] name = "aws-sdk-cloudfront" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04be23a4cae13b235e2bcbbaa123a6c3898a1b5cf40802ca38f9058fb6b60ed7" +checksum = "42a73e9c57ea9a06beb2aa815b1ff3ddcac60753b03be7373a3539b5cac3d50d" dependencies = [ "aws-endpoint", "aws-http", @@ -251,9 +251,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9f08665c8e03aca8cb092ef01e617436ebfa977fddc1240e1b062488ab5d48a" +checksum = "c4d240ff751efc65099d18f6b0fb80360b31a298cec7b392c511692bec4a6e21" dependencies = [ "aws-endpoint", "aws-http", @@ -270,6 +270,7 @@ dependencies = [ "aws-types", "bytes", "bytes-utils", + "fastrand", "http", "http-body", "tokio-stream", @@ -279,9 +280,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86dcb1cb71aa8763b327542ead410424515cff0cde5b753eedd2917e09c63734" +checksum = "bf03342c2b3f52b180f484e60586500765474f2bfc7dcd4ffe893a7a1929db1d" dependencies = [ "aws-endpoint", "aws-http", @@ -301,9 +302,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdfcf584297c666f6b472d5368a78de3bc714b6e0a53d7fbf76c3e347c292ab1" +checksum = "aa1de4e07ea87a30a317c7b563b3a40fd18a843ad794216dda81672b6e174bce" dependencies = [ "aws-endpoint", "aws-http", @@ -319,13 +320,14 @@ dependencies = [ "bytes", "http", "tower", + "tracing", ] [[package]] name = "aws-sig-auth" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cbe7b2be9e185c1fbce27fc9c41c66b195b32d89aa099f98768d9544221308" +checksum = "6126c4ff918e35fb9ae1bf2de71157fad36f0cc6a2b1d0f7197ee711713700fc" dependencies = [ "aws-sigv4", "aws-smithy-eventstream", @@ -337,29 +339,30 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ff4cff8c4a101962d593ba94e72cd83891aecd423f0c6e3146bff6fb92c9e3" +checksum = "84c7f88d7395f5411c6eef5889b6cd577ce6b677af461356cbfc20176c26c160" dependencies = [ "aws-smithy-eventstream", "aws-smithy-http", "bytes", "form_urlencoded", "hex", + "hmac", "http", "once_cell", "percent-encoding 2.2.0", "regex", - "ring", + "sha2", "time 0.3.17", "tracing", ] [[package]] name = "aws-smithy-async" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3442b4c5d3fc39891a2e5e625735fba6b24694887d49c6518460fde98247a9" +checksum = "3e6a895d68852dd1564328e63ef1583e5eb307dd2a5ebf35d862a5c402957d5e" dependencies = [ "futures-util", "pin-project-lite", @@ -369,9 +372,9 @@ dependencies = [ [[package]] name = "aws-smithy-checksums" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc227e36e346f45298288359f37123e1a92628d1cec6b11b5eb335553278bd9e" +checksum = "72b847d960abc993319d77b52e82971e2bbdce94f6192df42142e14ed5c9c917" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -390,9 +393,9 @@ dependencies = [ [[package]] name = "aws-smithy-client" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff28d553714f8f54cd921227934fc13a536a1c03f106e56b362fd57e16d450ad" +checksum = "f505bf793eb3e6d7c166ef1275c27b4b2cd5361173fe950ac8e2cfc08c29a7ef" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -415,9 +418,9 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ea0df7161ce65b5c8ca6eb709a1a907376fa18226976e41c748ce02ccccf24" +checksum = "d751c99da757aecc1408ab6b2d65e9493220a5e7a68bcafa4f07b6fd1bc473f1" dependencies = [ "aws-smithy-types", "bytes", @@ -426,9 +429,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf58ed4fefa61dbf038e5421a521cbc2c448ef69deff0ab1d915d8a10eda5664" +checksum = "37e4b4304b7ea4af1af3e08535100eb7b6459d5a6264b92078bf85176d04ab85" dependencies = [ "aws-smithy-eventstream", "aws-smithy-types", @@ -449,11 +452,12 @@ dependencies = [ [[package]] name = "aws-smithy-http-tower" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c96d7bd35e7cf96aca1134b2f81b1b59ffe493f7c6539c051791cbbf7a42d3" +checksum = "e86072ecc4dc4faf3e2071144285cfd539263fe7102b701d54fb991eafb04af8" dependencies = [ "aws-smithy-http", + "aws-smithy-types", "bytes", "http", "http-body", @@ -464,18 +468,18 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8324ba98c8a94187723cc16c37aefa09504646ee65c3d2c3af495bab5ea701b" +checksum = "9e3ddd9275b167bc59e9446469eca56177ec0b51225632f90aaa2cd5f41c940e" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-protocol-test" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbbbc0a48ecdfe6456774d6ad7c6cd6bc9cc34e66b347afbbb4c835f97f93619" +checksum = "ed971c00e756f963fd6dd187d18798b1b01f19d86cc378c385ebc087eede1f67" dependencies = [ "assert-json-diff 1.1.0", "http", @@ -488,9 +492,9 @@ dependencies = [ [[package]] name = "aws-smithy-query" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83834ed2ff69ea6f6657baf205267dc2c0abe940703503a3e5d60ce23be3d306" +checksum = "13b19d2e0b3ce20e460bad0d0d974238673100edebba6978c2c1aadd925602f7" dependencies = [ "aws-smithy-types", "urlencoding", @@ -498,10 +502,11 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b02e06ea63498c43bc0217ea4d16605d4e58d85c12fc23f6572ff6d0a840c61" +checksum = "987b1e37febb9bd409ca0846e82d35299e572ad8279bc404778caeb5fc05ad56" dependencies = [ + "base64-simd", "itoa 1.0.4", "num-integer", "ryu", @@ -510,9 +515,9 @@ dependencies = [ [[package]] name = "aws-smithy-types-convert" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e06afdc7e63242bd0b6d84a8a7f7f1a4d51db5cb2ac7f2eb920878ed7bb25a" +checksum = "b3f1240433030c02bfdba2061728f8fa8542829b7c3b48f054e4026ef583aa4c" dependencies = [ "aws-smithy-types", "chrono", @@ -520,18 +525,18 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246e9f83dd1fdf5d347fa30ae4ad30a9d1d42ce4cd74a93d94afa874646f94cd" +checksum = "37ce3791e14eec75ffac851a5a559f1ce6b31843297f42cc8bfba82714a6a5d8" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05701d32da168b44f7ee63147781aed8723e792cc131cb9b18363b5393f17f70" +checksum = "6c05adca3e2bcf686dd2c47836f216ab52ed7845c177d180c84b08522c1166a3" dependencies = [ "aws-smithy-async", "aws-smithy-client", @@ -650,6 +655,15 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + [[package]] name = "beef" version = "0.5.2" @@ -812,12 +826,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", - "js-sys", "num-integer", "num-traits", "serde", - "time 0.1.45", - "wasm-bindgen", "winapi", ] @@ -1926,9 +1937,9 @@ dependencies = [ [[package]] name = "git-date" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33db9f4462b565a33507aee113f3383bf16b988d2c573f07691e34302b7aa0a" +checksum = "8a2874ce2f3a77cb144167901ea830969e5c991eac7bfee85e6e3f53ef9fcdf2" dependencies = [ "bstr 1.0.1", "itoa 1.0.4", @@ -1988,9 +1999,9 @@ dependencies = [ [[package]] name = "git-glob" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef858611602fce54b51e45671ca72f07fe6a3c0e24a0539c66b75dfd4d84bd77" +checksum = "3908404c9b76ac7b3f636a104142378d3eaa78623cbc6eb7c7f0651979d48e8a" dependencies = [ "bitflags", "bstr 1.0.1", @@ -2337,9 +2348,9 @@ dependencies = [ [[package]] name = "git-validate" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf83bae632fc064ca938ebfb987364d9083b7f98b1476805f0a2d5eebb48686" +checksum = "0431cf9352c596dc7c8ec9066ee551ce54e63c86c3c767e5baf763f6019ff3c2" dependencies = [ "bstr 1.0.1", "thiserror", @@ -2686,6 +2697,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", + "webpki-roots", ] [[package]] @@ -3505,6 +3517,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + [[package]] name = "overload" version = "0.1.1" @@ -4932,6 +4950,15 @@ dependencies = [ "libc", ] +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref", +] + [[package]] name = "similar" version = "2.2.1" @@ -5976,6 +6003,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "wildmatch" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index d7d206f53..918d096bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,10 +74,10 @@ getrandom = "0.2.1" # Async tokio = { version = "1.0", features = ["rt-multi-thread"] } futures-util = "0.3.5" -aws-config = "0.51.0" -aws-sdk-s3 = "0.21.0" -aws-sdk-cloudfront = "0.21.0" -aws-smithy-types-convert = { version = "0.51.0", features = ["convert-chrono"] } +aws-config = "0.52.0" +aws-sdk-s3 = "0.22.0" +aws-sdk-cloudfront = "0.22.0" +aws-smithy-types-convert = { version = "0.52.0", features = ["convert-chrono"] } http = "0.2.6" uuid = "1.1.2" @@ -129,8 +129,8 @@ rand = "0.8" mockito = "0.31.0" test-case = "2.0.0" fn-error-context = "0.2.0" -aws-smithy-client = { version = "0.51.0", features = ["test-util"]} -aws-smithy-http = "0.51.0" +aws-smithy-client = { version = "0.52.0", features = ["test-util"]} +aws-smithy-http = "0.52.0" tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } indoc = "1.0.7" diff --git a/src/cdn.rs b/src/cdn.rs index 67445a2b0..ee3ac8e4d 100644 --- a/src/cdn.rs +++ b/src/cdn.rs @@ -181,7 +181,9 @@ mod tests { use crate::test::{wrapper, FakeBuild}; use aws_sdk_cloudfront::{Client, Config, Credentials, Region}; - use aws_smithy_client::{erase::DynConnector, test_connection::TestConnection}; + use aws_smithy_client::{ + erase::DynConnector, http_connector::HttpConnector, test_connection::TestConnection, + }; use aws_smithy_http::body::SdkBody; use chrono::{Duration, Timelike}; @@ -240,7 +242,9 @@ mod tests { }); } - async fn get_mock_config() -> aws_sdk_cloudfront::Config { + async fn get_mock_config( + http_connector: impl Into, + ) -> aws_sdk_cloudfront::Config { let cfg = aws_config::from_env() .region(Region::new("eu-central-1")) .credentials_provider(Credentials::new( @@ -250,6 +254,7 @@ mod tests { None, "dummy", )) + .http_connector(http_connector) .load() .await; @@ -341,8 +346,7 @@ mod tests { )) .unwrap(), )]); - let client = - Client::from_conf_conn(get_mock_config().await, DynConnector::new(conn.clone())); + let client = Client::from_conf(get_mock_config(DynConnector::new(conn.clone())).await); CdnBackend::cloudfront_invalidation( &client, diff --git a/src/storage/s3.rs b/src/storage/s3.rs index 2204e15df..99c55e231 100644 --- a/src/storage/s3.rs +++ b/src/storage/s3.rs @@ -1,6 +1,6 @@ use super::{Blob, FileRange, StorageTransaction}; use crate::{Config, Metrics}; -use anyhow::{Context, Error}; +use anyhow::Error; use aws_sdk_s3::{ config::retry::RetryConfig, error as s3_error, @@ -42,11 +42,7 @@ impl S3Backend { .region(Region::new(config.s3_region.clone())); if let Some(ref endpoint) = config.s3_endpoint { - config_builder = config_builder.endpoint_resolver(Endpoint::immutable( - endpoint - .parse::() - .context("got invalid URI as S3 endpoint")?, - )); + config_builder = config_builder.endpoint_resolver(Endpoint::immutable(endpoint)?); } let client = Client::from_conf(config_builder.build()); @@ -84,9 +80,9 @@ impl S3Backend { .await { Ok(_) => Ok(true), - Err(SdkError::ServiceError { err, raw }) - if (matches!(err.kind, s3_error::HeadObjectErrorKind::NotFound(_)) - || raw.http().status() == http::StatusCode::NOT_FOUND) => + Err(SdkError::ServiceError(err)) + if (matches!(err.err().kind, s3_error::HeadObjectErrorKind::NotFound(_)) + || err.raw().http().status() == http::StatusCode::NOT_FOUND) => { Ok(false) } @@ -113,11 +109,11 @@ impl S3Backend { .any(|tag| tag.value() == Some(PUBLIC_ACCESS_VALUE)) }) .unwrap_or(false)), - Err(SdkError::ServiceError { err, raw }) => { - if raw.http().status() == http::StatusCode::NOT_FOUND { + Err(SdkError::ServiceError(err)) => { + if err.raw().http().status() == http::StatusCode::NOT_FOUND { Err(super::PathNotFoundError.into()) } else { - Err(err.into()) + Err(err.into_err().into()) } } Err(other) => Err(other.into()), @@ -148,11 +144,11 @@ impl S3Backend { .await { Ok(_) => Ok(()), - Err(SdkError::ServiceError { err, raw }) => { - if raw.http().status() == http::StatusCode::NOT_FOUND { + Err(SdkError::ServiceError(err)) => { + if err.raw().http().status() == http::StatusCode::NOT_FOUND { Err(super::PathNotFoundError.into()) } else { - Err(err.into()) + Err(err.into_err().into()) } } Err(other) => Err(other.into()), @@ -175,9 +171,11 @@ impl S3Backend { .set_range(range.map(|r| format!("bytes={}-{}", r.start(), r.end()))) .send() .map_err(|err| match err { - SdkError::ServiceError { err, raw } - if (matches!(err.kind, s3_error::GetObjectErrorKind::NoSuchKey(_)) - || raw.http().status() == http::StatusCode::NOT_FOUND) => + SdkError::ServiceError(err) + if (matches!( + err.err().kind, + s3_error::GetObjectErrorKind::NoSuchKey(_) + ) || err.raw().http().status() == http::StatusCode::NOT_FOUND) => { super::PathNotFoundError.into() } @@ -198,7 +196,7 @@ impl S3Backend { .last_modified // This is a bug from AWS, it should always have a modified date of when it was created if nothing else. // Workaround it by passing now as the modification time, since the exact time doesn't really matter. - .map(|dt| dt.to_chrono_utc()) + .and_then(|dt| dt.to_chrono_utc().ok()) .unwrap_or_else(Utc::now); let compression = res.content_encoding.and_then(|s| s.parse().ok());