mirror of
https://github.com/curl/curl.git
synced 2026-08-26 08:13:32 +03:00
curl: move IPFS code into src/tool_ipfs.[ch]
- convert ensure_trailing into ensure_trailing_slash - strdup the URL string to own it proper - use shorter variable names - combine some expressions - simplify error handling in ipfs_gateway() - add MAX_GATEWAY_URL_LEN + proper bailout if maximum is reached - ipfs-gateway.d polish and simplification - shorten ipfs error message + make them "synthetic" Closes #12281
This commit is contained in:
parent
fd7ef00f43
commit
01d9b8bc7c
5 changed files with 346 additions and 317 deletions
|
|
@ -9,36 +9,24 @@ Category: ipfs
|
|||
Example: --ipfs-gateway $URL ipfs://
|
||||
Multi: single
|
||||
---
|
||||
Specifies which gateway to use for IPFS and IPNS URLs.
|
||||
Not specifying this argument will let cURL try to automatically
|
||||
check if IPFS_GATEWAY environment variable is set,
|
||||
or if ~/.ipfs/gateway plain text file exists.
|
||||
Specify which gateway to use for IPFS and IPNS URLs. Not specifying this will
|
||||
instead make curl check if the IPFS_GATEWAY environment variable is set, or if
|
||||
a ~/.ipfs/gateway file holding the gateway URL exists.
|
||||
|
||||
If you run a local IPFS node, this gateway is by default
|
||||
available under http://localhost:8080. A full example URL would
|
||||
look like:
|
||||
If you run a local IPFS node, this gateway is by default available under
|
||||
http://localhost:8080. A full example URL would look like:
|
||||
|
||||
curl --ipfs-gateway http://localhost:8080 ipfs://bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
||||
|
||||
|
||||
You can also specify publicly available gateways. One such
|
||||
gateway is https://ipfs.io. A full example url would look like:
|
||||
|
||||
curl --ipfs-gateway https://ipfs.io ipfs://bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
||||
|
||||
|
||||
There are many public IPFS gateways. As a starting point to find
|
||||
one that works for your case, consult this page:
|
||||
There are many public IPFS gateways. See for example:
|
||||
|
||||
https://ipfs.github.io/public-gateway-checker/
|
||||
|
||||
|
||||
A word of caution! When you opt to go for a remote gateway you should
|
||||
be aware that you completely trust the gateway. This is fine in local gateways
|
||||
as you host it yourself. With remote gateways there could potentially be
|
||||
a malicious actor returning you data that does not match the request you made,
|
||||
inspect or even interfere with the request. You won't notice this when using cURL.
|
||||
A mitigation could be to go for a "trustless" gateway. This means you
|
||||
locally verify that the data. Consult the docs page on trusted vs trustless:
|
||||
WARNING: If you opt to go for a remote gateway you should be aware that you
|
||||
completely trust the gateway. This is fine in local gateways as you host it
|
||||
yourself. With remote gateways there could potentially be a malicious actor
|
||||
returning you data that does not match the request you made, inspect or even
|
||||
interfere with the request. You will not notice this when using curl. A
|
||||
mitigation could be to go for a "trustless" gateway. This means you locally
|
||||
verify that the data. Consult the docs page on trusted vs trustless:
|
||||
https://docs.ipfs.tech/reference/http/gateway/#trusted-vs-trustless
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue