]> git.ipfire.org Git - thirdparty/curl.git/commit
curl: improved IPFS and IPNS URL support
authorMark Gaiser <markg85@gmail.com>
Wed, 18 Oct 2023 00:28:06 +0000 (02:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 5 Nov 2023 09:59:20 +0000 (10:59 +0100)
commit859e88f6533f9e1f890f6f39f34178871c48869e
treec424a4b8d2d5a39ecf79353f4fb22550ca1b0c5b
parentd112c242345459fb6f8d579ab5bb8c0dcb17a5f8
curl: improved IPFS and IPNS URL support

Previously just ipfs://<cid> and ipns://<cid> was supported, which is
too strict for some usecases.

This patch allows paths and query arguments to be used too.
Making this work according to normal http semantics:

 ipfs://<cid>/foo/bar?key=val
 ipns://<cid>/foo/bar?key=val

The gateway url support is changed.
It now only supports gateways in the form of:

 http://<gateway>/foo/bar
 http://<gateway>

Query arguments here are explicitly not allowed and trigger an intended
malformed url error.

There also was a crash when IPFS_PATH was set with a non trailing
forward slash. This has been fixed.

Lastly, a load of test cases have been added to verify the above.

Reported-by: Steven Allen
Fixes #12148
Closes #12152
21 files changed:
src/tool_operate.c
tests/data/DISABLED
tests/data/Makefile.inc
tests/data/test722
tests/data/test723
tests/data/test724
tests/data/test725
tests/data/test726
tests/data/test727
tests/data/test730 [new file with mode: 0644]
tests/data/test731 [new file with mode: 0644]
tests/data/test732 [new file with mode: 0644]
tests/data/test733 [new file with mode: 0644]
tests/data/test734 [new file with mode: 0644]
tests/data/test735 [new file with mode: 0644]
tests/data/test736 [new file with mode: 0644]
tests/data/test737 [new file with mode: 0644]
tests/data/test738 [new file with mode: 0644]
tests/data/test739 [new file with mode: 0644]
tests/data/test740 [new file with mode: 0644]
tests/data/test741 [new file with mode: 0644]