diff --git a/core/src/services/azblob/backend.rs b/core/src/services/azblob/backend.rs index 464d7c7116f6..f2adce968ae8 100644 --- a/core/src/services/azblob/backend.rs +++ b/core/src/services/azblob/backend.rs @@ -515,6 +515,8 @@ impl Access for AzblobBackend { read_with_if_match: true, read_with_if_none_match: true, read_with_override_content_disposition: true, + read_with_if_modified_since: true, + read_with_if_unmodified_since: true, write: true, write_can_append: true, diff --git a/core/src/services/azblob/core.rs b/core/src/services/azblob/core.rs index 1202ae8ba4bf..b080f098084f 100644 --- a/core/src/services/azblob/core.rs +++ b/core/src/services/azblob/core.rs @@ -29,7 +29,9 @@ use http::header::HeaderName; 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 http::HeaderValue; use http::Request; use http::Response; @@ -208,6 +210,20 @@ impl AzblobCore { req = req.header(IF_MATCH, if_match); } + if let Some(if_modified_since) = args.if_modified_since() { + req = req.header( + IF_MODIFIED_SINCE, + format_datetime_into_http_date(if_modified_since), + ); + } + + if let Some(if_unmodified_since) = args.if_unmodified_since() { + req = req.header( + IF_UNMODIFIED_SINCE, + format_datetime_into_http_date(if_unmodified_since), + ); + } + let req = req.body(Buffer::new()).map_err(new_request_build_error)?; Ok(req) diff --git a/core/src/services/gcs/backend.rs b/core/src/services/gcs/backend.rs index c61ff75ca290..d9b401ba8cfb 100644 --- a/core/src/services/gcs/backend.rs +++ b/core/src/services/gcs/backend.rs @@ -369,6 +369,8 @@ impl Access for GcsBackend { 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/src/services/gcs/core.rs b/core/src/services/gcs/core.rs index fe6a242f204c..7a7ef5992fde 100644 --- a/core/src/services/gcs/core.rs +++ b/core/src/services/gcs/core.rs @@ -28,7 +28,9 @@ use http::header::CONTENT_LENGTH; use http::header::CONTENT_TYPE; use http::header::HOST; use http::header::IF_MATCH; +use http::header::IF_MODIFIED_SINCE; use http::header::IF_NONE_MATCH; +use http::header::IF_UNMODIFIED_SINCE; use http::Request; use http::Response; use once_cell::sync::Lazy; @@ -201,6 +203,20 @@ impl GcsCore { req = req.header(http::header::RANGE, range.to_header()); } + if let Some(if_modified_since) = args.if_modified_since() { + req = req.header( + IF_MODIFIED_SINCE, + format_datetime_into_http_date(if_modified_since), + ); + } + + if let Some(if_unmodified_since) = args.if_unmodified_since() { + req = req.header( + IF_UNMODIFIED_SINCE, + format_datetime_into_http_date(if_unmodified_since), + ); + } + let req = req.body(Buffer::new()).map_err(new_request_build_error)?; Ok(req) @@ -221,6 +237,20 @@ impl GcsCore { 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, + format_datetime_into_http_date(if_modified_since), + ); + } + + if let Some(if_unmodified_since) = args.if_unmodified_since() { + req = req.header( + IF_UNMODIFIED_SINCE, + format_datetime_into_http_date(if_unmodified_since), + ); + } + let req = req.body(Buffer::new()).map_err(new_request_build_error)?; Ok(req) diff --git a/core/src/services/oss/backend.rs b/core/src/services/oss/backend.rs index 0ec56cdc2acd..eb7616d148e9 100644 --- a/core/src/services/oss/backend.rs +++ b/core/src/services/oss/backend.rs @@ -459,6 +459,8 @@ impl Access for OssBackend { 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/src/services/oss/core.rs b/core/src/services/oss/core.rs index fef9a860496c..2467159d4c6d 100644 --- a/core/src/services/oss/core.rs +++ b/core/src/services/oss/core.rs @@ -27,7 +27,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 http::header::RANGE; use http::HeaderMap; use http::HeaderName; @@ -343,6 +345,20 @@ impl OssCore { 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, + format_datetime_into_http_date(if_modified_since), + ); + } + + if let Some(if_unmodified_since) = args.if_unmodified_since() { + req = req.header( + IF_UNMODIFIED_SINCE, + format_datetime_into_http_date(if_unmodified_since), + ); + } + let req = req.body(Buffer::new()).map_err(new_request_build_error)?; Ok(req)