tool: Moved --libcurl to the global config
This commit is contained in:
parent
75e996f29f
commit
f1a9e6858e
@ -135,8 +135,6 @@ static void free_config_fields(struct OperationConfig *config)
|
||||
|
||||
Curl_safefree(config->ftp_account);
|
||||
Curl_safefree(config->ftp_alternative_to_user);
|
||||
|
||||
Curl_safefree(config->libcurl);
|
||||
}
|
||||
|
||||
void config_free(struct OperationConfig *config)
|
||||
|
@ -179,7 +179,6 @@ struct OperationConfig {
|
||||
bool ignorecl; /* --ignore-content-length */
|
||||
bool disable_sessionid;
|
||||
|
||||
char *libcurl; /* output libcurl code to this file name */
|
||||
bool raw;
|
||||
bool post301;
|
||||
bool post302;
|
||||
@ -225,6 +224,7 @@ struct GlobalConfig {
|
||||
trace tracetype;
|
||||
bool tracetime; /* include timestamp? */
|
||||
int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
|
||||
char *libcurl; /* Output libcurl code to this file name */
|
||||
|
||||
struct OperationConfig *first;
|
||||
struct OperationConfig *current;
|
||||
|
@ -165,7 +165,7 @@ CURLcode easysrc_cleanup(void)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
void dumpeasysrc(struct OperationConfig *config)
|
||||
void dumpeasysrc(struct GlobalConfig *config)
|
||||
{
|
||||
struct curl_slist *ptr;
|
||||
char *o = config->libcurl;
|
||||
@ -180,7 +180,7 @@ void dumpeasysrc(struct OperationConfig *config)
|
||||
else
|
||||
out = stdout;
|
||||
if(!out)
|
||||
warnf(config, "Failed to open %s to write libcurl code!\n", o);
|
||||
warnf(config->current, "Failed to open %s to write libcurl code!\n", o);
|
||||
else {
|
||||
int i;
|
||||
const char *c;
|
||||
|
@ -40,7 +40,8 @@ extern CURLcode easysrc_add(struct curl_slist **plist, const char *bupf);
|
||||
extern CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...);
|
||||
extern CURLcode easysrc_perform(void);
|
||||
extern CURLcode easysrc_cleanup(void);
|
||||
void dumpeasysrc(struct OperationConfig *config);
|
||||
|
||||
void dumpeasysrc(struct GlobalConfig *config);
|
||||
|
||||
#endif /* CURL_DISABLE_LIBCURL_OPTION */
|
||||
|
||||
|
@ -867,7 +867,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
"--libcurl option was disabled at build-time!\n");
|
||||
return PARAM_OPTION_UNKNOWN;
|
||||
#else
|
||||
GetStr(&config->libcurl, nextarg);
|
||||
GetStr(&global->libcurl, nextarg);
|
||||
break;
|
||||
#endif
|
||||
case '#': /* --raw */
|
||||
|
@ -187,6 +187,8 @@ static void free_config_fields(struct GlobalConfig *config)
|
||||
if(config->trace_fopened && config->trace_stream)
|
||||
fclose(config->trace_stream);
|
||||
config->trace_stream = NULL;
|
||||
|
||||
Curl_safefree(config->libcurl);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -230,7 +230,7 @@ static char *c_escape(const char *str)
|
||||
}
|
||||
|
||||
/* setopt wrapper for enum types */
|
||||
CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValue *nvlist, long lval)
|
||||
{
|
||||
@ -263,7 +263,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
|
||||
}
|
||||
|
||||
/* setopt wrapper for flags */
|
||||
CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValue *nvlist, long lval)
|
||||
{
|
||||
@ -305,7 +305,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
|
||||
}
|
||||
|
||||
/* setopt wrapper for bitmasks */
|
||||
CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValueUnsigned *nvlist,
|
||||
long lval)
|
||||
@ -348,7 +348,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
|
||||
}
|
||||
|
||||
/* setopt wrapper for CURLOPT_HTTPPOST */
|
||||
CURLcode tool_setopt_httppost(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
struct curl_httppost *post)
|
||||
{
|
||||
@ -424,7 +424,7 @@ CURLcode tool_setopt_httppost(CURL *curl, struct OperationConfig *config,
|
||||
}
|
||||
|
||||
/* setopt wrapper for curl_slist options */
|
||||
CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
struct curl_slist *list)
|
||||
{
|
||||
@ -464,7 +464,7 @@ CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
|
||||
|
||||
/* generic setopt wrapper for all other options.
|
||||
* Some type information is encoded in the tag value. */
|
||||
CURLcode tool_setopt(CURL *curl, bool str, struct OperationConfig *config,
|
||||
CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag, ...)
|
||||
{
|
||||
va_list arg;
|
||||
|
@ -71,48 +71,48 @@ extern const NameValueUnsigned setopt_nv_CURLAUTH[];
|
||||
|
||||
/* Intercept setopt calls for --libcurl */
|
||||
|
||||
CURLcode tool_setopt_enum(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValue *nv, long lval);
|
||||
CURLcode tool_setopt_flags(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValue *nv, long lval);
|
||||
CURLcode tool_setopt_bitmask(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
const NameValueUnsigned *nv, long lval);
|
||||
CURLcode tool_setopt_httppost(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
struct curl_httppost *httppost);
|
||||
CURLcode tool_setopt_slist(CURL *curl, struct OperationConfig *config,
|
||||
CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag,
|
||||
struct curl_slist *list);
|
||||
CURLcode tool_setopt(CURL *curl, bool str, struct OperationConfig *config,
|
||||
CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
|
||||
const char *name, CURLoption tag, ...);
|
||||
|
||||
#define my_setopt(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z))
|
||||
SETOPT_CHECK(tool_setopt(x, FALSE, global, #y, y, z))
|
||||
|
||||
#define my_setopt_str(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt(x, TRUE, config, #y, y, z))
|
||||
SETOPT_CHECK(tool_setopt(x, TRUE, global, #y, y, z))
|
||||
|
||||
#define my_setopt_enum(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_enum(x, config, #y, y, setopt_nv_ ## y, z))
|
||||
SETOPT_CHECK(tool_setopt_enum(x, global, #y, y, setopt_nv_ ## y, z))
|
||||
|
||||
#define my_setopt_flags(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_flags(x, config, #y, y, setopt_nv_ ## y, z))
|
||||
SETOPT_CHECK(tool_setopt_flags(x, global, #y, y, setopt_nv_ ## y, z))
|
||||
|
||||
#define my_setopt_bitmask(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_bitmask(x, config, #y, y, setopt_nv_ ## y, z))
|
||||
SETOPT_CHECK(tool_setopt_bitmask(x, global, #y, y, setopt_nv_ ## y, z))
|
||||
|
||||
#define my_setopt_httppost(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_httppost(x, config, #y, y, z))
|
||||
SETOPT_CHECK(tool_setopt_httppost(x, global, #y, y, z))
|
||||
|
||||
#define my_setopt_slist(x,y,z) \
|
||||
SETOPT_CHECK(tool_setopt_slist(x, config, #y, y, z))
|
||||
SETOPT_CHECK(tool_setopt_slist(x, global, #y, y, z))
|
||||
|
||||
#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
|
||||
#define res_setopt(x,y,z) tool_setopt(x, FALSE, global, #y, y, z)
|
||||
|
||||
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, config, #y, y, z)
|
||||
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, global, #y, y, z)
|
||||
|
||||
#else /* CURL_DISABLE_LIBCURL_OPTION */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user