mirror of
https://github.com/curl/curl.git
synced 2026-07-24 19:57:25 +03:00
curl: show ipfs and ipns as supported "protocols"
They are accepted schemes in URLs passed to curl (the tool, not the library). Also makes curl-config show the same list. Co-Authored-by: Jay Satiro Reported-by: Chara White Bug: https://curl.se/mail/archive-2023-12/0026.html Closes #12508
This commit is contained in:
parent
907eea0804
commit
102de7aa8d
3 changed files with 21 additions and 1 deletions
|
|
@ -173,12 +173,30 @@ void tool_version_info(void)
|
|||
printf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
|
||||
#endif
|
||||
if(built_in_protos[0]) {
|
||||
const char *insert = NULL;
|
||||
/* we have ipfs and ipns support if libcurl has http support */
|
||||
for(builtin = built_in_protos; *builtin; ++builtin) {
|
||||
if(insert) {
|
||||
/* update insertion so ipfs will be printed in alphabetical order */
|
||||
if(strcmp(*builtin, "ipfs") < 0)
|
||||
insert = *builtin;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if(!strcmp(*builtin, "http")) {
|
||||
insert = *builtin;
|
||||
}
|
||||
}
|
||||
printf("Protocols:");
|
||||
for(builtin = built_in_protos; *builtin; ++builtin) {
|
||||
/* Special case: do not list rtmp?* protocols.
|
||||
They may only appear together with "rtmp" */
|
||||
if(!curl_strnequal(*builtin, "rtmp", 4) || !builtin[0][4])
|
||||
printf(" %s", *builtin);
|
||||
if(insert && insert == *builtin) {
|
||||
printf(" ipfs ipns");
|
||||
insert = NULL;
|
||||
}
|
||||
}
|
||||
puts(""); /* newline */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue