AgregoreWeb / agregore-browser

A minimal browser for the distributed web (Desktop version)
https://www.youtube.com/watch?v=TnYKvOQB0ts&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=14
GNU Affero General Public License v3.0
715 stars 66 forks source link

Have all protocols return "canonical" urls when possible in headers #192

Open RangerMauve opened 2 years ago

RangerMauve commented 2 years ago

It'd be useful if protocols such as ipns/ipfs/hyper would return "canonical" urls for data that gets fetched whenever possible.

This behavior would include:

This would make it easier to pluck out raw data from higher level abstractions (like raw file URLs from IPNS based datasets).

Ideally this would be in the Content-Location response header.

lidel commented 2 years ago

Hm.. Content-Location may not be the header for the job. iiuc the Content-Location is tied to HTTP layer specifics too much. Provides key for HTTP caching, especially around POST and GET with Accept header.

My understanding of its mechanics is along these lines:

Alt-Svc (https://github.com/ipfs/in-web-browsers/issues/144) is also not an option imo, because it is tied to HTTP family of protocols blessed by IANA.


Taking step back, "Canonical" links are tricky, especially in IPFS context where we have mutable and immutable URIs.

Who would be consuming such link? When to use "bookmarkable" ipns://en.wikipedia-on-ipfs.org that will always be upt-o-date? When to use "immutable snapshot" ipfs://{cid} that can be used for archiving? I think we should announce both, and letting client to decide which one is useful for task at hand.

I think Link header is a better choice than Content-Location, because you can provide multiple entries and specify relation of each, and there are multiple RFCs that use it. For example:

RangerMauve commented 1 year ago

Link headers are a good idea, they're just kinda a pain in the ass to parse back out. I think I started with the Link header in the hypercore-protocol handler actually.

The metalink/http thing is interesting.