alexbakker / webdav-provider

An Android app that can expose WebDAV storage to other apps through Android's Storage Access Framework (SAF)
https://rocli.dev/webdav
GNU General Public License v3.0
109 stars 28 forks source link

Can't connect to HTTPS! #18

Closed RebelliousX closed 6 months ago

RebelliousX commented 2 years ago

Screenshot 2022-05-30 020046

javax.net.ssl.SSLHanshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certifiation path not found

I can connect using HTTP but not HTTPS!! I have no issues using file managers to connect to the same HTTPS ip address and port.

I searched all over the internet! But no clear answer. I would appreciate any input on this.

alexbakker commented 2 years ago

Is the authority that signed the certificate that your WebDAV server presents trusted by Android? Also, does it present the full certificate chain?

(Note that disabling "Verify certificates" doesn't actually do anything yet)

RebelliousX commented 2 years ago

I am not really sure! Am I supposed to include a custom signed CA and include it in network_security_config.xml file?

I am just trying to connect to a NAS server (locally OR over the internet when using my static public IP from ISP). which I enabled WebDAV server feature from the NAS.

Just to clarify, I am using port 9801 for WebDAV SSL and 9800 for WebDAV.

So far, only HTTP works fine, even when accessing my NAS server while on the go (WAN access).

By the way, I modified COLUMN_FLAGS so it can show WebDAV for apps that only expect local storage! (for example, emulators such as PPSSPP, Dolphin, AetherSX2, DuckStation and MSX.emu. I can access all my games and load, play them over the internet. But only over HTTP not HTTPS?!):

add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE or Root.FLAG_SUPPORTS_IS_CHILD or Root.FLAG_LOCAL_ONLY)

On another note, performance when parsing a directory with hundreds / thousands of small files makes WebDAV provider hang or have long waiting time. Even when using it locally!! But for example, using CIFS Document Provider app, I don't have this particular issue. But I don't like the idea of using SMB/CIFS over WAN.

alexbakker commented 2 years ago

I am not really sure! Am I supposed to include a custom signed CA and include it in network_security_config.xml file?

No. The CA certificate is supposed to be in the Android system trust store.

By the way, I modified COLUMN_FLAGS so it can show WebDAV for apps that only expect local storage! (for example, emulators such as PPSSPP, Dolphin, AetherSX2, DuckStation and MSX.emu. I can access all my games and load, play them over the internet. But only over HTTP not HTTPS?!):

Interesting. Perhaps we could add an option like "Emulate local device" that sets FLAG_LOCAL_ONLY. Feel free to submit a PR!

On another note, performance when parsing a directory with hundreds / thousands of small files makes WebDAV provider hang or have long waiting time. Even when using it locally!! But for example, using CIFS Document Provider app, I don't have this particular issue. But I don't like the idea of using SMB/CIFS over WAN.

I'm not sure what could be going on there. I haven't really done much performance optimization yet. If you find out the root cause, let me know!

Let's try to stay on one topic per GitHub issue though.

RebelliousX commented 2 years ago

My NAS server has a self-signed certificate when I did a little debugging using openssl.

Anyways, I created a PR https://github.com/alexbakker/webdav-provider/pull/19 that addresses the two issues above.

I still encounter a crash when enumerating a directory that has around 699 files (total 1.36GB size on disk, actual size is 169MB).

In Android Studio, WebDAV Provider crashes and the FILES app displays at that moment an error with hourglass icon that it can't load content. Same thing on phone.

Performance wise while copying files is not bad, actually better than another app but for SMB (CIFS Document Provider, here in github open source), but when it comes to enumerating files, it is really dog slow, CIFS Document Provider displays all files in split second!! I am still trying to investigate. I would appreciate any input about this.

alexbakker commented 6 months ago

Fixed by #19 and #21.