You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/06/02 10:35:54 UTC

(opendal) branch main updated: feat(services/azdls): support conditional read headers (#7667)

This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new c544d60d6 feat(services/azdls): support conditional read headers (#7667)
c544d60d6 is described below

commit c544d60d6994eb91afc3018431801a42c007dec1
Author: Yuang Gao <91...@users.noreply.github.com>
AuthorDate: Tue Jun 2 03:35:48 2026 -0700

    feat(services/azdls): support conditional read headers (#7667)
---
 core/services/azdls/src/backend.rs |  6 +++++-
 core/services/azdls/src/core.rs    | 23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/core/services/azdls/src/backend.rs b/core/services/azdls/src/backend.rs
index f29fe6be8..f409606ea 100644
--- a/core/services/azdls/src/backend.rs
+++ b/core/services/azdls/src/backend.rs
@@ -327,6 +327,10 @@ impl Builder for AzdlsBuilder {
                             stat: true,
 
                             read: true,
+                            read_with_if_match: true,
+                            read_with_if_none_match: true,
+                            read_with_if_modified_since: true,
+                            read_with_if_unmodified_since: true,
 
                             write: true,
                             write_can_append: true,
@@ -403,7 +407,7 @@ impl Access for AzdlsBackend {
     }
 
     async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
-        let resp = self.core.azdls_read(path, args.range()).await?;
+        let resp = self.core.azdls_read(path, args.range(), &args).await?;
 
         let status = resp.status();
         match status {
diff --git a/core/services/azdls/src/core.rs b/core/services/azdls/src/core.rs
index a39a50031..bb638eea5 100644
--- a/core/services/azdls/src/core.rs
+++ b/core/services/azdls/src/core.rs
@@ -29,7 +29,10 @@ use http::StatusCode;
 use http::header::CONTENT_DISPOSITION;
 use http::header::CONTENT_LENGTH;
 use http::header::CONTENT_TYPE;
+use http::header::IF_MATCH;
+use http::header::IF_MODIFIED_SINCE;
 use http::header::IF_NONE_MATCH;
+use http::header::IF_UNMODIFIED_SINCE;
 use reqsign_azure_storage::Credential;
 use reqsign_core::Signer;
 
@@ -98,7 +101,12 @@ impl AzdlsCore {
 }
 
 impl AzdlsCore {
-    pub async fn azdls_read(&self, path: &str, range: BytesRange) -> Result<Response<HttpBody>> {
+    pub async fn azdls_read(
+        &self,
+        path: &str,
+        range: BytesRange,
+        args: &OpRead,
+    ) -> Result<Response<HttpBody>> {
         let p = build_abs_path(&self.root, path);
 
         let url = format!(
@@ -114,6 +122,19 @@ impl AzdlsCore {
             req = req.header(http::header::RANGE, range.to_header());
         }
 
+        if let Some(if_match) = args.if_match() {
+            req = req.header(IF_MATCH, if_match);
+        }
+        if let Some(if_none_match) = args.if_none_match() {
+            req = req.header(IF_NONE_MATCH, if_none_match);
+        }
+        if let Some(if_modified_since) = args.if_modified_since() {
+            req = req.header(IF_MODIFIED_SINCE, if_modified_since.format_http_date());
+        }
+        if let Some(if_unmodified_since) = args.if_unmodified_since() {
+            req = req.header(IF_UNMODIFIED_SINCE, if_unmodified_since.format_http_date());
+        }
+
         let req = req
             .extension(Operation::Read)
             .extension(ServiceOperation("ReadFile"))