Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests to IPNS URLs may fail #41

Open
d70-t opened this issue Oct 15, 2024 · 1 comment
Open

requests to IPNS URLs may fail #41

d70-t opened this issue Oct 15, 2024 · 1 comment

Comments

@d70-t
Copy link
Collaborator

d70-t commented Oct 15, 2024

As noticed in #39, some gateways don't support requesting format=raw for URLs including a path.

Aparrently, trustless-gateway.link also doesn't support format=car for IPNS links (and according to the spec, only format=ipns-record has to be supported). For this reason, ls and info may fail for IPNS links in similar ways as outlined for #39.

E.g.:

This fails:

IPFS_GATEWAY='https://ipfs.io' python3 -c "import fsspec; fs, _ = fsspec.url_to_fs('ipns://ipfs.io'); print(fs.ls('ipfs.io'))"
...
aiohttp.client_exceptions.ClientResponseError: 406, message='Not Acceptable', url='https://trustless-gateway.link/ipns/ipfs.io?format=car&dag-scope=block'

while the following succeeds (assuming a local kubo instance running):

IPFS_GATEWAY='http://127.0.0.1:8080' python3 -c "import fsspec; fs, _ = fsspec.url_to_fs('ipns://ipfs.io'); print(fs.ls('ipfs.io'))"
@d70-t
Copy link
Collaborator Author

d70-t commented Oct 15, 2024

It should be possible to circumvent this issue by resolving IPNS names to a CID before doing subsequent requests. However, a question remains, how to do this. IPNS names can be

  • true IPNS names (which can be resolved using a trustless gateway)
  • DNSLINK names (which can't be resolved in a trustless fashion, the resolution depends on DNS)

One option might be to issue a HEAD request to the /ipns/ API endpoint and inspect the X-Ipfs-Roots response header, which should include the CID for a given name. It's however unclear how to handle name changes and timeouts (e.g. the TTL value from the DNS entry).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant