opendal 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +46 -36
  3. data/Cargo.toml +1 -1
  4. data/DEPENDENCIES.rust.tsv +25 -24
  5. data/core/CHANGELOG.md +9 -1
  6. data/core/Cargo.lock +363 -1184
  7. data/core/Cargo.toml +95 -95
  8. data/core/DEPENDENCIES.rust.tsv +13 -12
  9. data/core/benches/types/buffer.rs +61 -0
  10. data/core/benches/vs_fs/Cargo.toml +1 -1
  11. data/core/benches/vs_s3/Cargo.toml +1 -1
  12. data/core/core/CHANGELOG.md +9 -1
  13. data/core/core/src/raw/futures_util.rs +5 -0
  14. data/core/core/src/raw/oio/copy/block_copy.rs +1 -1
  15. data/core/core/src/raw/oio/copy/multipart_copy.rs +1 -1
  16. data/core/core/src/raw/oio/write/block_write.rs +1 -1
  17. data/core/core/src/raw/oio/write/multipart_write.rs +1 -1
  18. data/core/core/src/raw/oio/write/position_write.rs +41 -1
  19. data/core/core/src/types/buffer.rs +131 -0
  20. data/core/core/src/types/delete/deleter.rs +13 -0
  21. data/core/core/src/types/mod.rs +1 -0
  22. data/core/http-transports/reqwest/Cargo.toml +1 -1
  23. data/core/layers/async-backtrace/Cargo.toml +2 -2
  24. data/core/layers/await-tree/Cargo.toml +2 -2
  25. data/core/layers/capability-check/Cargo.toml +2 -2
  26. data/core/layers/chaos/Cargo.toml +2 -2
  27. data/core/layers/concurrent-limit/Cargo.toml +2 -2
  28. data/core/layers/dtrace/Cargo.toml +2 -2
  29. data/core/layers/fastmetrics/Cargo.toml +3 -3
  30. data/core/layers/fastrace/Cargo.toml +2 -2
  31. data/core/layers/foyer/Cargo.toml +2 -2
  32. data/core/layers/hotpath/Cargo.toml +2 -2
  33. data/core/layers/immutable-index/Cargo.toml +2 -2
  34. data/core/layers/logging/Cargo.toml +2 -2
  35. data/core/layers/metrics/Cargo.toml +3 -3
  36. data/core/layers/mime-guess/Cargo.toml +2 -2
  37. data/core/layers/observe-metrics-common/Cargo.toml +1 -1
  38. data/core/layers/otelmetrics/Cargo.toml +3 -3
  39. data/core/layers/oteltrace/Cargo.toml +2 -2
  40. data/core/layers/prometheus/Cargo.toml +3 -3
  41. data/core/layers/prometheus-client/Cargo.toml +3 -3
  42. data/core/layers/retry/Cargo.toml +4 -4
  43. data/core/layers/route/Cargo.toml +3 -3
  44. data/core/layers/tail-cut/Cargo.toml +2 -2
  45. data/core/layers/throttle/Cargo.toml +2 -2
  46. data/core/layers/timeout/Cargo.toml +3 -3
  47. data/core/layers/tracing/Cargo.toml +2 -2
  48. data/core/services/aliyun-drive/Cargo.toml +1 -1
  49. data/core/services/alluxio/Cargo.toml +1 -1
  50. data/core/services/azblob/Cargo.toml +2 -2
  51. data/core/services/azdls/Cargo.toml +2 -2
  52. data/core/services/azfile/Cargo.toml +2 -2
  53. data/core/services/azure-common/Cargo.toml +1 -1
  54. data/core/services/b2/Cargo.toml +1 -1
  55. data/core/services/cacache/Cargo.toml +1 -1
  56. data/core/services/cloudflare-kv/Cargo.toml +1 -1
  57. data/core/services/compfs/Cargo.toml +1 -1
  58. data/core/services/cos/Cargo.toml +1 -1
  59. data/core/services/d1/Cargo.toml +1 -1
  60. data/core/services/dashmap/Cargo.toml +1 -1
  61. data/core/services/dbfs/Cargo.toml +1 -1
  62. data/core/services/dropbox/Cargo.toml +1 -1
  63. data/core/services/etcd/Cargo.toml +1 -1
  64. data/core/services/foundationdb/Cargo.toml +1 -1
  65. data/core/services/foyer/Cargo.toml +3 -3
  66. data/core/services/fs/Cargo.toml +1 -1
  67. data/core/services/fs/src/core.rs +25 -7
  68. data/core/services/ftp/Cargo.toml +1 -1
  69. data/core/services/gcs/Cargo.toml +1 -1
  70. data/core/services/gcs-grpc/Cargo.toml +1 -1
  71. data/core/services/gdrive/Cargo.toml +1 -1
  72. data/core/services/ghac/Cargo.toml +2 -2
  73. data/core/services/github/Cargo.toml +1 -1
  74. data/core/services/goosefs/Cargo.toml +2 -2
  75. data/core/services/gridfs/Cargo.toml +1 -1
  76. data/core/services/hdfs/Cargo.toml +2 -2
  77. data/core/services/hdfs/src/backend.rs +15 -7
  78. data/core/services/hdfs/src/core.rs +55 -16
  79. data/core/services/hdfs/src/docs.md +9 -1
  80. data/core/services/hdfs-native/Cargo.toml +1 -1
  81. data/core/services/hf/Cargo.toml +3 -3
  82. data/core/services/http/Cargo.toml +3 -3
  83. data/core/services/http/src/core.rs +2 -1
  84. data/core/services/ipfs/Cargo.toml +1 -1
  85. data/core/services/ipmfs/Cargo.toml +1 -1
  86. data/core/services/koofr/Cargo.toml +1 -1
  87. data/core/services/lakefs/Cargo.toml +1 -1
  88. data/core/services/memcached/Cargo.toml +1 -1
  89. data/core/services/mini_moka/Cargo.toml +1 -1
  90. data/core/services/moka/Cargo.toml +1 -1
  91. data/core/services/mongodb/Cargo.toml +1 -1
  92. data/core/services/monoiofs/Cargo.toml +1 -1
  93. data/core/services/mysql/Cargo.toml +1 -1
  94. data/core/services/obs/Cargo.toml +1 -1
  95. data/core/services/onedrive/Cargo.toml +1 -1
  96. data/core/services/opfs/Cargo.toml +1 -1
  97. data/core/services/oss/Cargo.toml +1 -1
  98. data/core/services/oss/src/backend.rs +143 -2
  99. data/core/services/oss/src/docs.md +12 -0
  100. data/core/services/pcloud/Cargo.toml +1 -1
  101. data/core/services/persy/Cargo.toml +1 -1
  102. data/core/services/postgresql/Cargo.toml +1 -1
  103. data/core/services/redb/Cargo.toml +1 -1
  104. data/core/services/redis/Cargo.toml +1 -1
  105. data/core/services/rocksdb/Cargo.toml +1 -1
  106. data/core/services/s3/Cargo.toml +1 -1
  107. data/core/services/seafile/Cargo.toml +1 -1
  108. data/core/services/sftp/Cargo.toml +1 -1
  109. data/core/services/sled/Cargo.toml +1 -1
  110. data/core/services/sqlite/Cargo.toml +1 -1
  111. data/core/services/surrealdb/Cargo.toml +2 -2
  112. data/core/services/swift/Cargo.toml +1 -1
  113. data/core/services/tikv/Cargo.toml +1 -1
  114. data/core/services/tos/Cargo.toml +1 -1
  115. data/core/services/upyun/Cargo.toml +1 -1
  116. data/core/services/vercel-artifacts/Cargo.toml +1 -1
  117. data/core/services/vercel-blob/Cargo.toml +1 -1
  118. data/core/services/webdav/Cargo.toml +1 -1
  119. data/core/services/webdav/src/backend.rs +10 -21
  120. data/core/services/webdav/src/config.rs +5 -14
  121. data/core/services/webdav/src/core.rs +12 -15
  122. data/core/services/webhdfs/Cargo.toml +1 -1
  123. data/core/services/yandex-disk/Cargo.toml +1 -1
  124. data/core/testkit/Cargo.toml +4 -4
  125. metadata +2 -2
@@ -523,8 +523,8 @@ impl Builder for OssBuilder {
523
523
  }
524
524
  let mut provider = provider
525
525
  .push(EnvCredentialProvider::new())
526
- .push(EcsRamRoleCredentialProvider::new())
527
- .push(assume_role);
526
+ .push(assume_role)
527
+ .push(EcsRamRoleCredentialProvider::new());
528
528
 
529
529
  if let Some(role_arn) = &self.config.role_arn {
530
530
  let mut assume_role_with_ak = AssumeRoleCredentialProvider::new()
@@ -859,3 +859,144 @@ impl Service for OssBackend {
859
859
  )))
860
860
  }
861
861
  }
862
+
863
+ #[cfg(test)]
864
+ mod tests {
865
+ use std::collections::HashMap;
866
+ use std::sync::Mutex;
867
+
868
+ use bytes::Bytes;
869
+ use reqsign_core::{FileRead, HttpSend};
870
+
871
+ use super::*;
872
+
873
+ #[derive(Debug)]
874
+ struct OidcTokenFile;
875
+
876
+ impl FileRead for OidcTokenFile {
877
+ async fn file_read(&self, path: &str) -> reqsign_core::Result<Vec<u8>> {
878
+ assert_eq!(path, "/test/oidc-token");
879
+ Ok(b"test-oidc-token".to_vec())
880
+ }
881
+ }
882
+
883
+ #[derive(Clone, Debug, Default)]
884
+ struct CredentialHttpSend {
885
+ requests: Arc<Mutex<Vec<String>>>,
886
+ }
887
+
888
+ impl HttpSend for CredentialHttpSend {
889
+ async fn http_send(
890
+ &self,
891
+ req: http::Request<Bytes>,
892
+ ) -> reqsign_core::Result<http::Response<Bytes>> {
893
+ let host = req.uri().host().unwrap();
894
+ let path = req.uri().path();
895
+ self.requests.lock().unwrap().push(format!("{host}{path}"));
896
+ let body = match (host, path) {
897
+ ("sts.aliyuncs.com", "/") => {
898
+ assert!(
899
+ req.uri()
900
+ .query()
901
+ .unwrap()
902
+ .contains("Action=AssumeRoleWithOIDC")
903
+ );
904
+ r#"{"Credentials":{"AccessKeyId":"oidc-ak","AccessKeySecret":"oidc-secret","SecurityToken":"oidc-token","Expiration":"2099-01-01T00:00:00Z"}}"#
905
+ }
906
+ ("100.100.100.200", "/latest/api/token") => "metadata-token",
907
+ ("100.100.100.200", "/latest/meta-data/ram/security-credentials/") => "node-role",
908
+ ("100.100.100.200", "/latest/meta-data/ram/security-credentials/node-role") => {
909
+ r#"{"Code":"Success","AccessKeyId":"ecs-ak","AccessKeySecret":"ecs-secret","SecurityToken":"ecs-token","Expiration":"2099-01-01T00:00:00Z"}"#
910
+ }
911
+ _ => panic!("unexpected credential request: {}", req.uri()),
912
+ };
913
+ Ok(http::Response::new(Bytes::from_static(body.as_bytes())))
914
+ }
915
+ }
916
+
917
+ #[tokio::test]
918
+ async fn test_credential_precedence() {
919
+ for (static_keys, env_keys, oidc, expected_key, expected_token) in [
920
+ (true, true, true, "static-ak", "static-token"),
921
+ (false, true, true, "env-ak", "env-token"),
922
+ (false, false, true, "oidc-ak", "oidc-token"),
923
+ (false, false, false, "ecs-ak", "ecs-token"),
924
+ ] {
925
+ let mut builder = OssBuilder::default()
926
+ .bucket("test-bucket")
927
+ .endpoint("https://oss-cn-hangzhou.aliyuncs.com");
928
+ if static_keys {
929
+ builder = builder
930
+ .access_key_id("static-ak")
931
+ .access_key_secret("static-secret")
932
+ .security_token("static-token");
933
+ }
934
+ let backend = builder.build().unwrap();
935
+ let backend = (&backend as &dyn std::any::Any)
936
+ .downcast_ref::<OssBackend>()
937
+ .unwrap();
938
+ let mut envs = HashMap::new();
939
+ if env_keys {
940
+ envs.extend([
941
+ ("ALIBABA_CLOUD_ACCESS_KEY_ID".into(), "env-ak".into()),
942
+ (
943
+ "ALIBABA_CLOUD_ACCESS_KEY_SECRET".into(),
944
+ "env-secret".into(),
945
+ ),
946
+ ("ALIBABA_CLOUD_SECURITY_TOKEN".into(), "env-token".into()),
947
+ ]);
948
+ }
949
+ if oidc {
950
+ envs.extend([
951
+ (
952
+ "ALIBABA_CLOUD_ROLE_ARN".into(),
953
+ "acs:ram::123456789012:role/pod-role".into(),
954
+ ),
955
+ (
956
+ "ALIBABA_CLOUD_OIDC_PROVIDER_ARN".into(),
957
+ "acs:ram::123456789012:oidc-provider/test".into(),
958
+ ),
959
+ (
960
+ "ALIBABA_CLOUD_OIDC_TOKEN_FILE".into(),
961
+ "/test/oidc-token".into(),
962
+ ),
963
+ ]);
964
+ }
965
+ let http = CredentialHttpSend::default();
966
+ let ctx = Context::new()
967
+ .with_env(StaticEnv {
968
+ home_dir: None,
969
+ envs,
970
+ })
971
+ .with_file_read(OidcTokenFile)
972
+ .with_http_send(http.clone());
973
+ let signer = backend.core.signer.clone().with_context(ctx);
974
+ let (mut parts, _) = http::Request::builder()
975
+ .method(http::Method::PUT)
976
+ .uri("https://test-bucket.oss-cn-hangzhou.aliyuncs.com/manifest.json")
977
+ .body(())
978
+ .unwrap()
979
+ .into_parts();
980
+ signer.sign(&mut parts, None).await.unwrap();
981
+ assert!(
982
+ parts.headers[http::header::AUTHORIZATION]
983
+ .to_str()
984
+ .unwrap()
985
+ .starts_with(&format!("OSS {expected_key}:"))
986
+ );
987
+ assert_eq!(parts.headers["x-oss-security-token"], expected_token);
988
+ let expected_requests = if static_keys || env_keys {
989
+ vec![]
990
+ } else if oidc {
991
+ vec!["sts.aliyuncs.com/"]
992
+ } else {
993
+ vec![
994
+ "100.100.100.200/latest/api/token",
995
+ "100.100.100.200/latest/meta-data/ram/security-credentials/",
996
+ "100.100.100.200/latest/meta-data/ram/security-credentials/node-role",
997
+ ]
998
+ };
999
+ assert_eq!(*http.requests.lock().unwrap(), expected_requests);
1000
+ }
1001
+ }
1002
+ }
@@ -21,6 +21,18 @@ Use [`crate::OssConfig`] for serializable configuration and this builder's
21
21
  methods for direct construction. The field and method documentation defines
22
22
  accepted values, defaults, and environment interaction.
23
23
 
24
+ ### Credential resolution
25
+
26
+ OSS tries explicit access keys, environment credentials, OIDC assume-role
27
+ credentials, and ECS instance RAM role credentials, in that order. The first
28
+ provider that returns credentials is used. In ACK RRSA deployments, OIDC
29
+ credentials therefore take precedence over the node's ECS metadata credentials.
30
+ If a provider returns no credentials or fails, the chain tries the next provider.
31
+ An OSS permission error does not trigger a switch to another credential provider.
32
+
33
+ When `role_arn` is set in the service configuration, these providers supply the
34
+ base credentials for the additional AK-based AssumeRole request.
35
+
24
36
  ## Example
25
37
 
26
38
  ### Via Builder
@@ -35,7 +35,7 @@ all-features = true
35
35
  bytes = { workspace = true }
36
36
  http = { workspace = true }
37
37
  log = { workspace = true }
38
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
38
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
39
39
  serde = { workspace = true, features = ["derive"] }
40
40
  serde_json = { workspace = true }
41
41
 
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
  persy = "1.7.1"
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
 
@@ -33,7 +33,7 @@ all-features = true
33
33
 
34
34
  [dependencies]
35
35
  asyncband = { workspace = true, features = ["once-cell"] }
36
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
36
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
  sqlx = { version = "0.8.0", features = ["runtime-tokio-rustls", "postgres"] }
39
39
 
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
  redb = { version = "4" }
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
 
@@ -40,7 +40,7 @@ rustls = ["redis/tokio-rustls-comp"]
40
40
  asyncband = { workspace = true, features = ["pool"] }
41
41
  bytes = { workspace = true }
42
42
  http = { workspace = true }
43
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
43
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
44
44
  redis = { version = "1.2", features = [
45
45
  "cluster-async",
46
46
  "tokio-comp",
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
  rocksdb = { version = "0.24.0", default-features = false }
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
 
@@ -38,7 +38,7 @@ crc-fast = "1.9.0"
38
38
  http = { workspace = true }
39
39
  log = { workspace = true }
40
40
  md-5 = "0.11.0"
41
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false, features = [
41
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false, features = [
42
42
  "reqsign",
43
43
  ] }
44
44
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
 
37
37
  asyncband = { workspace = true, features = ["once-cell"] }
38
38
  bytes = { workspace = true }
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
 
37
37
  asyncband = { workspace = true, features = ["pool"] }
38
38
  bytes = { workspace = true }
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
  serde = { workspace = true, features = ["derive"] }
37
37
  sled = "0.34.7"
38
38
 
@@ -33,7 +33,7 @@ all-features = true
33
33
 
34
34
  [dependencies]
35
35
  asyncband = { workspace = true, features = ["once-cell"] }
36
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
36
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
  sqlx = { version = "0.8.0", features = ["runtime-tokio-rustls", "sqlite"] }
39
39
 
@@ -33,9 +33,9 @@ all-features = true
33
33
 
34
34
  [dependencies]
35
35
  asyncband = { workspace = true, features = ["once-cell"] }
36
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
36
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
37
37
  serde = { workspace = true, features = ["derive"] }
38
- surrealdb = { version = "3", features = ["protocol-http"] }
38
+ surrealdb = { version = "3.3", features = ["protocol-http"] }
39
39
 
40
40
  [dev-dependencies]
41
41
  tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
@@ -37,7 +37,7 @@ bytes = { workspace = true }
37
37
  hmac = "0.13.0"
38
38
  http = { workspace = true }
39
39
  log = { workspace = true }
40
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
40
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
41
41
  percent-encoding = "2"
42
42
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
43
43
  serde = { workspace = true, features = ["derive"] }
@@ -33,7 +33,7 @@ all-features = true
33
33
 
34
34
  [dependencies]
35
35
  asyncband = { workspace = true, features = ["once-cell"] }
36
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
36
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
37
37
  serde = { workspace = true, features = ["derive"] }
38
38
  tikv-client = { version = "0.4.0", default-features = false }
39
39
 
@@ -34,7 +34,7 @@ all-features = true
34
34
  [dependencies]
35
35
  bytes = { workspace = true }
36
36
  http = { workspace = true }
37
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false, features = [
37
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false, features = [
38
38
  "reqsign",
39
39
  ] }
40
40
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
@@ -38,7 +38,7 @@ hmac = "0.13.0"
38
38
  http = { workspace = true }
39
39
  log = { workspace = true }
40
40
  md-5 = "0.11.0"
41
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
41
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
42
42
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
43
43
  serde = { workspace = true, features = ["derive"] }
44
44
  serde_json = { workspace = true }
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
 
37
37
  bytes = { workspace = true }
38
38
  http = { workspace = true }
@@ -35,7 +35,7 @@ all-features = true
35
35
  bytes = { workspace = true }
36
36
  http = { workspace = true }
37
37
  log = { workspace = true }
38
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
38
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
39
39
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
40
40
  serde = { workspace = true, features = ["derive"] }
41
41
  serde_json = { workspace = true }
@@ -36,7 +36,7 @@ anyhow = { version = "1.0.100", features = ["std"] }
36
36
  bytes = { workspace = true }
37
37
  http = { workspace = true }
38
38
  log = { workspace = true }
39
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
39
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
40
40
  quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
41
41
  serde = { workspace = true, features = ["derive"] }
42
42
 
@@ -154,21 +154,12 @@ impl WebdavBuilder {
154
154
  self
155
155
  }
156
156
 
157
- /// Enable conditional read support.
158
- ///
159
- /// When enabled (the default), OpenDAL forwards the RFC 7232 headers
160
- /// `If-Match`, `If-None-Match`, `If-Modified-Since` and
161
- /// `If-Unmodified-Since` to the server when callers provide them.
162
- ///
163
- /// Some WebDAV-compatible servers (e.g., nginx-dav) don't return ETags
164
- /// in PROPFIND or don't honor these headers on GET. Setting this to
165
- /// `false` drops the four `read_with_if_*` capabilities, so calls like
166
- /// `reader_with(path).if_match(...)` return `ErrorKind::Unsupported`
167
- /// locally instead of being silently ignored by the server.
168
- ///
169
- /// Default: true
170
- pub fn enable_conditional_read(mut self, enable: bool) -> Self {
171
- self.config.enable_conditional_read = enable;
157
+ /// Deprecated: WebDAV conditional read capabilities are enabled by default.
158
+ #[deprecated(
159
+ since = "0.60.0",
160
+ note = "WebDAV conditional read capabilities are enabled by default. Use CapabilityOverrideLayer to override read_with_if_match, read_with_if_none_match, read_with_if_modified_since and read_with_if_unmodified_since for endpoints without ETag support."
161
+ )]
162
+ pub fn enable_conditional_read(self, _enable: bool) -> Self {
172
163
  self
173
164
  }
174
165
  }
@@ -211,8 +202,6 @@ impl Builder for WebdavBuilder {
211
202
  authorization = Some(format_authorization_by_bearer(token)?)
212
203
  }
213
204
 
214
- let conditional_read = self.config.enable_conditional_read;
215
-
216
205
  let core = Arc::new(WebdavCore {
217
206
  info: ServiceInfo::new(WEBDAV_SCHEME, &root, ""),
218
207
  capability: Capability {
@@ -220,10 +209,10 @@ impl Builder for WebdavBuilder {
220
209
 
221
210
  read: true,
222
211
  read_with_suffix: true,
223
- read_with_if_match: conditional_read,
224
- read_with_if_none_match: conditional_read,
225
- read_with_if_modified_since: conditional_read,
226
- read_with_if_unmodified_since: conditional_read,
212
+ read_with_if_match: true,
213
+ read_with_if_none_match: true,
214
+ read_with_if_modified_since: true,
215
+ read_with_if_unmodified_since: true,
227
216
 
228
217
  write: true,
229
218
  write_can_empty: true,
@@ -75,19 +75,11 @@ pub struct WebdavConfig {
75
75
  ///
76
76
  /// Default: `https://opendal.apache.org/ns`
77
77
  pub user_metadata_uri: Option<String>,
78
- /// Enable conditional read support.
79
- ///
80
- /// When enabled (the default), OpenDAL forwards the RFC 7232 headers
81
- /// `If-Match`, `If-None-Match`, `If-Modified-Since` and
82
- /// `If-Unmodified-Since` to the server when callers provide them.
83
- ///
84
- /// Some WebDAV-compatible servers (e.g., nginx-dav) don't return ETags
85
- /// in PROPFIND or don't honor these headers on GET. Setting this to
86
- /// `false` drops the four `read_with_if_*` capabilities, so calls like
87
- /// `reader_with(path).if_match(...)` return `ErrorKind::Unsupported`
88
- /// locally instead of being silently ignored by the server.
89
- ///
90
- /// Default: true
78
+ /// Deprecated: WebDAV conditional read capabilities are enabled by default.
79
+ #[deprecated(
80
+ since = "0.60.0",
81
+ note = "WebDAV conditional read capabilities are enabled by default. Use CapabilityOverrideLayer to override read_with_if_match, read_with_if_none_match, read_with_if_modified_since and read_with_if_unmodified_since for endpoints without ETag support."
82
+ )]
91
83
  pub enable_conditional_read: bool,
92
84
  }
93
85
 
@@ -119,7 +111,6 @@ impl Debug for WebdavConfig {
119
111
  .field("disable_create_dir", &self.disable_create_dir)
120
112
  .field("user_metadata_prefix", &self.user_metadata_prefix)
121
113
  .field("user_metadata_uri", &self.user_metadata_uri)
122
- .field("enable_conditional_read", &self.enable_conditional_read)
123
114
  .finish_non_exhaustive()
124
115
  }
125
116
  }
@@ -627,10 +627,10 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
627
627
  Ok(Event::Start(ref e)) => {
628
628
  // Extract namespace declarations from attributes
629
629
  for attr in e.attributes().flatten() {
630
- let key = String::from_utf8_lossy(attr.key.as_ref()).to_string();
630
+ let key = attr.key.as_ref().to_string();
631
631
  if key.starts_with("xmlns:") {
632
632
  let prefix = key.strip_prefix("xmlns:").unwrap_or("").to_string();
633
- let uri = String::from_utf8_lossy(&attr.value).to_string();
633
+ let uri = attr.value.to_string();
634
634
  if uri == namespace_uri && !target_prefixes.contains(&prefix) {
635
635
  target_prefixes.push(prefix.clone());
636
636
  }
@@ -639,7 +639,7 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
639
639
  }
640
640
 
641
641
  // Check if this element is in our target namespace
642
- let name = String::from_utf8_lossy(e.name().as_ref()).to_string();
642
+ let name = e.name().as_ref().to_string();
643
643
  if let Some(colon_pos) = name.find(':') {
644
644
  let prefix = &name[..colon_pos];
645
645
  let local_name = &name[colon_pos + 1..];
@@ -652,10 +652,10 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
652
652
  Ok(Event::Empty(ref e)) => {
653
653
  // Extract namespace declarations from attributes
654
654
  for attr in e.attributes().flatten() {
655
- let key = String::from_utf8_lossy(attr.key.as_ref()).to_string();
655
+ let key = attr.key.as_ref().to_string();
656
656
  if key.starts_with("xmlns:") {
657
657
  let prefix = key.strip_prefix("xmlns:").unwrap_or("").to_string();
658
- let uri = String::from_utf8_lossy(&attr.value).to_string();
658
+ let uri = attr.value.to_string();
659
659
  if uri == namespace_uri && !target_prefixes.contains(&prefix) {
660
660
  target_prefixes.push(prefix.clone());
661
661
  }
@@ -664,7 +664,7 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
664
664
  }
665
665
 
666
666
  // For Empty events (self-closing tags), immediately insert with empty value
667
- let name = String::from_utf8_lossy(e.name().as_ref()).to_string();
667
+ let name = e.name().as_ref().to_string();
668
668
  if let Some(colon_pos) = name.find(':') {
669
669
  let prefix = &name[..colon_pos];
670
670
  let local_name = &name[colon_pos + 1..];
@@ -675,13 +675,11 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
675
675
  }
676
676
  Ok(Event::Text(ref e)) if current_prop_key.is_some() => {
677
677
  // Text content - add directly (no escaping needed)
678
- let text_str = String::from_utf8_lossy(e.as_ref());
679
- current_prop_value.push_str(&text_str);
678
+ current_prop_value.push_str(e.as_ref());
680
679
  }
681
680
  Ok(Event::GeneralRef(ref e)) if current_prop_key.is_some() => {
682
681
  // Handle XML entity references (e.g., &lt; &gt; &amp; &quot; &apos;)
683
- let entity_name = String::from_utf8_lossy(e.as_ref());
684
- let decoded = match entity_name.as_ref() {
682
+ let decoded = match e.as_ref() {
685
683
  "lt" => "<",
686
684
  "gt" => ">",
687
685
  "amp" => "&",
@@ -692,7 +690,7 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
692
690
  current_prop_value.push_str(decoded);
693
691
  }
694
692
  Ok(Event::End(ref e)) => {
695
- let name = String::from_utf8_lossy(e.name().as_ref()).to_string();
693
+ let name = e.name().as_ref().to_string();
696
694
  if let Some(colon_pos) = name.find(':') {
697
695
  let prefix = &name[..colon_pos];
698
696
  let local_name = &name[colon_pos + 1..];
@@ -734,7 +732,7 @@ pub fn check_proppatch_response(xml: &str) -> Result<()> {
734
732
  loop {
735
733
  match reader.read_event_into(&mut buf) {
736
734
  Ok(Event::Start(ref e)) => {
737
- let name = String::from_utf8_lossy(e.name().as_ref()).to_lowercase();
735
+ let name = e.name().as_ref().to_lowercase();
738
736
  // Match status element regardless of namespace prefix
739
737
  if name.ends_with(":status") || name == "status" {
740
738
  in_status = true;
@@ -742,11 +740,10 @@ pub fn check_proppatch_response(xml: &str) -> Result<()> {
742
740
  }
743
741
  }
744
742
  Ok(Event::Text(ref e)) if in_status => {
745
- let text_str = String::from_utf8_lossy(e.as_ref());
746
- status_text.push_str(&text_str);
743
+ status_text.push_str(e.as_ref());
747
744
  }
748
745
  Ok(Event::End(ref e)) => {
749
- let name = String::from_utf8_lossy(e.name().as_ref()).to_lowercase();
746
+ let name = e.name().as_ref().to_lowercase();
750
747
  if name.ends_with(":status") || name == "status" {
751
748
  // Parse status code from "HTTP/1.1 XXX Description"
752
749
  if let Some(code_str) = status_text.split_whitespace().nth(1)
@@ -37,7 +37,7 @@ asyncband = { workspace = true, features = ["once-cell"] }
37
37
  bytes = { workspace = true }
38
38
  http = { workspace = true }
39
39
  log = { workspace = true }
40
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
40
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
41
41
  serde = { workspace = true, features = ["derive"] }
42
42
  serde_json = { workspace = true }
43
43
  uuid = { workspace = true, features = ["serde", "v4"] }
@@ -32,7 +32,7 @@ version = { workspace = true }
32
32
  all-features = true
33
33
 
34
34
  [dependencies]
35
- opendal-core = { path = "../../core", version = "0.59.3", default-features = false }
35
+ opendal-core = { path = "../../core", version = "0.59.5", default-features = false }
36
36
 
37
37
  bytes = { workspace = true }
38
38
  http = { workspace = true }
@@ -34,10 +34,10 @@ all-features = true
34
34
  [dependencies]
35
35
  bytes = { workspace = true }
36
36
  dotenvy = "0.15"
37
- opendal-core = { path = "../core", version = "0.59.3", default-features = false }
38
- opendal-layer-logging = { path = "../layers/logging", version = "0.59.3", default-features = false }
39
- opendal-layer-retry = { path = "../layers/retry", version = "0.59.3", default-features = false }
40
- opendal-layer-timeout = { path = "../layers/timeout", version = "0.59.3", default-features = false }
37
+ opendal-core = { path = "../core", version = "0.59.5", default-features = false }
38
+ opendal-layer-logging = { path = "../layers/logging", version = "0.59.5", default-features = false }
39
+ opendal-layer-retry = { path = "../layers/retry", version = "0.59.5", default-features = false }
40
+ opendal-layer-timeout = { path = "../layers/timeout", version = "0.59.5", default-features = false }
41
41
  rand = { workspace = true }
42
42
  sha2 = { workspace = true }
43
43
  tokio = { workspace = true, features = ["rt-multi-thread"] }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenDAL Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-22 00:00:00.000000000 Z
11
+ date: 2026-10-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: