ipfs/in-web-browsers

WebDAV (HTTP Extensions for Distributed Authoring)

lidel opened this issue ยท 5 comments

lidel commented

This issue tracks ideas, use cases and work related to WebDAV

TL;DR

This could be a way of mounting MFS or a specific CID as a drive in a way that works on all systems without having to deal with FUSE (ipfs/kubo#7494)

What is WebDAV?

Web Distributed Authoring and Versioning (WebDAV) is an extension of the Hypertext Transfer Protocol (HTTP) that allows clients to perform remote Web content authoring operations. WebDAV is defined in RFC 4918 by a working group of the Internet Engineering Task Force.
โ€“ https://en.wikipedia.org/wiki/WebDAV

WebDAV extends the set of standard HTTP verbs and headers allowed for request methods.
The added verbs include:

verb purpose
COPY copy a resource from one URI to another
LOCK put a lock on a resource. WebDAV supports both shared and exclusive locks.
MKCOL create collections (a.k.a. a directory)
MOVE move a resource from one URI to another
PROPFIND retrieve properties, stored as XML, from a web resource. It is also overloaded to allow one to retrieve the collection structure (also known as directory hierarchy) of a remote system.
PROPPATCH change and delete multiple properties on a resource in a single atomic act
UNLOCK remove a lock from a resource

Potential IPFS Use Cases

Why it is worth investigating?

References


Draft of the plan to support WebDAV in IPFS stack

Stage 0: read-only /ipfs/{cid}

HTTP Gateway exposed by go-ipfs supports WebDAV for immutable, read-only /ipfs/{cid} roots that are unixfs directories.

This is low risk high impact feature that allows everyone to mount CID from any public (or local) gateway and use it as read-only drive in Windows/macOS (native support) and Linux (native support if something like gvfs is present).

Stage 1: read-write MFS

This requires more work, but provides extremely useful feature to our users.
HTTP Gateway on localhost could expose /mfs/local (path tbd) which would be writable.

Cannot stress how big UX win this is โ€“ users will no longer be limited to choice between ipfs files --help CLI and ipfs-webui, but will be able to mount MFS (their Files from ipfs-webui) as a real drive.

Loose ideas:

  • focus on regular (desktop) users: investigate how people use NAS devices, how does onboarding look like
  • ipfs-webui would show info how to mount Files as a native drive
  • ipfs-desktop tray menu would have top level item to "Copy mountable WebDAV address", or even trigger relevant OS-level prompt (if such API exists)

Note: it should be pretty easy to implement: https://pkg.go.dev/golang.org/x/net/webdav

I made an ipfs-webdav daemon

That is very interesting @vlad20012!

I too am making a webdav ipfs layer in nodejs and i too went the route of exposing a new http endpoint for webdav. The idea is to have that within the go-ipfs gateway codebase to have a webdav support from any gateway out there.

Also, my approach currently is read-only. Mutability kinda adds in a slew of other difficulties. Your project does seem much more advanced, you have write support! Nice!

My approach was to create a virtual fs wrapper object that talks ipfs in the implementation. Then it's fairly easy to just give a webdav library that fs object as "directory to expose". This approach does work but i'm just not super far in it yet. It's far enough to be able to browse folders and open files.

A downside i quickly discovered in webdav is that the clients i tried thus far have an download-then-execute approach. So for example opening a large iso first downloads it to your local pc and then opens it. It is workable but does limit the webdav usefulness quite a bit. Did you find a way to fix that to be streaming based?

A downside i quickly discovered in webdav is that the clients i tried thus far have an download-then-execute approach. So for example opening a large iso first downloads it to your local pc and then opens it. It is workable but does limit the webdav usefulness quite a bit. Did you find a way to fix that to be streaming based?

Oddly enough, davfs2 actually works that way. But at lease GVFS mounts (from Nautilus aka Files in GNOME) supports streaming. To be honest, I'm very surprised davfs2 is so dumb. If the state of WebDAV support in other systems is the same deplorable, I'll consider implementing NFS, SMB and APFS protocols instead.

lidel commented

For anyone following, a lengthy WebDAV exploration in the context of use with IPFS was published at https://blog.ipfs.tech/2022-10-13-ipfs-over-webdav/
(thanks @markg85!)