IPFS/IPNS URLs ignore the path #12148
I did this
The same goes for all
I expected the following
I'd expect curl to fetch the requested pages. Instead, it ignores the entire path and tries to fetch the root CID/domain.
E.g., in the first request, I should see:
But instead I see:
The text was updated successfully, but these errors were encountered:
This is because we only use the
Tricky part, what to do with gateways containing a
The issue is the same for IPNS, same code path. A fix for one fixes it for the other.
@dfandrich It works quite well for the case where you want to replace the host from one url with another.
Even simpler would be a setter function that instead of a
The intent in the above example is to get the
But this is just replacing.
Then again, what i'm doing with an url here is probably as much of an edge case as it can be.
I'm not sold on the arguments here for extending the URL API, but I am certainly open for discussing extending and improving it.
I think the examples in this thread are a little too specific for this exact use case and shows the problem: sure, if the API provided these functions with exact these properties that would help this particular use case, but when adding combined actions, decisions have to be made and it is not certain those decisions will be fine for everyone and then people will end up having to write it themselves anyway, just leaving us with code that can rarely actually be used.
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 curl#12148 Closes curl#12152