diff --git a/core/src/services/azblob/core.rs b/core/src/services/azblob/core.rs index 1202ae8ba4bf..5f1c59132fb9 100644 --- a/core/src/services/azblob/core.rs +++ b/core/src/services/azblob/core.rs @@ -29,6 +29,8 @@ 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_UNMODIFIED_SINCE; use http::header::IF_NONE_MATCH; use http::HeaderValue; use http::Request; @@ -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/core.rs b/core/src/services/gcs/core.rs index fe6a242f204c..e1c573d5e0a5 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/core.rs b/core/src/services/oss/core.rs index fef9a860496c..a85d2df699c2 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)