diff options
author | ng0 <ng0@n0.is> | 2019-05-22 16:37:08 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-05-22 16:37:08 +0000 |
commit | 76775eb29a045f4354ef7138deaf2e1721708dd4 (patch) | |
tree | 48e9517d65525dac2eeb54baac0e37bce9b58ca1 /src | |
parent | a341c3159eaeb4a6386fc3360f8d082e25b26ec3 (diff) | |
parent | 885ce31401b6789c959131754b1e5ae518964072 (diff) | |
download | gnurl-76775eb29a045f4354ef7138deaf2e1721708dd4.tar.gz gnurl-76775eb29a045f4354ef7138deaf2e1721708dd4.tar.bz2 gnurl-76775eb29a045f4354ef7138deaf2e1721708dd4.zip |
Merge tag 'curl-7_65_0' of https://github.com/curl/curl
7.65.0
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cb_prg.c | 2 | ||||
-rw-r--r-- | src/tool_cb_wrt.c | 10 | ||||
-rw-r--r-- | src/tool_cfgable.c | 6 | ||||
-rw-r--r-- | src/tool_doswin.c | 1 | ||||
-rw-r--r-- | src/tool_formparse.c | 6 | ||||
-rw-r--r-- | src/tool_getparam.c | 5 | ||||
-rw-r--r-- | src/tool_getparam.h | 3 | ||||
-rw-r--r-- | src/tool_help.c | 7 | ||||
-rw-r--r-- | src/tool_helpers.c | 4 | ||||
-rw-r--r-- | src/tool_main.c | 4 | ||||
-rw-r--r-- | src/tool_metalink.c | 4 | ||||
-rw-r--r-- | src/tool_operate.c | 34 | ||||
-rw-r--r-- | src/tool_urlglob.c | 3 |
13 files changed, 48 insertions, 41 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c index 0539e9895..e2ee54225 100644 --- a/src/tool_cb_prg.c +++ b/src/tool_cb_prg.c @@ -221,7 +221,7 @@ void progressbarinit(struct ProgressData *bar, struct winsize ts; if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts)) cols = ts.ws_col; -#elif defined(_WIN32) +#elif defined(WIN32) { HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE); CONSOLE_SCREEN_BUFFER_INFO console_info; diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 1944f16c2..2f699f326 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -81,6 +81,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) bool is_tty = config->global->isatty; #ifdef WIN32 CONSOLE_SCREEN_BUFFER_INFO console_info; + intptr_t fhnd; #endif /* @@ -158,14 +159,13 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) } } -#ifdef _WIN32 +#ifdef WIN32 + fhnd = _get_osfhandle(fileno(outs->stream)); if(isatty(fileno(outs->stream)) && - GetConsoleScreenBufferInfo( - (HANDLE)_get_osfhandle(fileno(outs->stream)), &console_info)) { + GetConsoleScreenBufferInfo((HANDLE)fhnd, &console_info)) { DWORD in_len = (DWORD)(sz * nmemb); wchar_t* wc_buf; DWORD wc_len; - intptr_t fhnd; /* calculate buffer size for wide characters */ wc_len = MultiByteToWideChar(CP_UTF8, 0, buffer, in_len, NULL, 0); @@ -180,8 +180,6 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) return failure; } - fhnd = _get_osfhandle(fileno(outs->stream)); - if(!WriteConsoleW( (HANDLE) fhnd, wc_buf, diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index fabd6d635..7d178e47c 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -34,11 +34,11 @@ void config_init(struct OperationConfig* config) config->use_httpget = FALSE; config->create_dirs = FALSE; config->maxredirs = DEFAULT_MAXREDIRS; - config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */ + config->proto = CURLPROTO_ALL; config->proto_present = FALSE; config->proto_redir = CURLPROTO_ALL & /* All except FILE, SCP and SMB */ - ~(CURLPROTO_FILE | CURLPROTO_SCP | CURLPROTO_SMB | - CURLPROTO_SMBS); + ~(CURLPROTO_FILE | CURLPROTO_SCP | CURLPROTO_SMB | + CURLPROTO_SMBS); config->proto_redir_present = FALSE; config->proto_default = NULL; config->tcp_nodelay = TRUE; /* enabled by default */ diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 8b5bdadaf..779a3cb8f 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -599,7 +599,6 @@ SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized, } memmove(base + 1, base, blen + 1); base[0] = '_'; - ++blen; } } #endif diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 49993470b..74d1533e4 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -347,12 +347,11 @@ CURLcode tool2curlmime(CURL *curl, tool_mime *m, curl_mime **mime) static char *get_param_word(char **str, char **end_pos, char endchar) { char *ptr = *str; - char *word_begin = NULL; + /* the first non-space char is here */ + char *word_begin = ptr; char *ptr2; char *escape = NULL; - /* the first non-space char is here */ - word_begin = ptr; if(*ptr == '"') { ++ptr; while(*ptr) { @@ -568,7 +567,6 @@ static int get_param_part(struct OperationConfig *config, char endchar, endpos--; sep = *p; *endpos = '\0'; - /* TODO: maybe special fopen for VMS? */ fp = fopen(hdrfile, FOPEN_READTEXT); if(!fp) warnf(config->global, "Cannot read from %s: %s\n", hdrfile, diff --git a/src/tool_getparam.c b/src/tool_getparam.c index b133cb87e..b347121f8 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -515,11 +515,13 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ const char *word = ('-' == flag[0]) ? flag + 2 : flag; size_t fnam = strlen(word); int numhits = 0; + bool noflagged = FALSE; if(!strncmp(word, "no-", 3)) { /* disable this option but ignore the "no-" part when looking for it */ word += 3; toggle = FALSE; + noflagged = TRUE; } for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) { @@ -543,6 +545,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ if(hit < 0) { return PARAM_OPTION_UNKNOWN; } + if(noflagged && (aliases[hit].desc != ARG_BOOL)) + /* --no- prefixed an option that isn't boolean! */ + return PARAM_NO_NOT_BOOLEAN; } else { flag++; /* prefixed with one dash, pass it */ diff --git a/src/tool_getparam.h b/src/tool_getparam.h index daf83b884..f6fcd5a35 100644 --- a/src/tool_getparam.h +++ b/src/tool_getparam.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2019, 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 @@ -42,6 +42,7 @@ typedef enum { PARAM_NEXT_OPERATION, PARAM_NO_PREFIX, PARAM_NUMBER_TOO_LARGE, + PARAM_NO_NOT_BOOLEAN, PARAM_LAST } ParameterError; diff --git a/src/tool_help.c b/src/tool_help.c index 8a3c25820..ad6b6a107 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -20,6 +20,9 @@ * ***************************************************************************/ #include "tool_setup.h" +#ifdef HAVE_STRCASECMP +#include <strings.h> +#endif #include "tool_panykey.h" #include "tool_help.h" @@ -593,6 +596,10 @@ void tool_version_info(void) printf(" %s", featp[i]); puts(""); /* newline */ } + if(strcmp(CURL_VERSION, curlinfo->version)) { + printf("WARNING: curl and libcurl versions do not match. " + "Functionality may be affected.\n"); + } } void tool_list_engines(CURL *curl) diff --git a/src/tool_helpers.c b/src/tool_helpers.c index b3a9516a8..61788b7f8 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2019, 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 @@ -66,6 +66,8 @@ const char *param2text(int res) return "the given option can't be reversed with a --no- prefix"; case PARAM_NUMBER_TOO_LARGE: return "too large number"; + case PARAM_NO_NOT_BOOLEAN: + return "used '--no-' for option that isn't a boolean"; default: return "unknown error"; } diff --git a/src/tool_main.c b/src/tool_main.c index 5679f361e..7d1e62b79 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -237,7 +237,7 @@ static void main_free(struct GlobalConfig *config) config->last = NULL; } -#ifdef _WIN32 +#ifdef WIN32 /* TerminalSettings for Windows */ static struct TerminalSettings { HANDLE hStdOut; @@ -275,7 +275,7 @@ static void configure_terminal(void) static void restore_terminal(void) { -#ifdef _WIN32 +#ifdef WIN32 /* Restore Console output mode and codepage to whatever they were * when Curl started */ SetConsoleMode(TerminalSettings.hStdOut, TerminalSettings.dwOutputMode); diff --git a/src/tool_metalink.c b/src/tool_metalink.c index 4c4261472..28aa71707 100644 --- a/src/tool_metalink.c +++ b/src/tool_metalink.c @@ -73,7 +73,7 @@ and later. If you're building for an older cat, well, sorry. */ # define COMMON_DIGEST_FOR_OPENSSL # include <CommonCrypto/CommonDigest.h> -#elif defined(_WIN32) +#elif defined(WIN32) /* For Windows: If no other crypto library is provided, we fallback to the hash functions provided within the Microsoft Windows CryptoAPI */ # include <wincrypt.h> @@ -380,7 +380,7 @@ static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx) sha256_finish(ctx, digest); } -#elif defined(_WIN32) +#elif defined(WIN32) static void win32_crypto_final(struct win32_crypto_hash *ctx, unsigned char *digest, diff --git a/src/tool_operate.c b/src/tool_operate.c index e1ceabe7a..462119a1c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -101,7 +101,6 @@ CURLcode curl_easy_perform_ev(CURL *easy); static bool is_fatal_error(CURLcode code) { switch(code) { - /* TODO: Should CURLE_PEER_FAILED_VERIFICATION be a critical error? */ case CURLE_FAILED_INIT: case CURLE_OUT_OF_MEMORY: case CURLE_UNKNOWN_OPTION: @@ -826,7 +825,9 @@ static CURLcode operate_do(struct GlobalConfig *global, /* where to store */ my_setopt(curl, CURLOPT_WRITEDATA, &outs); +#ifndef CURL_DISABLE_RTSP my_setopt(curl, CURLOPT_INTERLEAVEDATA, &outs); +#endif if(metalink || !config->use_metalink) /* what call to write */ my_setopt(curl, CURLOPT_WRITEFUNCTION, tool_write_cb); @@ -876,8 +877,6 @@ static CURLcode operate_do(struct GlobalConfig *global, #if !defined(CURL_DISABLE_PROXY) { - /* TODO: Make this a run-time check instead of compile-time one. */ - my_setopt_str(curl, CURLOPT_PROXY, config->proxy); /* new in libcurl 7.5 */ if(config->proxy) @@ -1018,7 +1017,9 @@ static CURLcode operate_do(struct GlobalConfig *global, } /* (built_in_protos & CURLPROTO_HTTP) */ +#ifndef CURL_DISABLE_FTP my_setopt_str(curl, CURLOPT_FTPPORT, config->ftpport); +#endif my_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, config->low_speed_limit); my_setopt(curl, CURLOPT_LOW_SPEED_TIME, config->low_speed_time); @@ -1033,8 +1034,9 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt(curl, CURLOPT_RESUME_FROM_LARGE, CURL_OFF_T_C(0)); my_setopt_str(curl, CURLOPT_KEYPASSWD, config->key_passwd); +#ifndef CURL_DISABLE_PROXY my_setopt_str(curl, CURLOPT_PROXY_KEYPASSWD, config->proxy_key_passwd); - +#endif if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) { /* SSH and SSL private key uses same command-line option */ @@ -1240,8 +1242,9 @@ static CURLcode operate_do(struct GlobalConfig *global, /* three new ones in libcurl 7.3: */ my_setopt_str(curl, CURLOPT_INTERFACE, config->iface); +#ifndef CURL_DISABLE_FTP my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel); - +#endif progressbarinit(&progressbar, config); if((global->progressmode == CURL_PROGRESS_BAR) && !global->noprogress && !global->mute) { @@ -1263,9 +1266,10 @@ static CURLcode operate_do(struct GlobalConfig *global, if(config->dns_ipv6_addr) my_setopt_str(curl, CURLOPT_DNS_LOCAL_IP6, config->dns_ipv6_addr); +#ifndef CURL_DISABLE_TELNET /* new in libcurl 7.6.2: */ my_setopt_slist(curl, CURLOPT_TELNETOPTIONS, config->telnet_options); - +#endif /* new in libcurl 7.7: */ my_setopt_str(curl, CURLOPT_RANDOM_FILE, config->random_file); my_setopt_str(curl, CURLOPT_EGDSOCKET, config->egd_file); @@ -1368,27 +1372,30 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt_str(curl, CURLOPT_SERVICE_NAME, config->service_name); +#ifndef CURL_DISABLE_FTP /* curl 7.13.0 */ my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account); - +#endif my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl?1L:0L); +#ifndef CURL_DISABLE_FTP /* curl 7.14.2 */ my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip?1L:0L); /* curl 7.15.1 */ my_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long)config->ftp_filemethod); - +#endif /* curl 7.15.2 */ if(config->localport) { my_setopt(curl, CURLOPT_LOCALPORT, config->localport); my_setopt_str(curl, CURLOPT_LOCALPORTRANGE, config->localportrange); } +#ifndef CURL_DISABLE_FTP /* curl 7.15.5 */ my_setopt_str(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER, config->ftp_alternative_to_user); - +#endif /* curl 7.16.0 */ if(config->disable_sessionid) /* disable it */ @@ -1660,10 +1667,6 @@ static CURLcode operate_do(struct GlobalConfig *global, * file (or terminal). If we write to a file, we must rewind * or close/re-open the file so that the next attempt starts * over from the beginning. - * - * TODO: similar action for the upload case. We might need - * to start over reading from a previous point if we have - * uploaded something when this was returned. */ break; } @@ -1754,8 +1757,6 @@ static CURLcode operate_do(struct GlobalConfig *global, download was not successful. */ long response; if(CURLE_OK == result) { - /* TODO We want to try next resource when download was - not successful. How to know that? */ char *effective_url = NULL; curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url); if(effective_url && @@ -1929,9 +1930,6 @@ static CURLcode operate_do(struct GlobalConfig *global, break; mlres = mlres->next; if(mlres == NULL) - /* TODO If metalink_next_res is 1 and mlres is NULL, - * set res to error code - */ break; } else if(urlnum > 1) { diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c index e9007b2b4..d6f7104ac 100644 --- a/src/tool_urlglob.c +++ b/src/tool_urlglob.c @@ -553,8 +553,7 @@ CURLcode glob_next_url(char **globbed, URLGlob *glob) } } if(carry) { /* first pattern ptr has run into overflow, done! */ - /* TODO: verify if this should actually return CURLE_OK. */ - return CURLE_OK; /* CURLE_OK to match previous behavior */ + return CURLE_OK; } } |