On Feb 18, 2022 at 4:10:56 PM, Daniel Stenberg <dan...@haxx.se> wrote:
> On Fri, 18 Feb 2022, Chris Anderson via curl-library wrote: > > Are there any example patches adding support for other protocols which are > > really just wrappers around HTTP? That would help me stick with the coding > > style. Maybe something in an example curl usage repo? > > > There are no existing protocols supported in libcurl that are just > "wrappers > around HTTP". Unless you count HTTPS as a wrapper. > > I'm just not getting it. How is it "IPFS" at all if it just wraps HTTP? > The core IPFS protocol is based on a peer-to-peer distributed hash table. To participate in the network you’ve got to run a stateful peer (or a browser like Brave or Opera that includes a IPFS daemon.) The HTTP gateways serve as a compatibility layer for clients that aren’t running a full node. Rather than a client connecting to peers and keeping state about the location of resources in the network, that job is done by the gateway. The semantics are a clean mapping, mostly because addresses are based on content hash identifiers, so the client can validate that the gateway isn’t tampering with data. Initially I considered including the stateful peer behavior into curl, but that is a lot of code and probably introduces runtime weight curl is better off avoiding. The gateway approach gives the same result to the end user, with a much simpler patch and faster runtime. Also, why does it need to be in libcurl in the first place if its just > basically a URL rewrite and then everything is HTTPS? Surely that can be > done > in the application using libcurl? > The main purpose of putting it into the curl tool is ergonomics. Increasingly we are seeing IPFS urls intermixed with HTTP urls in eg database tables, etc. While it’s possible to educate the ecosystem about how to convert from network to gateway URLs, the transform is safe and clean enough to do once in a library. So the purpose would really be to make curl handy for people who are using IPFS, and want to inspect a resource without running a stateful node, or learning how to rewrite the URLs. And especially for people who are iterating through a mixed list of IPFS and HTTP urls, it’d be great for curl to work with both. Thanks, Chris > -- > > / daniel.haxx.se > | Commercial curl support up to 24x7 is available! > | Private help, bug fixes, support, ports, new features > | https://curl.se/support.html > Chris Anderson https://twitter.com/jchris
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html