Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support redirects in WebDAV service #2146

Closed
dtretyakov opened this issue Apr 27, 2023 · 16 comments
Closed

feat: Support redirects in WebDAV service #2146

dtretyakov opened this issue Apr 27, 2023 · 16 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed services/webdav

Comments

@dtretyakov
Copy link

dtretyakov commented Apr 27, 2023

Currently if WebDAV service uses redirects it's impossible to use sccache due to lack of redirects support in opendal (mozilla/sccache#1749).

In OpenDAL core redirects are disabled by default: https://github.com/apache/incubator-opendal/blob/40a0d04bd8081a52e61470450112d66bc8975b1c/core/src/raw/http_util/client.rs#L63-L64

In our case it's fine to support HTTP 302/307 redirects for GET requests.

@Xuanwo
Copy link
Member

Xuanwo commented Apr 27, 2023

Should be handled inside webdav services it self.

@VladRassokhin
Copy link

Should be handled inside webdav services it self.

Per section 12 of WebDAV RFC:

Note also that WebDAV servers are
known to use 300-level redirect responses (and early interoperability
tests found clients unprepared to see those responses).

Anyway, inability to modify redirection policy from the outside is limiting.
Let's at least change code to not override redirect policy in HttpClient.build if it was specified (e.g. !=Policy::default()).

@Xuanwo
Copy link
Member

Xuanwo commented Apr 27, 2023

Let's at least change code to not override redirect policy in HttpClient.build if it was specified (e.g. !=Policy::default()).

I mean redirect should be handled by serivce itself (aka opendal:services:Webdav). Service should check and redirect to location at needs.

@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 28, 2023
@Xuanwo
Copy link
Member

Xuanwo commented Apr 28, 2023

Actions

  • Don't return error while meeting 302/307 in read, redirect to new location instead

@dtretyakov
Copy link
Author

Please avoid typical security issue during redirect implementation: if "authority" (hostname + port) in redirect location differs from the value in original request, don't send original Authorization header value for redirect location.

@Gnosnay
Copy link
Contributor

Gnosnay commented Apr 30, 2023

pls let me try on this. @Xuanwo

@Gnosnay
Copy link
Contributor

Gnosnay commented Apr 30, 2023

Please avoid typical security issue during redirect implementation: if "authority" (hostname + port) in redirect location differs from the value in original request, don't send original Authorization header value for redirect location.

Hi @dtretyakov . May i have one example for redirecting HTTP response? What does location look like in this case?

@dtretyakov
Copy link
Author

@Yansongsongsong it looks like that:

Request
URL: https://host:port/path/to/object?query=param
Method: GET
Authorization: xxx
...

Response 
Status Code: 307
Content-Length: 0
Location: https://cdn-host/path/to/object?query=param&Expires=123&Signature=xxx

And then subsequent request should use Location from the response to fetch the actual data.

@dtretyakov
Copy link
Author

@Yansongsongsong do we have estimate when redirects will be supported?

I'm asking because it's critical to start using sccache in our setup (mozilla/sccache#1749)

@Gnosnay
Copy link
Contributor

Gnosnay commented May 11, 2023

@Yansongsongsong do we have estimate when redirects will be supported?

I'm asking because it's critical to start using sccache in our setup (mozilla/sccache#1749)

@dtretyakov hi Tretyakov, sorry for the late. Because I had some private staff to handle, there was no progress in last week until this Monday.
I have finished the code now and begin to have one integration test.

It may be released in this week. thank you!

@Gnosnay
Copy link
Contributor

Gnosnay commented May 30, 2023

Hi anyone can help add feat: as prefix of title of this issue?

The PR pipeline is failed due to wrong prefix name of this issue. but i can not modify the title of this issue.

Thank you so much!

@dtretyakov dtretyakov changed the title Support redirects in WebDAV service feat: Support redirects in WebDAV service May 30, 2023
@dtretyakov
Copy link
Author

@Yansongsongsong renamed, please feel free to proceed.

@Xuanwo
Copy link
Member

Xuanwo commented May 30, 2023

The PR pipeline is failed due to wrong prefix name of this issue. but i can not modify the title of this issue.

Sorry, it's related to our CI setup. I'm working on the fix.

@Xuanwo
Copy link
Member

Xuanwo commented May 30, 2023

Fixed by #2256

@Xuanwo Xuanwo closed this as completed May 30, 2023
@dtretyakov
Copy link
Author

@Xuanwo am I right, that it's not a part of v0.36.0 release? If so, could we please include it the next bugfix release, e.g. 0.36.1?

@Xuanwo
Copy link
Member

Xuanwo commented May 31, 2023

Yes, we will release this feature in next patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed services/webdav
Projects
None yet
Development

No branches or pull requests

4 participants