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

webdav should use PROPFIND instead of OPTIONS call to check for server #46

Open
prabirshrestha opened this issue Jan 8, 2023 · 1 comment

Comments

@prabirshrestha
Copy link
Contributor

prabirshrestha commented Jan 8, 2023

Some webdav servers don't have OPTIONS configured. Option makes sense for browsers and not clients. Looking at other ios clients for webdav, they seem to use PROPFIND to verify the server credentials instead of using OPTIONS. Is it possible for switch this so OPTIONS calls doesn't need to be configured on the server?

func checkServer() {
guard let url = URL(string: uri) else {
activityIndicatorView.stopAnimating()
return
}
testState = 0
var request: URLRequest = URLRequest(url: url)
request.httpMethod = "OPTIONS"
let task = dataSession.dataTask(with: request)
task.resume()
}

@prabirshrestha
Copy link
Contributor Author

prabirshrestha commented Jan 8, 2023

Similarly HEAD shouldn't be called and instead use PROPFIND with depth=0 header so it works for files or dir.

if let server = response.allHeaderFields["Server"] as? String {
/* Only check HEAD for non-Caddy webdav servers */
if server.contains("Caddy") {
done = true
onFinish(uri, user, pass)
}
}
var request: URLRequest = URLRequest(url: url)
request.httpMethod = "HEAD"
let task = dataSession.dataTask(with: request)
testState = 1
task.resume()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant