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/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 87b386761 refactor(services/webdav): Use OpRead in `webdav_get`.
(#3081)
87b386761 is described below
commit 87b386761db7c95fc0ceb33595d98aeaac9b525b
Author: -LAN- <[email protected]>
AuthorDate: Fri Sep 15 11:13:40 2023 +0800
refactor(services/webdav): Use OpRead in `webdav_get`. (#3081)
---
core/src/services/webdav/backend.rs | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/core/src/services/webdav/backend.rs
b/core/src/services/webdav/backend.rs
index 8d8771472..549a6b34f 100644
--- a/core/src/services/webdav/backend.rs
+++ b/core/src/services/webdav/backend.rs
@@ -263,7 +263,7 @@ impl Accessor for WebdavBackend {
}
async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead,
Self::Reader)> {
- let resp = self.webdav_get(path, args.range()).await?;
+ let resp = self.webdav_get(path, args).await?;
let status = resp.status();
match status {
StatusCode::OK | StatusCode::PARTIAL_CONTENT => {
@@ -408,11 +408,7 @@ impl Accessor for WebdavBackend {
}
impl WebdavBackend {
- async fn webdav_get(
- &self,
- path: &str,
- range: BytesRange,
- ) -> Result<Response<IncomingAsyncBody>> {
+ async fn webdav_get(&self, path: &str, args: OpRead) ->
Result<Response<IncomingAsyncBody>> {
let p = build_rooted_abs_path(&self.root, path);
let url: String = format!("{}{}", self.endpoint,
percent_encode_path(&p));
@@ -422,6 +418,7 @@ impl WebdavBackend {
req = req.header(header::AUTHORIZATION, auth.clone())
}
+ let range = args.range();
if !range.is_full() {
req = req.header(header::RANGE, range.to_header());
}