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
This commit is contained in:
Mark Gaiser 2023-10-18 02:28:06 +02:00 committed by Daniel Stenberg
parent d112c24234
commit 859e88f653
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
21 changed files with 765 additions and 53 deletions

View file

@ -70,9 +70,6 @@
266
579
587
722
724
727
# 1021 re-added here due to flakiness
1021
1117