mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:33:31 +03:00
ipfs: add options to disable
- CPPFLAGS: `-DCURL_DISABLE_IPFS` - configure: `--disable-ipfs` - cmake: `-DCURL_DISABLE_IPFS=ON` Fixes #14824 Closes #14827
This commit is contained in:
parent
8b42df3eb1
commit
ce7d0d4137
12 changed files with 71 additions and 4 deletions
|
|
@ -110,7 +110,9 @@ static void free_config_fields(struct OperationConfig *config)
|
|||
config->url_get = NULL;
|
||||
config->url_out = NULL;
|
||||
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
Curl_safefree(config->ipfs_gateway);
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
Curl_safefree(config->doh_url);
|
||||
Curl_safefree(config->cipher_list);
|
||||
Curl_safefree(config->proxy_cipher_list);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ struct OperationConfig {
|
|||
struct getout *url_get; /* point to the node to fill in URL */
|
||||
struct getout *url_out; /* point to the node to fill in outfile */
|
||||
struct getout *url_ul; /* point to the node to fill in upload */
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
char *ipfs_gateway;
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
char *doh_url;
|
||||
char *cipher_list;
|
||||
char *proxy_cipher_list;
|
||||
|
|
|
|||
|
|
@ -171,7 +171,9 @@ static const struct LongShort aliases[]= {
|
|||
{"insecure", ARG_BOOL, 'k', C_INSECURE},
|
||||
{"interface", ARG_STRG, ' ', C_INTERFACE},
|
||||
{"ip-tos", ARG_STRG, ' ', C_IP_TOS},
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
{"ipfs-gateway", ARG_STRG, ' ', C_IPFS_GATEWAY},
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
{"ipv4", ARG_NONE, '4', C_IPV4},
|
||||
{"ipv6", ARG_NONE, '6', C_IPV6},
|
||||
{"json", ARG_STRG, ' ', C_JSON},
|
||||
|
|
@ -1321,9 +1323,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||
if(!err && (config->maxredirs < -1))
|
||||
err = PARAM_BAD_NUMERIC;
|
||||
break;
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
case C_IPFS_GATEWAY: /* --ipfs-gateway */
|
||||
err = getstr(&config->ipfs_gateway, nextarg, DENY_BLANK);
|
||||
break;
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
case C_PROXY_NTLM: /* --proxy-ntlm */
|
||||
if(!feature_ntlm)
|
||||
err = PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ void tool_version_info(void)
|
|||
printf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
|
||||
#endif
|
||||
if(built_in_protos[0]) {
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
const char *insert = NULL;
|
||||
/* we have ipfs and ipns support if libcurl has http support */
|
||||
for(builtin = built_in_protos; *builtin; ++builtin) {
|
||||
|
|
@ -345,16 +346,19 @@ void tool_version_info(void)
|
|||
insert = *builtin;
|
||||
}
|
||||
}
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
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);
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
if(insert && insert == *builtin) {
|
||||
printf(" ipfs ipns");
|
||||
insert = NULL;
|
||||
}
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
}
|
||||
puts(""); /* newline */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
#include "curlx.h"
|
||||
#include "dynbuf.h"
|
||||
|
||||
|
|
@ -287,3 +288,4 @@ clean:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@
|
|||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
#define MAX_GATEWAY_URL_LEN 10000
|
||||
|
||||
CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
|
||||
struct OperationConfig *config);
|
||||
|
||||
#endif /* HEADER_CURL_TOOL_IPFS_H */
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
|
|
|
|||
|
|
@ -49,8 +49,10 @@ const char *proto_rtsp = NULL;
|
|||
const char *proto_scp = NULL;
|
||||
const char *proto_sftp = NULL;
|
||||
const char *proto_tftp = NULL;
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
const char *proto_ipfs = "ipfs";
|
||||
const char *proto_ipns = "ipns";
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
|
||||
static struct proto_name_tokenp {
|
||||
const char *proto_name;
|
||||
|
|
|
|||
|
|
@ -793,6 +793,9 @@ static CURLcode url_proto(char **url,
|
|||
CURLU_GUESS_SCHEME | CURLU_NON_SUPPORT_SCHEME) &&
|
||||
!curl_url_get(uh, CURLUPART_SCHEME, &schemep,
|
||||
CURLU_DEFAULT_SCHEME)) {
|
||||
#ifdef CURL_DISABLE_IPFS
|
||||
(void)config;
|
||||
#else
|
||||
if(curl_strequal(schemep, proto_ipfs) ||
|
||||
curl_strequal(schemep, proto_ipns)) {
|
||||
result = ipfs_url_rewrite(uh, schemep, url, config);
|
||||
|
|
@ -805,6 +808,7 @@ static CURLcode url_proto(char **url,
|
|||
config->synthetic_error = TRUE;
|
||||
}
|
||||
else
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
proto = proto_token(schemep);
|
||||
|
||||
curl_free(schemep);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue