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

SSL Error occurred on Synology #46

Open
cdebaixo opened this issue Feb 5, 2024 · 1 comment
Open

SSL Error occurred on Synology #46

cdebaixo opened this issue Feb 5, 2024 · 1 comment

Comments

@cdebaixo
Copy link

cdebaixo commented Feb 5, 2024

I have installed webDAV in my iOS app so that I can take advantage of the listFiles function it supplies. I am using the following code to achieve this:

public struct SimpleAccount: WebDAVAccount {
    public var username: String?
    public var baseURL: String?
}


    let username = "userName"
    let password = "password"
    let webDav = WebDAV()
    let baseURL = "http://ServerName:5005/"
    let path = "serverPath"
    let account = SimpleAccount(username: username, baseURL: baseURL)
    webDav.listFiles(atPath: path, account: account, password: password, caching: .requestEvenIfCached) { files, error in
        if let files = files {
            print(files)
        }
        if let error = error {
            print(error)
        }
    }

but I am getting errors. The first error is "An SSL error has occurred and a secure connection to the server cannot be made".
I have tried with https 5006 also without success.
Is the problem with Synology or am I missing something in my code?
Your help would be much appreciated.

@isaced
Copy link

isaced commented May 25, 2024

I also encountered the same problem, the reason is that this library will force the use of HTTPS, so the server in the local LAN cannot connect.

init?<Account: WebDAVAccount>(account: Account) {
guard let username = account.username,
let baseURLString = account.baseURL,
var baseURL = URL(string: baseURLString) else { return nil }
switch baseURL.scheme {
case nil:
baseURL = URL(string: "https://" + baseURLString) ?? baseURL
case "https":
break
default:
var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false)
components?.scheme = "https"
baseURL = components?.url ?? baseURL
}
self.username = username
self.baseURL = baseURL
}

This fork may be helpful:

oxtoacart@162de94#diff-d21258d70a476a92ed2f95967877933b1801725aa44dba10958cccfae5729cecR27-R35

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

2 participants