curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

IPFS support in Curl

From: Chris Anderson via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 18 Feb 2022 13:55:40 +0000

I am working on a patch to add IPFS support to Curl
<https://github.com/curl/curl/pull/8468>. The goal is not to bring in full
P2P node behavior, or provide data into the IPFS network. Rather it is to
allow simple retrieval by content identifier (CID) so that shell script
authors and other Curl users can use IPFS urls.

Example usage:

curl
ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html

This would output the response you’d get from an HTTP request to a public
IPFS gateway, eg what you’d get for this:

curl
https://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.dweb.link/wiki/Vincent_van_Gogh.html

You can read more about the interplay between web addresses and IPFS
addressees here. <https://docs.ipfs.io/how-to/address-ipfs-on-web/>

Initially I think GET support is all that is needed to be useful. There are
a number of public gateways maintained by the community (ipfs.dweb.link in
the above example), so the implementation I am planning is to use a default
gateway and make libcurl HTTPS requests internally. The gateway could be
overridden with an environment variable, like this:

CURL_IPFS_GATEWAY=http://127.0.0.1:8080 curl
ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html

My thinking is this will be a small patch, smaller than for instance the
MQTT support
<https://github.com/curl/curl/commit/2522903b792ac5a802f780df60dc4647c58e2477#diff-ed8b659ce184aa0404c6a2642a6bfab86d61f31282502867deb3663204468290>
.

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?

Are there technical concerns or other reasons why Curl would be unlikely to
accept this patch? I’m happy to include feedback to improve the quality.
I’d like to imagine we can start with a small amount of functionality (GET
only) and add more as the community adopts it. (For instance, validating
the returned content matches the CID requested would be easy to add, but
not part of MVP.)

Thanks!
Chris
http://twitter.com/jchris


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-02-18