ipfs / in-web-browsers

Tracking the endeavor towards getting web browsers to natively support IPFS and content-addressing
https://docs.ipfs.tech/how-to/address-ipfs-on-web/
MIT License
349 stars 29 forks source link

WebDAV (HTTP Extensions for Distributed Authoring) #146

Open lidel opened 5 years ago

lidel commented 5 years ago

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 (https://github.com/ipfs/go-ipfs/issues/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:

Stebalien commented 3 years ago

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

vlad20012 commented 2 years ago

I made an ipfs-webdav daemon

markg85 commented 2 years ago

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?

vlad20012 commented 2 years ago

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 2 years ago

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!)