This is an automated email from the ASF dual-hosted git repository.
erickguan 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 a004995e1 feat(services/obs): support if_modified_since and
if_unmodified_since… (#7708)
a004995e1 is described below
commit a004995e13af00c5b141a5ea12b77d80d19156a7
Author: Yuang Gao <[email protected]>
AuthorDate: Wed Jun 24 20:40:42 2026 -0700
feat(services/obs): support if_modified_since and if_unmodified_since…
(#7708)
feat(services/obs): support if_modified_since and if_unmodified_since on
read (part of #5486)
---
core/services/obs/src/backend.rs | 2 ++
core/services/obs/src/core.rs | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/core/services/obs/src/backend.rs b/core/services/obs/src/backend.rs
index 8ffca99f4..7338b1954 100644
--- a/core/services/obs/src/backend.rs
+++ b/core/services/obs/src/backend.rs
@@ -206,6 +206,8 @@ impl Builder for ObsBuilder {
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_empty: true,
diff --git a/core/services/obs/src/core.rs b/core/services/obs/src/core.rs
index a5d98d63d..f2333c201 100644
--- a/core/services/obs/src/core.rs
+++ b/core/services/obs/src/core.rs
@@ -25,7 +25,9 @@ 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 opendal_core::raw::*;
use opendal_core::*;
use reqsign_core::{Context, Signer};
@@ -144,6 +146,14 @@ impl ObsCore {
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("GetObject"))