From 23d30ff6cb0b748f93a41dba9eb905e1c65eac32 Mon Sep 17 00:00:00 2001 From: Yuang Gao Date: Sun, 7 Jun 2026 21:30:03 -0700 Subject: [PATCH] feat(services/obs): support if_modified_since and if_unmodified_since for read --- 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 df26deb512c8..3e5b0135bd1d 100644 --- a/core/services/obs/src/backend.rs +++ b/core/services/obs/src/backend.rs @@ -216,6 +216,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 722ef0054d6d..b55c97bfc2a1 100644 --- a/core/services/obs/src/core.rs +++ b/core/services/obs/src/core.rs @@ -26,7 +26,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::Signer; @@ -125,6 +127,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) .body(Buffer::new())