* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
output = config->trace_stream;
if(!output) {
- warnf(operation, "Failed to create/open output");
+ warnf(config, "Failed to create/open output");
return 0;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
#ifdef DEBUGBUILD
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
- warnf(heads->config, "Header data exceeds single call write limit!\n");
+ warnf(heads->config->global, "Header data exceeds single call write "
+ "limit!\n");
return failure;
}
#endif
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
#ifdef DEBUGBUILD
if(config->include_headers) {
if(sz * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
- warnf(config, "Header data size exceeds single call write limit!\n");
+ warnf(config->global, "Header data size exceeds single call write "
+ "limit!\n");
return failure;
}
}
else {
if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) {
- warnf(config, "Data size exceeds single call write limit!\n");
+ warnf(config->global, "Data size exceeds single call write limit!\n");
return failure;
}
}
check_fails = TRUE;
}
if(check_fails) {
- warnf(config, "Invalid output struct data for write callback\n");
+ warnf(config->global, "Invalid output struct data for write callback\n");
return failure;
}
}
FILE *file;
if(!outs->filename || !*outs->filename) {
- warnf(config, "Remote filename has no length!\n");
+ warnf(config->global, "Remote filename has no length!\n");
return failure;
}
file = fopen(outs->filename, "rb");
if(file) {
fclose(file);
- warnf(config, "Refusing to overwrite %s: %s\n", outs->filename,
+ warnf(config->global, "Refusing to overwrite %s: %s\n", outs->filename,
strerror(EEXIST));
return failure;
}
/* open file for writing */
file = fopen(outs->filename, "wb");
if(!file) {
- warnf(config, "Failed to create the file %s: %s\n", outs->filename,
+ warnf(config->global, "Failed to create the file %s: %s\n", outs->filename,
strerror(errno));
return failure;
}
return rc;
}
-
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
else
out = stdout;
if(!out)
- warnf(config->current, "Failed to open %s to write libcurl code!\n", o);
+ warnf(config, "Failed to open %s to write libcurl code!\n", o);
else {
int i;
const char *c;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
/* verify that this is a fine type specifier */
if(2 != sscanf(type, "%127[^/]/%127[^;,\n]",
type_major, type_minor)) {
- warnf(config, "Illegally formatted content-type field!\n");
+ warnf(config->global, "Illegally formatted content-type field!\n");
Curl_safefree(contents);
FreeMultiInfo(&multi_start, &multi_current);
return 2; /* illegal content-type syntax! */
semicolon = (';' == *ptr) ? TRUE : FALSE;
if(*unknown) {
*word_end = '\0';
- warnf(config, "skip unknown form field: %s\n", unknown);
+ warnf(config->global, "skip unknown form field: %s\n", unknown);
}
}
}
if(*contp && !AddMultiFiles(contp, type, filename, &multi_start,
&multi_current)) {
- warnf(config, "Error building form post!\n");
+ warnf(config->global, "Error building form post!\n");
Curl_safefree(contents);
FreeMultiInfo(&multi_start, &multi_current);
return 3;
if(curl_formadd(httppost, last_post,
CURLFORM_COPYNAME, name,
CURLFORM_ARRAY, forms, CURLFORM_END) != 0) {
- warnf(config, "curl_formadd failed!\n");
+ warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(forms);
Curl_safefree(contents);
return 5;
if(curl_formadd(httppost, last_post,
CURLFORM_ARRAY, info, CURLFORM_END ) != 0) {
- warnf(config, "curl_formadd failed, possibly the file %s is bad!\n",
- contp+1);
+ warnf(config->global, "curl_formadd failed, possibly the file %s is "
+ "bad!\n", contp + 1);
Curl_safefree(contents);
return 6;
}
else {
#ifdef CURL_DOES_CONVERSIONS
if(convert_to_network(contp, strlen(contp))) {
- warnf(config, "curl_formadd failed!\n");
+ warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(contents);
return 7;
}
info[i].option = CURLFORM_END;
if(curl_formadd(httppost, last_post,
CURLFORM_ARRAY, info, CURLFORM_END) != 0) {
- warnf(config, "curl_formadd failed!\n");
+ warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(contents);
return 8;
}
}
else {
- warnf(config, "Illegally formatted input field!\n");
+ warnf(config->global, "Illegally formatted input field!\n");
return 1;
}
Curl_safefree(contents);
return 0;
}
-
case 'g': /* --trace */
GetStr(&global->trace_dump, nextarg);
if(global->tracetype && (global->tracetype != TRACE_BIN))
- warnf(config, "--trace overrides an earlier trace/verbose option\n");
+ warnf(global, "--trace overrides an earlier trace/verbose option\n");
global->tracetype = TRACE_BIN;
break;
case 'G': /* --npn */
case 'h': /* --trace-ascii */
GetStr(&global->trace_dump, nextarg);
if(global->tracetype && (global->tracetype != TRACE_ASCII))
- warnf(config,
+ warnf(global,
"--trace-ascii overrides an earlier trace/verbose option\n");
global->tracetype = TRACE_ASCII;
break;
/* for plain bytes, leave as-is */
break;
default:
- warnf(config, "unsupported rate unit. Use G, M, K or B!\n");
+ warnf(global, "unsupported rate unit. Use G, M, K or B!\n");
return PARAM_BAD_USE;
}
config->recvpersecond = value;
if(strcmp(nextarg, "-")) {
FILE *newfile = fopen(nextarg, "wt");
if(!newfile)
- warnf(config, "Failed to open %s!\n", nextarg);
+ warnf(global, "Failed to open %s!\n", nextarg);
else {
if(global->errors_fopened)
fclose(global->errors);
else {
config->localportrange -= config->localport;
if(config->localportrange < 1) {
- warnf(config, "bad range input\n");
+ warnf(global, "bad range input\n");
return PARAM_BAD_USE;
}
}
break;
case 'z': /* --libcurl */
#ifdef CURL_DISABLE_LIBCURL_OPTION
- warnf(config,
+ warnf(global,
"--libcurl option was disabled at build-time!\n");
return PARAM_OPTION_UNKNOWN;
#else
int mlmaj, mlmin, mlpatch;
metalink_get_version(&mlmaj, &mlmin, &mlpatch);
if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {
- warnf(config,
+ warnf(global,
"--metalink option cannot be used because the version of "
"the linked libmetalink library is too old. "
"Required: %d.%d.%d, found %d.%d.%d\n",
else
config->use_metalink = toggle;
#else
- warnf(config, "--metalink option is ignored because the binary is "
+ warnf(global, "--metalink option is ignored because the binary is "
"built without the Metalink support.\n");
#endif
break;
#ifdef CURLDEBUG
config->test_event_based = toggle;
#else
- warnf(config, "--test-event is ignored unless a debug build!\n");
+ warnf(global, "--test-event is ignored unless a debug build!\n");
#endif
break;
case 'M': /* --unix-socket */
else {
file = fopen(p, "rb");
if(!file)
- warnf(config,
+ warnf(global,
"Couldn't read data from file \"%s\", this makes "
"an empty POST.\n", nextarg);
}
else {
file = fopen(nextarg, "rb");
if(!file)
- warnf(config, "Couldn't read data from file \"%s\", this makes "
+ warnf(global, "Couldn't read data from file \"%s\", this makes "
"an empty POST.\n", nextarg);
}
break;
case 'J': /* --remote-header-name */
if(config->include_headers) {
- warnf(config,
+ warnf(global,
"--include and --remote-header-name cannot be combined.\n");
return PARAM_BAD_USE;
}
break;
case 'K': /* parse config file */
if(parseconfig(nextarg, global))
- warnf(config, "error trying read config from the '%s' file\n",
+ warnf(global, "error trying read config from the '%s' file\n",
nextarg);
break;
case 'l':
#ifdef USE_MANUAL
return PARAM_MANUAL_REQUESTED;
#else
- warnf(config,
+ warnf(global,
"built-in manual was disabled at build-time!\n");
return PARAM_OPTION_UNKNOWN;
#endif
if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
char buffer[32];
curl_off_t off;
- warnf(config,
+ warnf(global,
"A specified range MUST include at least one dash (-). "
"Appending one for you!\n");
off = curlx_strtoofft(nextarg, NULL, 10);
tmp_range = nextarg;
while(*tmp_range != '\0') {
if(!ISDIGIT(*tmp_range) && *tmp_range != '-' && *tmp_range != ',') {
- warnf(config,"Invalid character is found in given range. "
+ warnf(global, "Invalid character is found in given range. "
"A specified range MUST have only digits in "
"\'start\'-\'stop\'. The server's response to this "
"request is uncertain.\n");
if(!global->trace_dump)
return PARAM_NO_MEM;
if(global->tracetype && (global->tracetype != TRACE_PLAIN))
- warnf(config,
+ warnf(global,
"-v, --verbose overrides an earlier trace/verbose option\n");
global->tracetype = TRACE_PLAIN;
}
if(err)
return err;
if(!config->writeout)
- warnf(config, "Failed to read %s", fname);
+ warnf(global, "Failed to read %s", fname);
}
else
GetStr(&config->writeout, nextarg);
if(-1 == stat(nextarg, &statbuf)) {
/* failed, remove time condition */
config->timecond = CURL_TIMECOND_NONE;
- warnf(config,
+ warnf(global,
"Illegal date format for -z, --timecond (and not "
"a file name). Disabling time condition. "
"See curl_getdate(3) for valid date syntax.\n");
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
*store = req;
return 0;
}
- warnf(config, "You can only select one HTTP request!\n");
+
+ warnf(config->global, "You can only select one HTTP request!\n");
+
return 1;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* mute (--silent) was selected.
*/
-void warnf(struct OperationConfig *config, const char *fmt, ...)
+void warnf(struct GlobalConfig *config, const char *fmt, ...)
{
- if(!config->global->mute) {
+ if(!config->mute) {
va_list ap;
int len;
char *ptr;
ptr = print_buffer;
while(len > 0) {
- fputs(WARN_PREFIX, config->global->errors);
+ fputs(WARN_PREFIX, config->errors);
if(len > (int)WARN_TEXTWIDTH) {
int cut = WARN_TEXTWIDTH-1;
max text width then! */
cut = WARN_TEXTWIDTH-1;
- (void)fwrite(ptr, cut + 1, 1, config->global->errors);
- fputs("\n", config->global->errors);
+ (void)fwrite(ptr, cut + 1, 1, config->errors);
+ fputs("\n", config->errors);
ptr += cut+1; /* skip the space too */
len -= cut;
}
else {
- fputs(ptr, config->global->errors);
+ fputs(ptr, config->errors);
len = 0;
}
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
***************************************************************************/
#include "tool_setup.h"
-void warnf(struct OperationConfig *config, const char *fmt, ...);
+void warnf(struct GlobalConfig *config, const char *fmt, ...);
void helpf(FILE *errors, const char *fmt, ...);
if(!curlx_strequal(config->headerfile, "-")) {
FILE *newfile = fopen(config->headerfile, "wb");
if(!newfile) {
- warnf(config, "Failed to open %s\n", config->headerfile);
+ warnf(config->global, "Failed to open %s\n", config->headerfile);
result = CURLE_WRITE_ERROR;
goto quit_curl;
}
Curl_safefree(storefile);
if(result) {
/* bad globbing */
- warnf(config, "bad output glob!\n");
+ warnf(config->global, "bad output glob!\n");
goto quit_urls;
}
}
* we should warn him/her.
*/
if(config->proxyanyauth || (authbits>1)) {
- warnf(config,
+ warnf(config->global,
"Using --anyauth or --proxy-anyauth with upload from stdin"
" involves a big risk of it not working. Use a temporary"
" file or a fixed auth type instead!\n");
set_binmode(stdin);
if(curlx_strequal(uploadfile, ".")) {
if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0)
- warnf(config,
+ warnf(config->global,
"fcntl failed on fd=%d: %s\n", infd, strerror(errno));
}
}
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
#else
if(config->cookie || config->cookiefile || config->cookiejar) {
- warnf(config, "cookie option(s) used even though cookie support "
- "is disabled!\n");
+ warnf(config->global, "cookie option(s) used even though cookie "
+ "support is disabled!\n");
return CURLE_NOT_BUILT_IN;
}
#endif
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
if(config->alivetime != 0) {
#if !defined(TCP_KEEPIDLE) || !defined(TCP_KEEPINTVL)
- warnf(config, "Keep-alive functionality somewhat crippled due to "
- "missing support in your operating system!\n");
+ warnf(config->global, "Keep-alive functionality somewhat crippled "
+ "due to missing support in your operating system!\n");
#endif
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
static const char * const m[]={
NULL, "timeout", "HTTP error", "FTP error"
};
- warnf(config, "Transient problem: %s "
+
+ warnf(config->global, "Transient problem: %s "
"Will retry in %ld seconds. "
"%ld retries left.\n",
m[retry], retry_sleep/1000L, retry_numretries);
if(!result && config->xattr && outs.fopened && outs.stream) {
int rc = fwrite_xattr(curl, fileno(outs.stream));
if(rc)
- warnf(config, "Error setting extended attributes: %s\n",
+ warnf(config->global, "Error setting extended attributes: %s\n",
strerror(errno));
}
/* Cleanup the libcurl source output */
easysrc_cleanup();
- /* set current back to first so that isn't NULL */
- config->current = config->first;
-
/* Dump the libcurl code if previously enabled */
dumpeasysrc(config);
#endif
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
if no protocols are allowed */
if(action == set)
*val = 0;
- warnf(config, "unrecognized protocol '%s'\n", token);
+ warnf(config->global, "unrecognized protocol '%s'\n", token);
}
}
Curl_safefree(buffer);
return CURLFTPMETHOD_NOCWD;
if(curlx_raw_equal("multicwd", str))
return CURLFTPMETHOD_MULTICWD;
- warnf(config, "unrecognized ftp file method '%s', using default\n", str);
+
+ warnf(config->global, "unrecognized ftp file method '%s', using default\n",
+ str);
+
return CURLFTPMETHOD_MULTICWD;
}
return CURLFTPSSL_CCC_PASSIVE;
if(curlx_raw_equal("active", str))
return CURLFTPSSL_CCC_ACTIVE;
- warnf(config, "unrecognized ftp CCC method '%s', using default\n", str);
+
+ warnf(config->global, "unrecognized ftp CCC method '%s', using default\n",
+ str);
+
return CURLFTPSSL_CCC_PASSIVE;
}
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
if(curlx_raw_equal("always", str))
return CURLGSSAPI_DELEGATION_FLAG;
- warnf(config, "unrecognized delegation method '%s', using none\n", str);
+
+ warnf(config->global, "unrecognized delegation method '%s', using none\n",
+ str);
+
return CURLGSSAPI_DELEGATION_NONE;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
case '#': /* comment */
break;
default:
- warnf(operation, "%s:%d: warning: '%s' uses unquoted white space in"
- " the line that may cause side-effects!\n",
+ warnf(operation->global, "%s:%d: warning: '%s' uses unquoted white "
+ "space in the line that may cause side-effects!\n",
filename, lineno, option);
}
}
res != PARAM_VERSION_INFO_REQUESTED &&
res != PARAM_ENGINES_REQUESTED) {
const char *reason = param2text(res);
- warnf(operation, "%s:%d: warning: '%s' %s\n",
+ warnf(operation->global, "%s:%d: warning: '%s' %s\n",
filename, lineno, option, reason);
}
}