3 ms·
Don't torrents pretty much offer that already?
by digi_owl 11y ago
Don't torrents pretty much offer that already?
- toomuchtodo 11y agoThey get us mostly there. The rest of the way is how you combine getting that data into a browser. Subresource Integrity [1] includes the hash of the content/object in the link to the resource, as well as the URL/URI; this lets you do fun things like not fetch duplicate content if its already in the browser's cache from another site (think a specific version of jquery, for example). Magnet links [2] are a great example of this in practice, but that's bittorrent-specific (although I would not be surprised if you started to see ideas from Magnet URI scheme work their way into Subresource Integrity): "The Magnet URI scheme is a de facto standard defining a uniform resource identifier (URI) scheme for Magnet links, which mainly refer to resources available for download via peer-to-peer networks. Such a link typically identifies a file not by location, but by content—more precisely, by the content's cryptographic hash value. Since it specifies a file based on content or metadata, rather than by location, a Magnet link can be considered a kind of Uniform Resource Name, rather than the more common Uniform Resource Locators. Although it could be used for other applications, it is particularly useful in a peer-to-peer context, because it allows resources to be referred to without the need for a continuously available host." Github has a great explanation as well: http://githubengineering.com/subresource-integrity/ http://githubengineering.com/subresource-integrity/ [1] http://www.w3.org/TR/SRI/ http://www.w3.org/TR/SRI/ [2] https://en.wikipedia.org/wiki/Magnet_URI_scheme https://en.wikipedia.org/wiki/Magnet_URI_scheme
- digi_owl 11y agoSo something like rather than putting a URL inside a img tag, one could perhaps put a magnet URI, and wait while the browser trawled supported P2P services for said image? On that note, there as an article posted here on HN a while ago about Gopher. And at that point i found myself wondering if Gopher could have been modified or extended to handle such a scheme.
- toomuchtodo 11y ago> So something like rather than putting a URL inside a img tag, one could perhaps put a magnet URI, and wait while the browser trawled supported P2P services for said image? Exactly, although your browser would probably want to make an attempt at the URL specified before falling back to P2P/DHT if the server or URL wasn't available (you'd want to get objects like CSS, JS, or images FAST but other objects could probably lazy load in the background). The Magnet URI scheme already supports this behavior. > On that note, there as an article posted here on HN a while ago about Gopher. And at that point i found myself wondering if Gopher could have been modified or extended to handle such a scheme. "Everything old is new again."
- digi_owl 11y ago> "Everything old is new again." Heh, that line pass through my mind every time i see a Slack headline...
- nitrogen 11y agoHow does SRI prevent other sites from using a hash of third party content to load JS they shouldn't load, or sniff browser history by specifying hashed unique to a site and measuring load times?
- toomuchtodo 11y agoIt doesn't. Methods would have to be designed to prevent this. I don't believe its insurmountable though.