mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
tidy-up: miscellaneous
- vms/curlmsg_vms.h: delete unused/commented code. - vtls/schannel_verify: sort includes. - typecheck-gcc.h: fix indent and alignment. - lib/config-win32.h: drop idle `#undef`. - spacecheck: check for stray empty lines before after curly braces. - make literals more readable: 1048576 -> 1024 * 1024 - scope variables. - use ISO date in a comment. - drop redundant parentheses. - drop empty comments. - unfold lines. - duplicate/stray spaces in comments. - fix indent, whitespace, minor typos. Closes #20690
This commit is contained in:
parent
ac46392f44
commit
af78b199b2
@ -27,7 +27,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
/* */
|
||||
|
||||
#if defined(sun) || defined(__sun__) || \
|
||||
defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
# if defined(__SVR4) || defined(__srv4__)
|
||||
@ -39,7 +39,7 @@
|
||||
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
|
||||
# define PLATFORM_AIX_V3
|
||||
#endif
|
||||
/* */
|
||||
|
||||
#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3)
|
||||
#error "O_NONBLOCK does not work on this platform"
|
||||
#endif
|
||||
|
||||
@ -2335,8 +2335,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${_version_config}"
|
||||
write_basic_package_version_file("${_version_config}"
|
||||
VERSION ${_curl_version}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
file(READ "${_version_config}" _generated_version_config)
|
||||
|
||||
@ -34,7 +34,7 @@ We remove support for CMake <3.18 in April 2026.
|
||||
|
||||
CMake 3.18 was released on 2020-07-15.
|
||||
|
||||
## TLS SRP Authentication
|
||||
## TLS-SRP Authentication
|
||||
|
||||
Transport Layer Security Secure Remote Password is a TLS feature that does not
|
||||
work with TLS 1.3 or QUIC and is virtually unused by curl users and in
|
||||
|
||||
@ -172,7 +172,7 @@ int main(int argc, const char *argv[])
|
||||
/* specify URL to get */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* some servers do not like requests that are made without a user-agent
|
||||
|
||||
@ -100,7 +100,7 @@ int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode result;
|
||||
struct sockaddr_in servaddr; /* socket address structure */
|
||||
struct sockaddr_in servaddr; /* socket address structure */
|
||||
curl_socket_t sockfd;
|
||||
|
||||
result = curl_global_init(CURL_GLOBAL_ALL);
|
||||
@ -141,7 +141,7 @@ int main(void)
|
||||
/* no progress meter please */
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* call this function to get a socket */
|
||||
|
||||
@ -78,7 +78,7 @@ int main(void)
|
||||
/* specify URL to get */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* we pass our 'chunk' struct to the callback function */
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* curl write callback, to fill tidy's input buffer... */
|
||||
/* curl write callback, to fill tidy's input buffer... */
|
||||
static uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
|
||||
{
|
||||
uint r;
|
||||
|
||||
@ -77,7 +77,7 @@ static void setup(CURL *curl)
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
||||
/* write data to a struct */
|
||||
/* write data to a struct */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
init_memory(&files[0]);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &files[0]);
|
||||
|
||||
@ -56,7 +56,7 @@ int main(void)
|
||||
* this can contain a message sequence set and a number of search criteria
|
||||
* keywords including flags such as ANSWERED, DELETED, DRAFT, FLAGGED, NEW,
|
||||
* RECENT and SEEN. For more information about the search criteria please
|
||||
* see RFC-3501 section 6.4.4. */
|
||||
* see RFC-3501 section 6.4.4. */
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SEARCH NEW");
|
||||
|
||||
/* Perform the custom request */
|
||||
|
||||
@ -47,7 +47,7 @@ int main(void)
|
||||
};
|
||||
int i = 0;
|
||||
|
||||
/* Change the maximum number of persistent connection */
|
||||
/* Change the maximum number of persistent connection */
|
||||
curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 1L);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
@ -74,7 +74,7 @@ int main(void)
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.org/");
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* we pass our 'chunk' struct to the callback function */
|
||||
|
||||
@ -64,7 +64,7 @@ int main(void)
|
||||
/* no progress meter please */
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* open the header file */
|
||||
|
||||
@ -53,7 +53,7 @@ int main(void)
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
recipients = curl_slist_append(recipients, "Friends");
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ int main(void)
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
/* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array */
|
||||
recipients = curl_slist_append(recipients, "<recipient@example.com>");
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ int main(int argc, const char *argv[])
|
||||
/* disable progress meter, set to 0L to enable it */
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
|
||||
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||
|
||||
/* open the file */
|
||||
|
||||
@ -58,7 +58,6 @@ while(<S>) {
|
||||
$rem{$sym}=$a[2];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(S);
|
||||
|
||||
@ -68,7 +68,7 @@ int main(void)
|
||||
/* add a part */
|
||||
part = curl_mime_addpart(mime);
|
||||
|
||||
/* add data to the part */
|
||||
/* add data to the part */
|
||||
curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ int main(void)
|
||||
if(curl) {
|
||||
struct progress data;
|
||||
|
||||
/* pass struct to callback */
|
||||
/* pass struct to callback */
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data);
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ int main(void)
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* pass struct to callback */
|
||||
/* pass struct to callback */
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &data);
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ option.
|
||||
Using this option multiple times makes the last set string override the
|
||||
previous ones. Set it to NULL to disable its use again.
|
||||
|
||||
This feature relies on TLS SRP which does not work with TLS 1.3.
|
||||
This feature relies on TLS-SRP which does not work with TLS 1.3.
|
||||
|
||||
# DEFAULT
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ defined in RFC 5054 and provides mutual authentication if both sides have a
|
||||
shared secret. To use TLS-SRP, you must also set the
|
||||
CURLOPT_TLSAUTH_USERNAME(3) and CURLOPT_TLSAUTH_PASSWORD(3) options.
|
||||
|
||||
TLS SRP does not work with TLS 1.3.
|
||||
TLS-SRP does not work with TLS 1.3.
|
||||
|
||||
# DEFAULT
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ option.
|
||||
Using this option multiple times makes the last set string override the
|
||||
previous ones. Set it to NULL to disable its use again.
|
||||
|
||||
This feature relies on TLS SRP which does not work with TLS 1.3.
|
||||
This feature relies on TLS-SRP which does not work with TLS 1.3.
|
||||
|
||||
# DEFAULT
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ int main(void)
|
||||
CURLcode result;
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* send all data to this function */
|
||||
/* send all data to this function */
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb);
|
||||
|
||||
/* we pass our 'chunk' struct to the callback function */
|
||||
|
||||
@ -65,7 +65,7 @@ int main(void)
|
||||
if(curl) {
|
||||
struct progress data;
|
||||
|
||||
/* pass struct to callback */
|
||||
/* pass struct to callback */
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_cb);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ int main(void)
|
||||
if(curl) {
|
||||
struct progress data;
|
||||
|
||||
/* pass struct to callback */
|
||||
/* pass struct to callback */
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
|
||||
|
||||
/* enable progress callback getting called */
|
||||
|
||||
@ -100,6 +100,5 @@ EOS
|
||||
EOS
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
#define CURL_IGNORE_DEPRECATION(statements) statements
|
||||
#endif
|
||||
|
||||
#include "curlver.h" /* libcurl version defines */
|
||||
#include "curlver.h" /* libcurl version defines */
|
||||
#include "system.h" /* determine things runtime */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -1358,7 +1358,7 @@ typedef enum {
|
||||
|
||||
/* Set the krb4/5 security level, this also enables krb4/5 awareness. This
|
||||
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
|
||||
* is set but does not match one of these, 'private' will be used. */
|
||||
* is set but does not match one of these, 'private' will be used. */
|
||||
CURLOPTDEPRECATED(CURLOPT_KRBLEVEL, CURLOPTTYPE_STRINGPOINT, 63,
|
||||
8.17.0, "removed"),
|
||||
|
||||
@ -2203,7 +2203,7 @@ typedef enum {
|
||||
CURLOPT(CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, CURLOPTTYPE_STRINGPOINT, 311),
|
||||
|
||||
/* Function that will be called immediately before the initial request
|
||||
is made on a connection (after any protocol negotiation step). */
|
||||
is made on a connection (after any protocol negotiation step). */
|
||||
CURLOPT(CURLOPT_PREREQFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 312),
|
||||
|
||||
/* Data passed to the CURLOPT_PREREQFUNCTION callback */
|
||||
@ -2283,7 +2283,6 @@ typedef enum {
|
||||
#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
|
||||
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
|
||||
|
||||
/* */
|
||||
#define CURLOPT_FTP_RESPONSE_TIMEOUT CURLOPT_SERVER_RESPONSE_TIMEOUT
|
||||
|
||||
/* Added in 8.2.0 */
|
||||
@ -3310,7 +3309,7 @@ CURL_EXTERN CURLcode curl_easy_ssls_export(CURL *handle,
|
||||
#endif
|
||||
|
||||
/* unfortunately, the easy.h and multi.h include files need options and info
|
||||
stuff before they can be included! */
|
||||
stuff before they can be included! */
|
||||
#include "easy.h" /* nothing in curl is fun without the easy stuff */
|
||||
#include "multi.h"
|
||||
#include "urlapi.h"
|
||||
@ -3330,7 +3329,7 @@ CURL_EXTERN CURLcode curl_easy_ssls_export(CURL *handle,
|
||||
/* This preprocessor magic that replaces a call with the exact same call is
|
||||
only done to make sure application authors pass exactly three arguments
|
||||
to these functions. Use recursive macros to allow using these symbols via
|
||||
the C++ global namespace '::' or reuse them as method names. */
|
||||
the C++ global namespace '::' or reusing them as method names. */
|
||||
#define curl_easy_setopt(handle, opt, param) \
|
||||
curl_easy_setopt(handle, opt, param)
|
||||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
|
||||
@ -31,7 +31,7 @@ extern "C" {
|
||||
struct curl_header {
|
||||
char *name; /* this might not use the same case */
|
||||
char *value;
|
||||
size_t amount; /* number of headers using this name */
|
||||
size_t amount; /* number of headers using this name */
|
||||
size_t index; /* ... of this instance, 0 or higher */
|
||||
unsigned int origin; /* see bits below */
|
||||
void *anchor; /* handle privately used by libcurl */
|
||||
|
||||
@ -367,20 +367,20 @@
|
||||
#define CURL_PULL_SYS_POLL_H
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file
|
||||
sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file
|
||||
sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
|
||||
/* sys/poll.h is required here to properly make type definitions below. */
|
||||
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file
|
||||
sys/poll.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
@ -43,186 +43,186 @@
|
||||
|
||||
#define curl_easy_setopt(handle, option, value) \
|
||||
__extension__({ \
|
||||
if(__builtin_constant_p(option)) { \
|
||||
CURL_IGNORE_DEPRECATION( \
|
||||
if(curlcheck_long_option(option)) \
|
||||
if(!curlcheck_long(value)) \
|
||||
Wcurl_easy_setopt_err_long(); \
|
||||
if(curlcheck_off_t_option(option)) \
|
||||
if(!curlcheck_off_t(value)) \
|
||||
Wcurl_easy_setopt_err_curl_off_t(); \
|
||||
if(curlcheck_string_option(option)) \
|
||||
if(!curlcheck_string(value)) \
|
||||
Wcurl_easy_setopt_err_string(); \
|
||||
if((option) == CURLOPT_PRIVATE) { } \
|
||||
if(curlcheck_write_cb_option(option)) \
|
||||
if(!curlcheck_write_cb(value)) \
|
||||
Wcurl_easy_setopt_err_write_callback(); \
|
||||
if(curlcheck_curl_option(option)) \
|
||||
if(!curlcheck_curl(value)) \
|
||||
Wcurl_easy_setopt_err_curl(); \
|
||||
if((option) == CURLOPT_RESOLVER_START_FUNCTION) \
|
||||
if(!curlcheck_resolver_start_callback(value)) \
|
||||
Wcurl_easy_setopt_err_resolver_start_callback(); \
|
||||
if((option) == CURLOPT_READFUNCTION) \
|
||||
if(!curlcheck_read_cb(value)) \
|
||||
Wcurl_easy_setopt_err_read_cb(); \
|
||||
if((option) == CURLOPT_IOCTLFUNCTION) \
|
||||
if(!curlcheck_ioctl_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ioctl_cb(); \
|
||||
if((option) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if(!curlcheck_sockopt_cb(value)) \
|
||||
Wcurl_easy_setopt_err_sockopt_cb(); \
|
||||
if((option) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if(!curlcheck_opensocket_cb(value)) \
|
||||
Wcurl_easy_setopt_err_opensocket_cb(); \
|
||||
if((option) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if(!curlcheck_progress_cb(value)) \
|
||||
Wcurl_easy_setopt_err_progress_cb(); \
|
||||
if((option) == CURLOPT_XFERINFOFUNCTION) \
|
||||
if(!curlcheck_xferinfo_cb(value)) \
|
||||
Wcurl_easy_setopt_err_xferinfo_cb(); \
|
||||
if((option) == CURLOPT_DEBUGFUNCTION) \
|
||||
if(!curlcheck_debug_cb(value)) \
|
||||
Wcurl_easy_setopt_err_debug_cb(); \
|
||||
if((option) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if(!curlcheck_ssl_ctx_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssl_ctx_cb(); \
|
||||
if(curlcheck_conv_cb_option(option)) \
|
||||
if(!curlcheck_conv_cb(value)) \
|
||||
Wcurl_easy_setopt_err_conv_cb(); \
|
||||
if((option) == CURLOPT_SEEKFUNCTION) \
|
||||
if(!curlcheck_seek_cb(value)) \
|
||||
Wcurl_easy_setopt_err_seek_cb(); \
|
||||
if((option) == CURLOPT_CHUNK_BGN_FUNCTION) \
|
||||
if(!curlcheck_chunk_bgn_cb(value)) \
|
||||
Wcurl_easy_setopt_err_chunk_bgn_cb(); \
|
||||
if((option) == CURLOPT_CHUNK_END_FUNCTION) \
|
||||
if(!curlcheck_chunk_end_cb(value)) \
|
||||
Wcurl_easy_setopt_err_chunk_end_cb(); \
|
||||
if((option) == CURLOPT_CLOSESOCKETFUNCTION) \
|
||||
if(!curlcheck_close_socket_cb(value)) \
|
||||
Wcurl_easy_setopt_err_close_socket_cb(); \
|
||||
if((option) == CURLOPT_FNMATCH_FUNCTION) \
|
||||
if(!curlcheck_fnmatch_cb(value)) \
|
||||
Wcurl_easy_setopt_err_fnmatch_cb(); \
|
||||
if((option) == CURLOPT_HSTSREADFUNCTION) \
|
||||
if(!curlcheck_hstsread_cb(value)) \
|
||||
Wcurl_easy_setopt_err_hstsread_cb(); \
|
||||
if((option) == CURLOPT_HSTSWRITEFUNCTION) \
|
||||
if(!curlcheck_hstswrite_cb(value)) \
|
||||
Wcurl_easy_setopt_err_hstswrite_cb(); \
|
||||
if((option) == CURLOPT_SSH_HOSTKEYFUNCTION) \
|
||||
if(!curlcheck_ssh_hostkey_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssh_hostkey_cb(); \
|
||||
if((option) == CURLOPT_SSH_KEYFUNCTION) \
|
||||
if(!curlcheck_ssh_key_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssh_key_cb(); \
|
||||
if((option) == CURLOPT_INTERLEAVEFUNCTION) \
|
||||
if(!curlcheck_interleave_cb(value)) \
|
||||
Wcurl_easy_setopt_err_interleave_cb(); \
|
||||
if((option) == CURLOPT_PREREQFUNCTION) \
|
||||
if(!curlcheck_prereq_cb(value)) \
|
||||
Wcurl_easy_setopt_err_prereq_cb(); \
|
||||
if((option) == CURLOPT_TRAILERFUNCTION) \
|
||||
if(!curlcheck_trailer_cb(value)) \
|
||||
Wcurl_easy_setopt_err_trailer_cb(); \
|
||||
if(curlcheck_cb_data_option(option)) \
|
||||
if(!curlcheck_cb_data(value)) \
|
||||
Wcurl_easy_setopt_err_cb_data(); \
|
||||
if((option) == CURLOPT_ERRORBUFFER) \
|
||||
if(!curlcheck_error_buffer(value)) \
|
||||
Wcurl_easy_setopt_err_error_buffer(); \
|
||||
if((option) == CURLOPT_CURLU) \
|
||||
if(!curlcheck_ptr((value), CURLU)) \
|
||||
Wcurl_easy_setopt_err_curlu(); \
|
||||
if((option) == CURLOPT_STDERR) \
|
||||
if(!curlcheck_FILE(value)) \
|
||||
Wcurl_easy_setopt_err_FILE(); \
|
||||
if(curlcheck_postfields_option(option)) \
|
||||
if(!curlcheck_postfields(value)) \
|
||||
Wcurl_easy_setopt_err_postfields(); \
|
||||
if((option) == CURLOPT_HTTPPOST) \
|
||||
if(!curlcheck_arr((value), struct curl_httppost)) \
|
||||
Wcurl_easy_setopt_err_curl_httpost(); \
|
||||
if((option) == CURLOPT_MIMEPOST) \
|
||||
if(!curlcheck_ptr((value), curl_mime)) \
|
||||
Wcurl_easy_setopt_err_curl_mimepost(); \
|
||||
if(curlcheck_slist_option(option)) \
|
||||
if(!curlcheck_arr((value), struct curl_slist)) \
|
||||
Wcurl_easy_setopt_err_curl_slist(); \
|
||||
if((option) == CURLOPT_SHARE) \
|
||||
if(!curlcheck_ptr((value), CURLSH)) \
|
||||
Wcurl_easy_setopt_err_CURLSH(); \
|
||||
) \
|
||||
} \
|
||||
(curl_easy_setopt)(handle, option, value); \
|
||||
})
|
||||
if(__builtin_constant_p(option)) { \
|
||||
CURL_IGNORE_DEPRECATION( \
|
||||
if(curlcheck_long_option(option)) \
|
||||
if(!curlcheck_long(value)) \
|
||||
Wcurl_easy_setopt_err_long(); \
|
||||
if(curlcheck_off_t_option(option)) \
|
||||
if(!curlcheck_off_t(value)) \
|
||||
Wcurl_easy_setopt_err_curl_off_t(); \
|
||||
if(curlcheck_string_option(option)) \
|
||||
if(!curlcheck_string(value)) \
|
||||
Wcurl_easy_setopt_err_string(); \
|
||||
if((option) == CURLOPT_PRIVATE) { } \
|
||||
if(curlcheck_write_cb_option(option)) \
|
||||
if(!curlcheck_write_cb(value)) \
|
||||
Wcurl_easy_setopt_err_write_callback(); \
|
||||
if(curlcheck_curl_option(option)) \
|
||||
if(!curlcheck_curl(value)) \
|
||||
Wcurl_easy_setopt_err_curl(); \
|
||||
if((option) == CURLOPT_RESOLVER_START_FUNCTION) \
|
||||
if(!curlcheck_resolver_start_callback(value)) \
|
||||
Wcurl_easy_setopt_err_resolver_start_callback(); \
|
||||
if((option) == CURLOPT_READFUNCTION) \
|
||||
if(!curlcheck_read_cb(value)) \
|
||||
Wcurl_easy_setopt_err_read_cb(); \
|
||||
if((option) == CURLOPT_IOCTLFUNCTION) \
|
||||
if(!curlcheck_ioctl_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ioctl_cb(); \
|
||||
if((option) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if(!curlcheck_sockopt_cb(value)) \
|
||||
Wcurl_easy_setopt_err_sockopt_cb(); \
|
||||
if((option) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if(!curlcheck_opensocket_cb(value)) \
|
||||
Wcurl_easy_setopt_err_opensocket_cb(); \
|
||||
if((option) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if(!curlcheck_progress_cb(value)) \
|
||||
Wcurl_easy_setopt_err_progress_cb(); \
|
||||
if((option) == CURLOPT_XFERINFOFUNCTION) \
|
||||
if(!curlcheck_xferinfo_cb(value)) \
|
||||
Wcurl_easy_setopt_err_xferinfo_cb(); \
|
||||
if((option) == CURLOPT_DEBUGFUNCTION) \
|
||||
if(!curlcheck_debug_cb(value)) \
|
||||
Wcurl_easy_setopt_err_debug_cb(); \
|
||||
if((option) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if(!curlcheck_ssl_ctx_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssl_ctx_cb(); \
|
||||
if(curlcheck_conv_cb_option(option)) \
|
||||
if(!curlcheck_conv_cb(value)) \
|
||||
Wcurl_easy_setopt_err_conv_cb(); \
|
||||
if((option) == CURLOPT_SEEKFUNCTION) \
|
||||
if(!curlcheck_seek_cb(value)) \
|
||||
Wcurl_easy_setopt_err_seek_cb(); \
|
||||
if((option) == CURLOPT_CHUNK_BGN_FUNCTION) \
|
||||
if(!curlcheck_chunk_bgn_cb(value)) \
|
||||
Wcurl_easy_setopt_err_chunk_bgn_cb(); \
|
||||
if((option) == CURLOPT_CHUNK_END_FUNCTION) \
|
||||
if(!curlcheck_chunk_end_cb(value)) \
|
||||
Wcurl_easy_setopt_err_chunk_end_cb(); \
|
||||
if((option) == CURLOPT_CLOSESOCKETFUNCTION) \
|
||||
if(!curlcheck_close_socket_cb(value)) \
|
||||
Wcurl_easy_setopt_err_close_socket_cb(); \
|
||||
if((option) == CURLOPT_FNMATCH_FUNCTION) \
|
||||
if(!curlcheck_fnmatch_cb(value)) \
|
||||
Wcurl_easy_setopt_err_fnmatch_cb(); \
|
||||
if((option) == CURLOPT_HSTSREADFUNCTION) \
|
||||
if(!curlcheck_hstsread_cb(value)) \
|
||||
Wcurl_easy_setopt_err_hstsread_cb(); \
|
||||
if((option) == CURLOPT_HSTSWRITEFUNCTION) \
|
||||
if(!curlcheck_hstswrite_cb(value)) \
|
||||
Wcurl_easy_setopt_err_hstswrite_cb(); \
|
||||
if((option) == CURLOPT_SSH_HOSTKEYFUNCTION) \
|
||||
if(!curlcheck_ssh_hostkey_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssh_hostkey_cb(); \
|
||||
if((option) == CURLOPT_SSH_KEYFUNCTION) \
|
||||
if(!curlcheck_ssh_key_cb(value)) \
|
||||
Wcurl_easy_setopt_err_ssh_key_cb(); \
|
||||
if((option) == CURLOPT_INTERLEAVEFUNCTION) \
|
||||
if(!curlcheck_interleave_cb(value)) \
|
||||
Wcurl_easy_setopt_err_interleave_cb(); \
|
||||
if((option) == CURLOPT_PREREQFUNCTION) \
|
||||
if(!curlcheck_prereq_cb(value)) \
|
||||
Wcurl_easy_setopt_err_prereq_cb(); \
|
||||
if((option) == CURLOPT_TRAILERFUNCTION) \
|
||||
if(!curlcheck_trailer_cb(value)) \
|
||||
Wcurl_easy_setopt_err_trailer_cb(); \
|
||||
if(curlcheck_cb_data_option(option)) \
|
||||
if(!curlcheck_cb_data(value)) \
|
||||
Wcurl_easy_setopt_err_cb_data(); \
|
||||
if((option) == CURLOPT_ERRORBUFFER) \
|
||||
if(!curlcheck_error_buffer(value)) \
|
||||
Wcurl_easy_setopt_err_error_buffer(); \
|
||||
if((option) == CURLOPT_CURLU) \
|
||||
if(!curlcheck_ptr((value), CURLU)) \
|
||||
Wcurl_easy_setopt_err_curlu(); \
|
||||
if((option) == CURLOPT_STDERR) \
|
||||
if(!curlcheck_FILE(value)) \
|
||||
Wcurl_easy_setopt_err_FILE(); \
|
||||
if(curlcheck_postfields_option(option)) \
|
||||
if(!curlcheck_postfields(value)) \
|
||||
Wcurl_easy_setopt_err_postfields(); \
|
||||
if((option) == CURLOPT_HTTPPOST) \
|
||||
if(!curlcheck_arr((value), struct curl_httppost)) \
|
||||
Wcurl_easy_setopt_err_curl_httpost(); \
|
||||
if((option) == CURLOPT_MIMEPOST) \
|
||||
if(!curlcheck_ptr((value), curl_mime)) \
|
||||
Wcurl_easy_setopt_err_curl_mimepost(); \
|
||||
if(curlcheck_slist_option(option)) \
|
||||
if(!curlcheck_arr((value), struct curl_slist)) \
|
||||
Wcurl_easy_setopt_err_curl_slist(); \
|
||||
if((option) == CURLOPT_SHARE) \
|
||||
if(!curlcheck_ptr((value), CURLSH)) \
|
||||
Wcurl_easy_setopt_err_CURLSH(); \
|
||||
) \
|
||||
} \
|
||||
(curl_easy_setopt)(handle, option, value); \
|
||||
})
|
||||
|
||||
/* wraps curl_easy_getinfo() with type checking */
|
||||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
__extension__({ \
|
||||
if(__builtin_constant_p(info)) { \
|
||||
CURL_IGNORE_DEPRECATION( \
|
||||
if(curlcheck_string_info(info)) \
|
||||
if(!curlcheck_arr((arg), char *)) \
|
||||
Wcurl_easy_getinfo_err_string(); \
|
||||
if(curlcheck_long_info(info)) \
|
||||
if(!curlcheck_arr((arg), long)) \
|
||||
Wcurl_easy_getinfo_err_long(); \
|
||||
if(curlcheck_double_info(info)) \
|
||||
if(!curlcheck_arr((arg), double)) \
|
||||
Wcurl_easy_getinfo_err_double(); \
|
||||
if(curlcheck_slist_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_slist *)) \
|
||||
Wcurl_easy_getinfo_err_curl_slist(); \
|
||||
if(curlcheck_tlssessioninfo_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
|
||||
Wcurl_easy_getinfo_err_curl_tlssessioninfo(); \
|
||||
if(curlcheck_certinfo_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
|
||||
Wcurl_easy_getinfo_err_curl_certinfo(); \
|
||||
if(curlcheck_socket_info(info)) \
|
||||
if(!curlcheck_arr((arg), curl_socket_t)) \
|
||||
Wcurl_easy_getinfo_err_curl_socket(); \
|
||||
if(curlcheck_off_t_info(info)) \
|
||||
if(!curlcheck_arr((arg), curl_off_t)) \
|
||||
Wcurl_easy_getinfo_err_curl_off_t(); \
|
||||
) \
|
||||
} \
|
||||
(curl_easy_getinfo)(handle, info, arg); \
|
||||
})
|
||||
if(__builtin_constant_p(info)) { \
|
||||
CURL_IGNORE_DEPRECATION( \
|
||||
if(curlcheck_string_info(info)) \
|
||||
if(!curlcheck_arr((arg), char *)) \
|
||||
Wcurl_easy_getinfo_err_string(); \
|
||||
if(curlcheck_long_info(info)) \
|
||||
if(!curlcheck_arr((arg), long)) \
|
||||
Wcurl_easy_getinfo_err_long(); \
|
||||
if(curlcheck_double_info(info)) \
|
||||
if(!curlcheck_arr((arg), double)) \
|
||||
Wcurl_easy_getinfo_err_double(); \
|
||||
if(curlcheck_slist_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_slist *)) \
|
||||
Wcurl_easy_getinfo_err_curl_slist(); \
|
||||
if(curlcheck_tlssessioninfo_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
|
||||
Wcurl_easy_getinfo_err_curl_tlssessioninfo(); \
|
||||
if(curlcheck_certinfo_info(info)) \
|
||||
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
|
||||
Wcurl_easy_getinfo_err_curl_certinfo(); \
|
||||
if(curlcheck_socket_info(info)) \
|
||||
if(!curlcheck_arr((arg), curl_socket_t)) \
|
||||
Wcurl_easy_getinfo_err_curl_socket(); \
|
||||
if(curlcheck_off_t_info(info)) \
|
||||
if(!curlcheck_arr((arg), curl_off_t)) \
|
||||
Wcurl_easy_getinfo_err_curl_off_t(); \
|
||||
) \
|
||||
} \
|
||||
(curl_easy_getinfo)(handle, info, arg); \
|
||||
})
|
||||
|
||||
#define curl_multi_setopt(handle, option, value) \
|
||||
__extension__({ \
|
||||
if(__builtin_constant_p(option)) { \
|
||||
if(curlcheck_long_option(option)) \
|
||||
if(!curlcheck_long(value)) \
|
||||
Wcurl_multi_setopt_err_long(); \
|
||||
if(curlcheck_off_t_option(option)) \
|
||||
if(!curlcheck_off_t(value)) \
|
||||
Wcurl_multi_setopt_err_curl_off_t(); \
|
||||
if(curlcheck_multicb_data_option(option)) \
|
||||
if(!curlcheck_cb_data(value)) \
|
||||
Wcurl_multi_setopt_err_cb_data(); \
|
||||
if(curlcheck_charpp_option(option)) \
|
||||
if(!curlcheck_ptrptr(value, char)) \
|
||||
Wcurl_multi_setopt_err_charpp(); \
|
||||
if((option) == CURLMOPT_NOTIFYFUNCTION) \
|
||||
if(!curlcheck_multinotify_cb(value)) \
|
||||
Wcurl_multi_setopt_err_notifycb(); \
|
||||
if((option) == CURLMOPT_PUSHFUNCTION) \
|
||||
if(!curlcheck_multipush_cb(value)) \
|
||||
Wcurl_multi_setopt_err_pushcb(); \
|
||||
if((option) == CURLMOPT_SOCKETFUNCTION) \
|
||||
if(!curlcheck_multisocket_cb(value)) \
|
||||
Wcurl_multi_setopt_err_socketcb(); \
|
||||
if((option) == CURLMOPT_TIMERFUNCTION) \
|
||||
if(!curlcheck_multitimer_cb(value)) \
|
||||
Wcurl_multi_setopt_err_timercb(); \
|
||||
} \
|
||||
(curl_multi_setopt)(handle, option, value); \
|
||||
})
|
||||
if(__builtin_constant_p(option)) { \
|
||||
if(curlcheck_long_option(option)) \
|
||||
if(!curlcheck_long(value)) \
|
||||
Wcurl_multi_setopt_err_long(); \
|
||||
if(curlcheck_off_t_option(option)) \
|
||||
if(!curlcheck_off_t(value)) \
|
||||
Wcurl_multi_setopt_err_curl_off_t(); \
|
||||
if(curlcheck_multicb_data_option(option)) \
|
||||
if(!curlcheck_cb_data(value)) \
|
||||
Wcurl_multi_setopt_err_cb_data(); \
|
||||
if(curlcheck_charpp_option(option)) \
|
||||
if(!curlcheck_ptrptr(value, char)) \
|
||||
Wcurl_multi_setopt_err_charpp(); \
|
||||
if((option) == CURLMOPT_NOTIFYFUNCTION) \
|
||||
if(!curlcheck_multinotify_cb(value)) \
|
||||
Wcurl_multi_setopt_err_notifycb(); \
|
||||
if((option) == CURLMOPT_PUSHFUNCTION) \
|
||||
if(!curlcheck_multipush_cb(value)) \
|
||||
Wcurl_multi_setopt_err_pushcb(); \
|
||||
if((option) == CURLMOPT_SOCKETFUNCTION) \
|
||||
if(!curlcheck_multisocket_cb(value)) \
|
||||
Wcurl_multi_setopt_err_socketcb(); \
|
||||
if((option) == CURLMOPT_TIMERFUNCTION) \
|
||||
if(!curlcheck_multitimer_cb(value)) \
|
||||
Wcurl_multi_setopt_err_timercb(); \
|
||||
} \
|
||||
(curl_multi_setopt)(handle, option, value); \
|
||||
})
|
||||
|
||||
/* evaluates to true if the option takes a data argument to pass to a
|
||||
callback */
|
||||
@ -512,82 +512,84 @@ CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
|
||||
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
|
||||
|
||||
/* evaluates to true if option takes a data argument to pass to a callback */
|
||||
#define curlcheck_cb_data_option(option) \
|
||||
((option) == CURLOPT_CHUNK_DATA || \
|
||||
(option) == CURLOPT_CLOSESOCKETDATA || \
|
||||
(option) == CURLOPT_DEBUGDATA || \
|
||||
(option) == CURLOPT_FNMATCH_DATA || \
|
||||
(option) == CURLOPT_HEADERDATA || \
|
||||
(option) == CURLOPT_HSTSREADDATA || \
|
||||
(option) == CURLOPT_HSTSWRITEDATA || \
|
||||
(option) == CURLOPT_INTERLEAVEDATA || \
|
||||
(option) == CURLOPT_IOCTLDATA || \
|
||||
(option) == CURLOPT_OPENSOCKETDATA || \
|
||||
(option) == CURLOPT_PREREQDATA || \
|
||||
(option) == CURLOPT_XFERINFODATA || \
|
||||
(option) == CURLOPT_READDATA || \
|
||||
(option) == CURLOPT_SEEKDATA || \
|
||||
(option) == CURLOPT_SOCKOPTDATA || \
|
||||
(option) == CURLOPT_SSH_KEYDATA || \
|
||||
(option) == CURLOPT_SSL_CTX_DATA || \
|
||||
(option) == CURLOPT_WRITEDATA || \
|
||||
(option) == CURLOPT_RESOLVER_START_DATA || \
|
||||
(option) == CURLOPT_TRAILERDATA || \
|
||||
(option) == CURLOPT_SSH_HOSTKEYDATA || \
|
||||
#define curlcheck_cb_data_option(option) \
|
||||
((option) == CURLOPT_CHUNK_DATA || \
|
||||
(option) == CURLOPT_CLOSESOCKETDATA || \
|
||||
(option) == CURLOPT_DEBUGDATA || \
|
||||
(option) == CURLOPT_FNMATCH_DATA || \
|
||||
(option) == CURLOPT_HEADERDATA || \
|
||||
(option) == CURLOPT_HSTSREADDATA || \
|
||||
(option) == CURLOPT_HSTSWRITEDATA || \
|
||||
(option) == CURLOPT_INTERLEAVEDATA || \
|
||||
(option) == CURLOPT_IOCTLDATA || \
|
||||
(option) == CURLOPT_OPENSOCKETDATA || \
|
||||
(option) == CURLOPT_PREREQDATA || \
|
||||
(option) == CURLOPT_XFERINFODATA || \
|
||||
(option) == CURLOPT_READDATA || \
|
||||
(option) == CURLOPT_SEEKDATA || \
|
||||
(option) == CURLOPT_SOCKOPTDATA || \
|
||||
(option) == CURLOPT_SSH_KEYDATA || \
|
||||
(option) == CURLOPT_SSL_CTX_DATA || \
|
||||
(option) == CURLOPT_WRITEDATA || \
|
||||
(option) == CURLOPT_RESOLVER_START_DATA || \
|
||||
(option) == CURLOPT_TRAILERDATA || \
|
||||
(option) == CURLOPT_SSH_HOSTKEYDATA || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a POST data argument (void* or char*) */
|
||||
#define curlcheck_postfields_option(option) \
|
||||
((option) == CURLOPT_POSTFIELDS || \
|
||||
(option) == CURLOPT_COPYPOSTFIELDS || \
|
||||
#define curlcheck_postfields_option(option) \
|
||||
((option) == CURLOPT_POSTFIELDS || \
|
||||
(option) == CURLOPT_COPYPOSTFIELDS || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a struct curl_slist * argument */
|
||||
#define curlcheck_slist_option(option) \
|
||||
((option) == CURLOPT_HTTP200ALIASES || \
|
||||
(option) == CURLOPT_HTTPHEADER || \
|
||||
(option) == CURLOPT_MAIL_RCPT || \
|
||||
(option) == CURLOPT_POSTQUOTE || \
|
||||
(option) == CURLOPT_PREQUOTE || \
|
||||
(option) == CURLOPT_PROXYHEADER || \
|
||||
(option) == CURLOPT_QUOTE || \
|
||||
(option) == CURLOPT_RESOLVE || \
|
||||
(option) == CURLOPT_TELNETOPTIONS || \
|
||||
(option) == CURLOPT_CONNECT_TO || \
|
||||
#define curlcheck_slist_option(option) \
|
||||
((option) == CURLOPT_HTTP200ALIASES || \
|
||||
(option) == CURLOPT_HTTPHEADER || \
|
||||
(option) == CURLOPT_MAIL_RCPT || \
|
||||
(option) == CURLOPT_POSTQUOTE || \
|
||||
(option) == CURLOPT_PREQUOTE || \
|
||||
(option) == CURLOPT_PROXYHEADER || \
|
||||
(option) == CURLOPT_QUOTE || \
|
||||
(option) == CURLOPT_RESOLVE || \
|
||||
(option) == CURLOPT_TELNETOPTIONS || \
|
||||
(option) == CURLOPT_CONNECT_TO || \
|
||||
0)
|
||||
|
||||
/* groups of curl_easy_getinfo infos that take the same type of argument */
|
||||
|
||||
/* evaluates to true if info expects a pointer to char * argument */
|
||||
#define curlcheck_string_info(info) \
|
||||
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
|
||||
#define curlcheck_string_info(info) \
|
||||
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
|
||||
(info) != CURLINFO_PRIVATE)
|
||||
|
||||
/* evaluates to true if info expects a pointer to long argument */
|
||||
#define curlcheck_long_info(info) \
|
||||
#define curlcheck_long_info(info) \
|
||||
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
|
||||
|
||||
/* evaluates to true if info expects a pointer to double argument */
|
||||
#define curlcheck_double_info(info) \
|
||||
#define curlcheck_double_info(info) \
|
||||
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
|
||||
|
||||
/* true if info expects a pointer to struct curl_slist * argument */
|
||||
#define curlcheck_slist_info(info) \
|
||||
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
|
||||
(((info) == CURLINFO_SSL_ENGINES) || \
|
||||
((info) == CURLINFO_COOKIELIST))
|
||||
|
||||
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
|
||||
#define curlcheck_tlssessioninfo_info(info) \
|
||||
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
|
||||
#define curlcheck_tlssessioninfo_info(info) \
|
||||
(((info) == CURLINFO_TLS_SSL_PTR) || \
|
||||
((info) == CURLINFO_TLS_SESSION))
|
||||
|
||||
/* true if info expects a pointer to struct curl_certinfo * argument */
|
||||
#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
|
||||
|
||||
/* true if info expects a pointer to struct curl_socket_t argument */
|
||||
#define curlcheck_socket_info(info) \
|
||||
#define curlcheck_socket_info(info) \
|
||||
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
|
||||
|
||||
/* true if info expects a pointer to curl_off_t argument */
|
||||
#define curlcheck_off_t_info(info) \
|
||||
#define curlcheck_off_t_info(info) \
|
||||
(CURLINFO_OFF_T < (info))
|
||||
|
||||
/*
|
||||
@ -604,7 +606,7 @@ CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
|
||||
*/
|
||||
|
||||
/* XXX: should evaluate to true if expr is a pointer */
|
||||
#define curlcheck_any_ptr(expr) \
|
||||
#define curlcheck_any_ptr(expr) \
|
||||
(sizeof(expr) == sizeof(void *))
|
||||
|
||||
/* evaluates to true if expr is NULL */
|
||||
@ -668,7 +670,7 @@ CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
|
||||
)
|
||||
|
||||
/* evaluates to true if expr is of type curl_off_t */
|
||||
#define curlcheck_off_t(expr) \
|
||||
#define curlcheck_off_t(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
|
||||
|
||||
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
||||
@ -706,8 +708,8 @@ CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
|
||||
__builtin_types_compatible_p(__typeof__(func) *, type))
|
||||
|
||||
/* evaluates to true if expr is of type curl_resolver_start_callback */
|
||||
#define curlcheck_resolver_start_callback(expr) \
|
||||
(curlcheck_NULL(expr) || \
|
||||
#define curlcheck_resolver_start_callback(expr) \
|
||||
(curlcheck_NULL(expr) || \
|
||||
curlcheck_cb_compatible((expr), curl_resolver_start_callback))
|
||||
|
||||
/* evaluates to true if expr is of type curl_read_callback or "similar" */
|
||||
@ -741,11 +743,11 @@ typedef size_t (*Wcurl_read_callback6)(void *, size_t, size_t, FILE *);
|
||||
curlcheck_cb_compatible((expr), Wcurl_write_callback6))
|
||||
typedef size_t (*Wcurl_write_callback1)(const char *, size_t, size_t, void *);
|
||||
typedef size_t (*Wcurl_write_callback2)(const char *, size_t, size_t,
|
||||
const void *);
|
||||
const void *);
|
||||
typedef size_t (*Wcurl_write_callback3)(const char *, size_t, size_t, FILE *);
|
||||
typedef size_t (*Wcurl_write_callback4)(const void *, size_t, size_t, void *);
|
||||
typedef size_t (*Wcurl_write_callback5)(const void *, size_t, size_t,
|
||||
const void *);
|
||||
const void *);
|
||||
typedef size_t (*Wcurl_write_callback6)(const void *, size_t, size_t, FILE *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
|
||||
@ -769,7 +771,7 @@ typedef curlioerr (*Wcurl_ioctl_callback4)(CURL *, curliocmd, const void *);
|
||||
curlcheck_cb_compatible((expr), Wcurl_sockopt_callback2))
|
||||
typedef int (*Wcurl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
||||
typedef int (*Wcurl_sockopt_callback2)(const void *, curl_socket_t,
|
||||
curlsocktype);
|
||||
curlsocktype);
|
||||
|
||||
/* evaluates to true if expr is of type curl_opensocket_callback or
|
||||
"similar" */
|
||||
@ -817,21 +819,21 @@ typedef int (*Wcurl_progress_callback2)(const void *,
|
||||
curlcheck_cb_compatible((expr), Wcurl_debug_callback6) || \
|
||||
curlcheck_cb_compatible((expr), Wcurl_debug_callback7) || \
|
||||
curlcheck_cb_compatible((expr), Wcurl_debug_callback8))
|
||||
typedef int (*Wcurl_debug_callback1) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback1)(CURL *,
|
||||
curl_infotype, char *, size_t, void *);
|
||||
typedef int (*Wcurl_debug_callback2) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback2)(CURL *,
|
||||
curl_infotype, char *, size_t, const void *);
|
||||
typedef int (*Wcurl_debug_callback3) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback3)(CURL *,
|
||||
curl_infotype, const char *, size_t, void *);
|
||||
typedef int (*Wcurl_debug_callback4) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback4)(CURL *,
|
||||
curl_infotype, const char *, size_t, const void *);
|
||||
typedef int (*Wcurl_debug_callback5) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback5)(CURL *,
|
||||
curl_infotype, unsigned char *, size_t, void *);
|
||||
typedef int (*Wcurl_debug_callback6) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback6)(CURL *,
|
||||
curl_infotype, unsigned char *, size_t, const void *);
|
||||
typedef int (*Wcurl_debug_callback7) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback7)(CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, void *);
|
||||
typedef int (*Wcurl_debug_callback8) (CURL *,
|
||||
typedef int (*Wcurl_debug_callback8)(CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
||||
|
||||
@ -229,7 +229,6 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
|
||||
/*
|
||||
* Write this single altsvc entry to a single output line
|
||||
*/
|
||||
|
||||
static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
|
||||
{
|
||||
struct tm stamp;
|
||||
|
||||
@ -600,8 +600,8 @@ async_ares_node2addr(struct ares_addrinfo_node *node)
|
||||
for(ai = node; ai != NULL; ai = ai->ai_next) {
|
||||
size_t ss_size;
|
||||
struct Curl_addrinfo *ca;
|
||||
/* ignore elements with unsupported address family, */
|
||||
/* settle family-specific sockaddr structure size. */
|
||||
/* ignore elements with unsupported address family,
|
||||
settle family-specific sockaddr structure size. */
|
||||
if(ai->ai_family == AF_INET)
|
||||
ss_size = sizeof(struct sockaddr_in);
|
||||
#ifdef USE_IPV6
|
||||
@ -625,8 +625,8 @@ async_ares_node2addr(struct ares_addrinfo_node *node)
|
||||
break;
|
||||
}
|
||||
|
||||
/* copy each structure member individually, member ordering, */
|
||||
/* size, or padding might be different for each platform. */
|
||||
/* copy each structure member individually, member ordering,
|
||||
size, or padding might be different for each platform. */
|
||||
|
||||
ca->ai_flags = ai->ai_flags;
|
||||
ca->ai_family = ai->ai_family;
|
||||
|
||||
@ -117,7 +117,7 @@ typedef CURLcode Curl_cft_conn_keep_alive(struct Curl_cfilter *cf,
|
||||
*/
|
||||
/* data event arg1 arg2 return */
|
||||
#define CF_CTRL_DATA_SETUP 4 /* 0 NULL first fail */
|
||||
/* unused now 5 */
|
||||
/* unused now 5 */
|
||||
#define CF_CTRL_DATA_PAUSE 6 /* on/off NULL first fail */
|
||||
#define CF_CTRL_DATA_DONE 7 /* premature NULL ignored */
|
||||
#define CF_CTRL_DATA_DONE_SEND 8 /* 0 NULL ignored */
|
||||
@ -170,7 +170,7 @@ typedef CURLcode Curl_cft_cntrl(struct Curl_cfilter *cf,
|
||||
#define CF_QUERY_STREAM_ERROR 6 /* error code - */
|
||||
#define CF_QUERY_NEED_FLUSH 7 /* TRUE/FALSE - */
|
||||
#define CF_QUERY_IP_INFO 8 /* TRUE/FALSE struct ip_quadruple */
|
||||
#define CF_QUERY_HTTP_VERSION 9 /* number (10/11/20/30) - */
|
||||
#define CF_QUERY_HTTP_VERSION 9 /* number (10/11/20/30) - */
|
||||
/* pass in a `const struct Curl_sockaddr_ex **` as `pres2`. Gets set
|
||||
* to NULL when not connected. */
|
||||
#define CF_QUERY_REMOTE_ADDR 10 /* - `Curl_sockaddr_ex *` */
|
||||
|
||||
@ -284,7 +284,6 @@
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#ifndef CURL_WINDOWS_UWP
|
||||
#undef HAVE_LDAP_URL_PARSE
|
||||
#define HAVE_LDAP_SSL 1
|
||||
#define USE_WIN32_LDAP 1
|
||||
#endif
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
#include "multiif.h"
|
||||
#include "curlx/inet_ntop.h"
|
||||
#include "curlx/strparse.h"
|
||||
#include "vtls/vtls.h" /* for vtsl cfilters */
|
||||
#include "vtls/vtls.h" /* for vtls cfilters */
|
||||
#include "progress.h"
|
||||
#include "conncache.h"
|
||||
#include "multihandle.h"
|
||||
|
||||
@ -115,8 +115,8 @@ int Curl_getaddrinfo_ex(const char *nodename,
|
||||
|
||||
for(ai = aihead; ai != NULL; ai = ai->ai_next) {
|
||||
size_t namelen = ai->ai_canonname ? strlen(ai->ai_canonname) + 1 : 0;
|
||||
/* ignore elements with unsupported address family, */
|
||||
/* settle family-specific sockaddr structure size. */
|
||||
/* ignore elements with unsupported address family,
|
||||
settle family-specific sockaddr structure size. */
|
||||
if(ai->ai_family == AF_INET)
|
||||
ss_size = sizeof(struct sockaddr_in);
|
||||
#ifdef USE_IPV6
|
||||
@ -140,8 +140,8 @@ int Curl_getaddrinfo_ex(const char *nodename,
|
||||
break;
|
||||
}
|
||||
|
||||
/* copy each structure member individually, member ordering, */
|
||||
/* size, or padding might be different for each platform. */
|
||||
/* copy each structure member individually, member ordering,
|
||||
size, or padding might be different for each platform. */
|
||||
|
||||
ca->ai_flags = ai->ai_flags;
|
||||
ca->ai_family = ai->ai_family;
|
||||
|
||||
@ -725,13 +725,13 @@ ${SIZEOF_TIME_T_CODE}
|
||||
automatically */
|
||||
#cmakedefine CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG 1
|
||||
|
||||
/* to enable NGHTTP2 */
|
||||
/* to enable NGHTTP2 */
|
||||
#cmakedefine USE_NGHTTP2 1
|
||||
|
||||
/* to enable NGTCP2 */
|
||||
#cmakedefine USE_NGTCP2 1
|
||||
|
||||
/* to enable NGHTTP3 */
|
||||
/* to enable NGHTTP3 */
|
||||
#cmakedefine USE_NGHTTP3 1
|
||||
|
||||
/* to enable quiche */
|
||||
@ -743,13 +743,13 @@ ${SIZEOF_TIME_T_CODE}
|
||||
/* Define to 1 if you have the quiche_conn_set_qlog_fd function. */
|
||||
#cmakedefine HAVE_QUICHE_CONN_SET_QLOG_FD 1
|
||||
|
||||
/* if Unix domain sockets are enabled */
|
||||
/* if Unix domain sockets are enabled */
|
||||
#cmakedefine USE_UNIX_SOCKETS 1
|
||||
|
||||
/* to enable SSPI support */
|
||||
#cmakedefine USE_WINDOWS_SSPI 1
|
||||
|
||||
/* to enable Windows SSL */
|
||||
/* to enable Windows SSL */
|
||||
#cmakedefine USE_SCHANNEL 1
|
||||
|
||||
/* if Watt-32 is in use */
|
||||
|
||||
@ -28,10 +28,10 @@
|
||||
#define MERR_MEM 1
|
||||
#define MERR_TOO_LARGE 2
|
||||
|
||||
/* Lower-case digits. */
|
||||
/* Lower-case digits. */
|
||||
extern const unsigned char Curl_ldigits[];
|
||||
|
||||
/* Upper-case digits. */
|
||||
/* Upper-case digits. */
|
||||
extern const unsigned char Curl_udigits[];
|
||||
|
||||
#endif /* HEADER_CURL_PRINTF_H */
|
||||
|
||||
@ -147,11 +147,11 @@ void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data,
|
||||
/* Check if we have enough auth data and capabilities to authenticate */
|
||||
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data);
|
||||
|
||||
/* Calculate the required login details for SASL authentication */
|
||||
/* Calculate the required login details for SASL authentication */
|
||||
CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
|
||||
bool force_ir, saslprogress *progress);
|
||||
|
||||
/* Continue an SASL authentication */
|
||||
/* Continue an SASL authentication */
|
||||
CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
|
||||
int code, saslprogress *progress);
|
||||
|
||||
|
||||
@ -194,7 +194,6 @@ timediff_t curlx_ptimediff_ms(const struct curltime *newer,
|
||||
return (diff * 1000) + ((newer->tv_usec - older->tv_usec) / 1000);
|
||||
}
|
||||
|
||||
|
||||
timediff_t curlx_timediff_ms(struct curltime newer, struct curltime older)
|
||||
{
|
||||
return curlx_ptimediff_ms(&newer, &older);
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||
* allocated string or NULL if an error occurred. */
|
||||
* allocated string or NULL if an error occurred. */
|
||||
|
||||
enum urlreject {
|
||||
REJECT_NADA = 2,
|
||||
|
||||
@ -67,8 +67,8 @@ static struct addrinfo *mk_getaddrinfo(const struct ares_addrinfo *aihead)
|
||||
for(ai = aihead->nodes; ai != NULL; ai = ai->ai_next) {
|
||||
size_t ss_size;
|
||||
size_t namelen = name ? strlen(name) + 1 : 0;
|
||||
/* ignore elements with unsupported address family, */
|
||||
/* settle family-specific sockaddr structure size. */
|
||||
/* ignore elements with unsupported address family,
|
||||
settle family-specific sockaddr structure size. */
|
||||
if(ai->ai_family == AF_INET)
|
||||
ss_size = sizeof(struct sockaddr_in);
|
||||
else if(ai->ai_family == AF_INET6)
|
||||
@ -90,8 +90,8 @@ static struct addrinfo *mk_getaddrinfo(const struct ares_addrinfo *aihead)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* copy each structure member individually, member ordering, */
|
||||
/* size, or padding might be different for each platform. */
|
||||
/* copy each structure member individually, member ordering,
|
||||
size, or padding might be different for each platform. */
|
||||
|
||||
ca->ai_flags = ai->ai_flags;
|
||||
ca->ai_family = ai->ai_family;
|
||||
|
||||
@ -637,7 +637,7 @@ static CURLcode getftpresponse(struct Curl_easy *data,
|
||||
* the OpenSSL read() does not grok that properly.
|
||||
*
|
||||
* Alas, read as much as possible, split up into lines, use the ending
|
||||
* line in a response or continue reading. */
|
||||
* line in a response or continue reading. */
|
||||
|
||||
struct connectdata *conn = data->conn;
|
||||
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
|
||||
@ -1801,7 +1801,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
|
||||
}
|
||||
else {
|
||||
/* We got a file size report, so we check that there actually is a
|
||||
part of the file left to get, or else we go home. */
|
||||
part of the file left to get, or else we go home. */
|
||||
if(data->state.resume_from < 0) {
|
||||
/* We are supposed to download the last abs(from) bytes */
|
||||
if(filesize < -data->state.resume_from) {
|
||||
|
||||
18
lib/http.c
18
lib/http.c
@ -684,11 +684,12 @@ static CURLcode output_auth_headers(struct Curl_easy *data,
|
||||
/* Basic */
|
||||
if(
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
(proxy && conn->bits.proxy_user_passwd &&
|
||||
!Curl_checkProxyheaders(data, conn, STRCONST("Proxy-authorization"))) ||
|
||||
(proxy && conn->bits.proxy_user_passwd &&
|
||||
!Curl_checkProxyheaders(data, conn,
|
||||
STRCONST("Proxy-authorization"))) ||
|
||||
#endif
|
||||
(!proxy && data->state.aptr.user &&
|
||||
!Curl_checkheaders(data, STRCONST("Authorization")))) {
|
||||
(!proxy && data->state.aptr.user &&
|
||||
!Curl_checkheaders(data, STRCONST("Authorization")))) {
|
||||
auth = "Basic";
|
||||
result = http_output_basic(data, proxy);
|
||||
if(result)
|
||||
@ -703,8 +704,8 @@ static CURLcode output_auth_headers(struct Curl_easy *data,
|
||||
#ifndef CURL_DISABLE_BEARER_AUTH
|
||||
if(authstatus->picked == CURLAUTH_BEARER) {
|
||||
/* Bearer */
|
||||
if((!proxy && data->set.str[STRING_BEARER] &&
|
||||
!Curl_checkheaders(data, STRCONST("Authorization")))) {
|
||||
if(!proxy && data->set.str[STRING_BEARER] &&
|
||||
!Curl_checkheaders(data, STRCONST("Authorization"))) {
|
||||
auth = "Bearer";
|
||||
result = http_output_bearer(data);
|
||||
if(result)
|
||||
@ -2625,7 +2626,6 @@ static CURLcode http_range(struct Curl_easy *data,
|
||||
data->state.aptr.rangeline =
|
||||
curl_maprintf("Content-Range: bytes 0-%" FMT_OFF_T "/"
|
||||
"%" FMT_OFF_T "\r\n", req_clen - 1, req_clen);
|
||||
|
||||
}
|
||||
else if(data->state.resume_from) {
|
||||
/* This is because "resume" was selected */
|
||||
@ -3776,7 +3776,7 @@ static CURLcode http_statusline(struct Curl_easy *data,
|
||||
/* (quote from RFC2616, section 10.3.5): The 304 response
|
||||
* MUST NOT contain a message-body, and thus is always
|
||||
* terminated by the first empty line after the header
|
||||
* fields. */
|
||||
* fields. */
|
||||
if(data->set.timecondition)
|
||||
data->info.timecond = TRUE;
|
||||
FALLTHROUGH();
|
||||
@ -4345,7 +4345,7 @@ void Curl_http_to_fold(struct dynbuf *bf)
|
||||
len--;
|
||||
if(len && (hd[len - 1] == '\r'))
|
||||
len--;
|
||||
while(len && (ISBLANK(hd[len - 1]))) /* strip off trailing whitespace */
|
||||
while(len && ISBLANK(hd[len - 1])) /* strip off trailing whitespace */
|
||||
len--;
|
||||
curlx_dyn_setlen(bf, len);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
#define H2_NW_RECV_CHUNKS (H2_CONN_WINDOW_SIZE / H2_CHUNK_SIZE)
|
||||
/* on send into TLS, we just want to accumulate small frames */
|
||||
#define H2_NW_SEND_CHUNKS 1
|
||||
/* this is how much we want "in flight" for a stream, unthrottled */
|
||||
/* this is how much we want "in flight" for a stream, unthrottled */
|
||||
#define H2_STREAM_WINDOW_SIZE_MAX (10 * 1024 * 1024)
|
||||
/* this is how much we want "in flight" for a stream, initially, IFF
|
||||
* nghttp2 allows us to tweak the local window size. */
|
||||
@ -888,7 +888,6 @@ static void h2_xfer_write_resp_hd(struct Curl_cfilter *cf,
|
||||
struct h2_stream_ctx *stream,
|
||||
const char *buf, size_t blen, bool eos)
|
||||
{
|
||||
|
||||
/* If we already encountered an error, skip further writes */
|
||||
if(!stream->xfer_result) {
|
||||
stream->xfer_result = Curl_xfer_write_resp_hd(data, buf, blen, eos);
|
||||
@ -905,7 +904,6 @@ static void h2_xfer_write_resp(struct Curl_cfilter *cf,
|
||||
struct h2_stream_ctx *stream,
|
||||
const char *buf, size_t blen, bool eos)
|
||||
{
|
||||
|
||||
/* If we already encountered an error, skip further writes */
|
||||
if(!stream->xfer_result)
|
||||
stream->xfer_result = Curl_xfer_write_resp(data, buf, blen, eos);
|
||||
|
||||
@ -645,7 +645,6 @@ fail:
|
||||
|
||||
static int compare_func(const void *a, const void *b)
|
||||
{
|
||||
|
||||
const struct pair *aa = a;
|
||||
const struct pair *bb = b;
|
||||
const size_t aa_key_len = curlx_dyn_len(&aa->key);
|
||||
|
||||
@ -1176,7 +1176,7 @@ static CURLcode imap_state_login_resp(struct Curl_easy *data,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Detect IMAP listings vs. downloading a single email */
|
||||
/* Detect IMAP listings vs. downloading a single email */
|
||||
static bool is_custom_fetch_listing_match(const char *params)
|
||||
{
|
||||
/* match " 1:* (FLAGS ..." or " 1,2,3 (FLAGS ..." */
|
||||
@ -2324,7 +2324,6 @@ static const struct Curl_protocol Curl_protocol_imap = {
|
||||
|
||||
#endif /* CURL_DISABLE_IMAP */
|
||||
|
||||
|
||||
/*
|
||||
* IMAP protocol handler.
|
||||
*/
|
||||
|
||||
@ -32,10 +32,10 @@
|
||||
#define MAX_PARAMETERS 128 /* number of input arguments */
|
||||
#define MAX_SEGMENTS 128 /* number of output segments */
|
||||
|
||||
/* Lower-case digits. */
|
||||
/* Lower-case digits. */
|
||||
const unsigned char Curl_ldigits[] = "0123456789abcdef";
|
||||
|
||||
/* Upper-case digits. */
|
||||
/* Upper-case digits. */
|
||||
const unsigned char Curl_udigits[] = "0123456789ABCDEF";
|
||||
|
||||
#define OUTCHAR(x) \
|
||||
@ -131,9 +131,9 @@ struct asprintf {
|
||||
};
|
||||
|
||||
/* the provided input number is 1-based but this returns the number 0-based.
|
||||
|
||||
returns -1 if no valid number was provided.
|
||||
*/
|
||||
*
|
||||
* returns -1 if no valid number was provided.
|
||||
*/
|
||||
static int dollarstring(const char *p, const char **end)
|
||||
{
|
||||
curl_off_t num;
|
||||
@ -596,8 +596,8 @@ static int parsefmt(const char *format,
|
||||
}
|
||||
|
||||
struct mproperty {
|
||||
int width; /* Width of a field. */
|
||||
int prec; /* Precision of a field. */
|
||||
int width; /* Width of a field. */
|
||||
int prec; /* Precision of a field. */
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
@ -722,7 +722,7 @@ static bool out_number(void *userp,
|
||||
char *w;
|
||||
|
||||
if(flags & FLAGS_CHAR) {
|
||||
/* Character. */
|
||||
/* Character. */
|
||||
if(!(flags & FLAGS_LEFT))
|
||||
while(--width > 0)
|
||||
OUTCHAR(' ');
|
||||
@ -746,11 +746,11 @@ static bool out_number(void *userp,
|
||||
;
|
||||
|
||||
else {
|
||||
/* Decimal integer. */
|
||||
/* Decimal integer. */
|
||||
is_neg = (nums < 0);
|
||||
if(is_neg) {
|
||||
/* signed_num might fail to hold absolute negative minimum by 1 */
|
||||
int64_t signed_num; /* Used to convert negative in positive. */
|
||||
int64_t signed_num; /* Used to convert negative in positive. */
|
||||
signed_num = nums + (int64_t)1;
|
||||
signed_num = -signed_num;
|
||||
num = (uint64_t)signed_num;
|
||||
@ -758,11 +758,11 @@ static bool out_number(void *userp,
|
||||
}
|
||||
}
|
||||
|
||||
/* Supply a default precision if none was given. */
|
||||
/* Supply a default precision if none was given. */
|
||||
if(prec == -1)
|
||||
prec = 1;
|
||||
|
||||
/* Put the number in WORK. */
|
||||
/* Put the number in WORK. */
|
||||
w = workend;
|
||||
DEBUGASSERT(base <= 16);
|
||||
switch(base) {
|
||||
@ -822,7 +822,7 @@ static bool out_number(void *userp,
|
||||
while(width-- > 0)
|
||||
OUTCHAR('0');
|
||||
|
||||
/* Write the number. */
|
||||
/* Write the number. */
|
||||
while(++w <= workend) {
|
||||
OUTCHAR(*w);
|
||||
}
|
||||
@ -848,7 +848,7 @@ static bool out_string(void *userp,
|
||||
size_t len;
|
||||
|
||||
if(!str) {
|
||||
/* Write null string if there is space. */
|
||||
/* Write null string if there is space. */
|
||||
if(prec == -1 || prec >= (int)sizeof(nilstr) - 1) {
|
||||
str = nilstr;
|
||||
len = sizeof(nilstr) - 1;
|
||||
@ -895,17 +895,17 @@ static bool out_pointer(void *userp,
|
||||
char *work,
|
||||
int *donep)
|
||||
{
|
||||
/* Generic pointer. */
|
||||
/* Generic pointer. */
|
||||
if(ptr) {
|
||||
size_t num = (size_t)ptr;
|
||||
|
||||
/* If the pointer is not NULL, write it as a %#x spec. */
|
||||
/* If the pointer is not NULL, write it as a %#x spec. */
|
||||
p->flags |= FLAGS_HEX | FLAGS_ALT;
|
||||
if(out_number(userp, stream, p, num, 0, work, donep))
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
/* Write "(nil)" for a nil pointer. */
|
||||
/* Write "(nil)" for a nil pointer. */
|
||||
const char *point;
|
||||
int width = p->width;
|
||||
int flags = p->flags;
|
||||
@ -946,7 +946,7 @@ static int formatf(void *userp, /* untouched by format(), just sent to the
|
||||
const char *format, /* %-formatted string */
|
||||
va_list ap_save) /* list of parameters */
|
||||
{
|
||||
int done = 0; /* number of characters written */
|
||||
int done = 0; /* number of characters written */
|
||||
int i;
|
||||
int ocount = 0; /* number of output segments */
|
||||
int icount = 0; /* number of input arguments */
|
||||
@ -1042,7 +1042,7 @@ static int formatf(void *userp, /* untouched by format(), just sent to the
|
||||
break;
|
||||
|
||||
case MTYPE_INTPTR:
|
||||
/* Answer the count of characters written. */
|
||||
/* Answer the count of characters written. */
|
||||
if(p.flags & FLAGS_LONGLONG)
|
||||
*(int64_t *)iptr->val.ptr = (int64_t)done;
|
||||
else
|
||||
|
||||
@ -962,7 +962,6 @@ static CURLcode mqtts_connecting(struct Curl_easy *data, bool *done)
|
||||
/*
|
||||
* MQTTS protocol.
|
||||
*/
|
||||
|
||||
static const struct Curl_protocol Curl_protocol_mqtts = {
|
||||
mqtt_setup_conn, /* setup_connection */
|
||||
mqtt_do, /* do_it */
|
||||
@ -988,7 +987,6 @@ static const struct Curl_protocol Curl_protocol_mqtts = {
|
||||
/*
|
||||
* MQTT protocol.
|
||||
*/
|
||||
|
||||
static const struct Curl_protocol Curl_protocol_mqtt = {
|
||||
mqtt_setup_conn, /* setup_connection */
|
||||
mqtt_do, /* do_it */
|
||||
@ -1011,7 +1009,6 @@ static const struct Curl_protocol Curl_protocol_mqtt = {
|
||||
|
||||
#endif /* CURL_DISABLE_MQTT */
|
||||
|
||||
|
||||
const struct Curl_scheme Curl_scheme_mqtts = {
|
||||
"mqtts", /* scheme */
|
||||
#if defined(CURL_DISABLE_MQTT) || !defined(USE_SSL)
|
||||
@ -1028,7 +1025,6 @@ const struct Curl_scheme Curl_scheme_mqtts = {
|
||||
/*
|
||||
* MQTT protocol.
|
||||
*/
|
||||
|
||||
const struct Curl_scheme Curl_scheme_mqtt = {
|
||||
"mqtt", /* scheme */
|
||||
#ifdef CURL_DISABLE_MQTT
|
||||
|
||||
@ -151,7 +151,7 @@ static NETRCcode parsenetrc(struct store_netrc *store,
|
||||
}
|
||||
|
||||
if(!*tok || (*tok == '\n'))
|
||||
/* end of line */
|
||||
/* end of line */
|
||||
break;
|
||||
|
||||
/* leading double-quote means quoted string */
|
||||
|
||||
@ -114,7 +114,6 @@ struct ldapreqinfo {
|
||||
/* meta key for storing ldapconninfo at connection */
|
||||
#define CURL_META_LDAP_CONN "meta:proto:ldap:conn"
|
||||
|
||||
|
||||
/*
|
||||
* oldap_state()
|
||||
*
|
||||
|
||||
@ -169,14 +169,11 @@ CURLcode Curl_pollset_set(struct Curl_easy *data,
|
||||
#define Curl_pollset_remove_out(data, ps, sock) \
|
||||
Curl_pollset_change(data, ps, sock, 0, CURL_POLL_OUT)
|
||||
#define Curl_pollset_add_inout(data, ps, sock) \
|
||||
Curl_pollset_change(data, ps, sock, \
|
||||
CURL_POLL_IN | CURL_POLL_OUT, 0)
|
||||
Curl_pollset_change(data, ps, sock, CURL_POLL_IN | CURL_POLL_OUT, 0)
|
||||
#define Curl_pollset_set_in_only(data, ps, sock) \
|
||||
Curl_pollset_change(data, ps, sock, \
|
||||
CURL_POLL_IN, CURL_POLL_OUT)
|
||||
Curl_pollset_change(data, ps, sock, CURL_POLL_IN, CURL_POLL_OUT)
|
||||
#define Curl_pollset_set_out_only(data, ps, sock) \
|
||||
Curl_pollset_change(data, ps, sock, \
|
||||
CURL_POLL_OUT, CURL_POLL_IN)
|
||||
Curl_pollset_change(data, ps, sock, CURL_POLL_OUT, CURL_POLL_IN)
|
||||
|
||||
/* return < = on error, 0 on timeout or how many sockets are ready */
|
||||
int Curl_pollset_poll(struct Curl_easy *data,
|
||||
|
||||
@ -55,7 +55,7 @@ struct Curl_cwriter;
|
||||
struct Curl_easy;
|
||||
|
||||
/**
|
||||
* Write `len` bytes at `prt` to the client. `type` indicates what
|
||||
* Write `len` bytes at `buf` to the client. `type` indicates what
|
||||
* kind of data is being written.
|
||||
*/
|
||||
CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf,
|
||||
|
||||
@ -24,11 +24,10 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* */
|
||||
/* JEM, 12/30/12, VMS now generates config.h, so only define wrappers for */
|
||||
/* getenv(), getpwuid() and provide is_vms_shell() */
|
||||
/* Also need upper case symbols for system services, and */
|
||||
/* OpenSSL, and some Kerberos image */
|
||||
/* JEM, 2012-12-30, VMS now generates config.h, so only define wrappers for */
|
||||
/* getenv(), getpwuid() and provide is_vms_shell() */
|
||||
/* Also need upper case symbols for system services, and */
|
||||
/* OpenSSL, and some Kerberos image */
|
||||
|
||||
#ifdef __DECC
|
||||
#pragma message save
|
||||
|
||||
@ -232,8 +232,8 @@ static void my_sha256_final(unsigned char *digest, void *in)
|
||||
(a)[3] = (unsigned char) (((unsigned long)(val)) & 0xff); \
|
||||
} while(0)
|
||||
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
do { \
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
do { \
|
||||
(a)[0] = (unsigned char)(((uint64_t)(val)) >> 56); \
|
||||
(a)[1] = (unsigned char)(((uint64_t)(val)) >> 48); \
|
||||
(a)[2] = (unsigned char)(((uint64_t)(val)) >> 40); \
|
||||
|
||||
@ -1249,7 +1249,7 @@ const struct Curl_scheme Curl_scheme_smb = {
|
||||
*/
|
||||
const struct Curl_scheme Curl_scheme_smbs = {
|
||||
"smbs", /* scheme */
|
||||
#if defined(CURL_DISABLE_SMB) || !defined(USE_CURL_NTLM_CORE) || \
|
||||
#if defined(CURL_DISABLE_SMB) || !defined(USE_CURL_NTLM_CORE) || \
|
||||
!defined(USE_SSL)
|
||||
ZERO_NULL,
|
||||
#else
|
||||
|
||||
@ -1061,9 +1061,9 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data,
|
||||
"MAIL FROM:%s%s%s%s%s%s",
|
||||
from, /* Mandatory */
|
||||
auth ? " AUTH=" : "", /* Optional on AUTH support */
|
||||
auth ? auth : "", /* */
|
||||
auth ? auth : "",
|
||||
size ? " SIZE=" : "", /* Optional on SIZE support */
|
||||
size ? size : "", /* */
|
||||
size ? size : "",
|
||||
utf8 ? " SMTPUTF8" /* Internationalised mailbox */
|
||||
: ""); /* included in our envelope */
|
||||
|
||||
|
||||
@ -1339,7 +1339,6 @@ static CURLcode socks_cf_adjust_pollset(struct Curl_cfilter *cf,
|
||||
static void socks_proxy_cf_close(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data)
|
||||
{
|
||||
|
||||
DEBUGASSERT(cf->next);
|
||||
cf->connected = FALSE;
|
||||
socks_proxy_cf_free(cf);
|
||||
|
||||
@ -281,7 +281,7 @@ static CURLcode socks5_sspi_encrypt(struct Curl_cfilter *cf,
|
||||
|
||||
infof(data, "SOCKS5 server supports GSS-API %s data protection.",
|
||||
(gss_enc == 0) ? "no" :
|
||||
((gss_enc == 1) ? "integrity" : "confidentiality") );
|
||||
((gss_enc == 1) ? "integrity" : "confidentiality"));
|
||||
|
||||
sspi_w_token[0].pvBuffer =
|
||||
sspi_w_token[1].pvBuffer =
|
||||
|
||||
@ -45,7 +45,7 @@ CURLcode Curl_win32_init(long flags)
|
||||
|
||||
if(res)
|
||||
/* Tell the user that we could not find a usable */
|
||||
/* winsock.dll. */
|
||||
/* winsock.dll. */
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* Confirm that the Windows Sockets DLL supports what we need.*/
|
||||
|
||||
@ -1844,7 +1844,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
||||
|
||||
#ifdef USE_IPV6
|
||||
if(data->set.scope_id)
|
||||
/* Override any scope that was set above. */
|
||||
/* Override any scope that was set above. */
|
||||
conn->scope_id = data->set.scope_id;
|
||||
#endif
|
||||
|
||||
@ -2538,7 +2538,6 @@ error:
|
||||
static CURLcode parse_remote_port(struct Curl_easy *data,
|
||||
struct connectdata *conn)
|
||||
{
|
||||
|
||||
if(data->set.use_port && data->state.allow_port) {
|
||||
/* if set, we use this instead of the port possibly given in the URL */
|
||||
char portbuf[16];
|
||||
|
||||
@ -217,7 +217,7 @@ typedef CURLcode (Curl_recv)(struct Curl_easy *data, /* transfer */
|
||||
* us early warning on things only discovered by valgrind otherwise. */
|
||||
#define GOOD_EASY_HANDLE(x) \
|
||||
(((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER)) ? TRUE : \
|
||||
(DEBUGASSERT(!(x)), FALSE))
|
||||
(DEBUGASSERT(!(x)), FALSE))
|
||||
#else
|
||||
#define GOOD_EASY_HANDLE(x) \
|
||||
((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))
|
||||
@ -1303,7 +1303,7 @@ struct UserDefined {
|
||||
curl_write_callback fwrite_header; /* function that stores headers */
|
||||
curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */
|
||||
curl_read_callback fread_func_set; /* function that reads the input */
|
||||
curl_progress_callback fprogress; /* OLD and deprecated progress callback */
|
||||
curl_progress_callback fprogress; /* OLD and deprecated progress callback */
|
||||
curl_xferinfo_callback fxferinfo; /* progress callback */
|
||||
curl_debug_callback fdebug; /* function that write informational data */
|
||||
curl_ioctl_callback ioctl_func; /* function for I/O control */
|
||||
@ -1373,7 +1373,7 @@ struct UserDefined {
|
||||
curl_off_t max_filesize; /* Maximum file size to download */
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
timediff_t accepttimeout; /* in milliseconds, 0 means no timeout */
|
||||
uint8_t ftp_filemethod; /* how to get to a file: curl_ftpfile */
|
||||
uint8_t ftp_filemethod; /* how to get to a file: curl_ftpfile */
|
||||
uint8_t ftpsslauth; /* what AUTH XXX to try: curl_ftpauth */
|
||||
uint8_t ftp_ccc; /* FTP CCC options: curl_ftpccc */
|
||||
#endif
|
||||
@ -1443,7 +1443,7 @@ struct UserDefined {
|
||||
#endif
|
||||
uint32_t maxconnects; /* Max idle connections in the connection cache */
|
||||
#ifdef USE_ECH
|
||||
int tls_ech; /* TLS ECH configuration */
|
||||
int tls_ech; /* TLS ECH configuration */
|
||||
#endif
|
||||
short maxredirs; /* maximum no. of http(s) redirects to follow,
|
||||
set to -1 for infinity */
|
||||
@ -1460,7 +1460,7 @@ struct UserDefined {
|
||||
uint16_t tftp_blksize; /* in bytes, 0 means use default */
|
||||
#endif
|
||||
#ifndef CURL_DISABLE_NETRC
|
||||
uint8_t use_netrc; /* enum CURL_NETRC_OPTION values */
|
||||
uint8_t use_netrc; /* enum CURL_NETRC_OPTION values */
|
||||
#endif
|
||||
#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH)
|
||||
/* Despite the name, ftp_create_missing_dirs is for FTP(S) and SFTP
|
||||
@ -1543,7 +1543,7 @@ struct UserDefined {
|
||||
BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
|
||||
BIT(verbose); /* output verbosity */
|
||||
BIT(reuse_forbid); /* forbidden to be reused, close after use */
|
||||
BIT(reuse_fresh); /* do not reuse an existing connection */
|
||||
BIT(reuse_fresh); /* do not reuse an existing connection */
|
||||
BIT(no_signal); /* do not use any signal/alarm handler */
|
||||
BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */
|
||||
BIT(ignorecl); /* ignore content length */
|
||||
|
||||
@ -1227,7 +1227,7 @@ static int myssh_in_SFTP_CLOSE(struct Curl_easy *data,
|
||||
|
||||
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
|
||||
After nextstate is executed, the control should come back to
|
||||
SSH_SFTP_CLOSE to pass the correct result back */
|
||||
SSH_SFTP_CLOSE to pass the correct result back */
|
||||
if(sshc->nextstate != SSH_NO_STATE &&
|
||||
sshc->nextstate != SSH_SFTP_CLOSE) {
|
||||
myssh_to(data, sshc, sshc->nextstate);
|
||||
|
||||
@ -2297,7 +2297,7 @@ static CURLcode ssh_state_sftp_close(struct Curl_easy *data,
|
||||
|
||||
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
|
||||
After nextstate is executed, the control should come back to
|
||||
SSH_SFTP_CLOSE to pass the correct result back */
|
||||
SSH_SFTP_CLOSE to pass the correct result back */
|
||||
if(sshc->nextstate != SSH_NO_STATE &&
|
||||
sshc->nextstate != SSH_SFTP_CLOSE) {
|
||||
myssh_to(data, sshc, sshc->nextstate);
|
||||
|
||||
@ -5384,7 +5384,7 @@ static CURLcode ossl_random(struct Curl_easy *data,
|
||||
if(!rand_enough())
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
/* RAND_bytes() returns 1 on success, 0 otherwise. */
|
||||
/* RAND_bytes() returns 1 on success, 0 otherwise. */
|
||||
rc = RAND_bytes(entropy, (ossl_valsize_t)curlx_uztosi(length));
|
||||
return rc == 1 ? CURLE_OK : CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
@ -416,7 +416,7 @@ static CURLcode get_client_cert(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
if(fInCert || blob) {
|
||||
/* Reading a .P12 or .pfx file, like the example at bottom of
|
||||
/* Reading a .p12 or .pfx file, like the example at bottom of
|
||||
https://learn.microsoft.com/archive/msdn-technet-forums/3e7bc95f-b21a-4bcd-bd2c-7f996718cae5
|
||||
*/
|
||||
CRYPT_DATA_BLOB datablob;
|
||||
@ -2030,8 +2030,8 @@ static CURLcode schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
timediff_t timeout_ms = Curl_timeleft_ms(data);
|
||||
if(timeout_ms < 0) {
|
||||
/* we already got the timeout */
|
||||
failf(data, "schannel: timed out sending data "
|
||||
"(bytes sent: %zu)", *pnwritten);
|
||||
failf(data, "schannel: timed out sending data (bytes sent: %zu)",
|
||||
*pnwritten);
|
||||
result = CURLE_OPERATION_TIMEDOUT;
|
||||
break;
|
||||
}
|
||||
@ -2045,8 +2045,8 @@ static CURLcode schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
break;
|
||||
}
|
||||
else if(what == 0) {
|
||||
failf(data, "schannel: timed out sending data "
|
||||
"(bytes sent: %zu)", *pnwritten);
|
||||
failf(data, "schannel: timed out sending data (bytes sent: %zu)",
|
||||
*pnwritten);
|
||||
result = CURLE_OPERATION_TIMEDOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -38,20 +38,20 @@
|
||||
#include "vtls/schannel.h"
|
||||
#include "vtls/schannel_int.h"
|
||||
|
||||
#include "curlx/fopen.h"
|
||||
#include "curlx/inet_pton.h"
|
||||
#include "vtls/hostcheck.h"
|
||||
#include "vtls/vtls.h"
|
||||
#include "vtls/vtls_int.h"
|
||||
#include "curl_trc.h"
|
||||
#include "strerror.h"
|
||||
#include "curlx/winapi.h"
|
||||
#include "curlx/fopen.h"
|
||||
#include "curlx/inet_pton.h"
|
||||
#include "curlx/multibyte.h"
|
||||
#include "vtls/hostcheck.h"
|
||||
#include "curlx/version_win32.h"
|
||||
#include "curlx/winapi.h"
|
||||
|
||||
#define BACKEND ((struct schannel_ssl_backend_data *)connssl->backend)
|
||||
|
||||
#define MAX_CAFILE_SIZE 1048576 /* 1 MiB */
|
||||
#define MAX_CAFILE_SIZE (1024 * 1024) /* 1 MiB */
|
||||
#define BEGIN_CERT "-----BEGIN CERTIFICATE-----"
|
||||
#define END_CERT "\n-----END CERTIFICATE-----"
|
||||
|
||||
@ -438,10 +438,8 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
|
||||
|
||||
static bool get_num_host_info(struct num_ip_data *ip_blob, LPCSTR hostname)
|
||||
{
|
||||
struct in_addr ia;
|
||||
struct in6_addr ia6;
|
||||
bool result = FALSE;
|
||||
|
||||
struct in_addr ia;
|
||||
int res = curlx_inet_pton(AF_INET, hostname, &ia);
|
||||
if(res) {
|
||||
ip_blob->size = sizeof(struct in_addr);
|
||||
@ -449,6 +447,7 @@ static bool get_num_host_info(struct num_ip_data *ip_blob, LPCSTR hostname)
|
||||
result = TRUE;
|
||||
}
|
||||
else {
|
||||
struct in6_addr ia6;
|
||||
res = curlx_inet_pton(AF_INET6, hostname, &ia6);
|
||||
if(res) {
|
||||
ip_blob->size = sizeof(struct in6_addr);
|
||||
|
||||
@ -97,7 +97,7 @@ struct ssl_peer {
|
||||
CURLsslset Curl_init_sslset_nolock(curl_sslbackend id, const char *name,
|
||||
const curl_ssl_backend ***avail);
|
||||
|
||||
#define MAX_PINNED_PUBKEY_SIZE 1048576 /* 1 MiB */
|
||||
#define MAX_PINNED_PUBKEY_SIZE (1024 * 1024) /* 1 MiB */
|
||||
|
||||
curl_sslbackend Curl_ssl_backend(void);
|
||||
|
||||
|
||||
@ -1424,7 +1424,6 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
|
||||
result = CURLE_SSL_CONNECT_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* HAVE_WOLFSSL_CTX_GENERATEECHCONFIG */
|
||||
|
||||
|
||||
@ -37,20 +37,6 @@
|
||||
|
||||
#include "curlmsg.h"
|
||||
|
||||
/*
|
||||
#define FAC_CURL 0xC01
|
||||
#define FAC_SYSTEM 0
|
||||
#define MSG_NORMAL 0
|
||||
*/
|
||||
|
||||
/*
|
||||
#define SEV_WARNING 0
|
||||
#define SEV_SUCCESS 1
|
||||
#define SEV_ERROR 2
|
||||
#define SEV_INFO 3
|
||||
#define SEV_FATAL 4
|
||||
*/
|
||||
|
||||
static const long vms_cond[] =
|
||||
{
|
||||
CURL_OK,
|
||||
|
||||
@ -1230,7 +1230,6 @@ sub scanfile {
|
||||
checksrc_endoffile($file);
|
||||
|
||||
close($R);
|
||||
|
||||
}
|
||||
|
||||
if($errors || $warnings || $verbose) {
|
||||
|
||||
@ -529,7 +529,6 @@ sub render {
|
||||
my $qstr = $quote ? "q" : "";
|
||||
push @desc, "[".(1 + $level)."$qstr]$d" if(!$manpage);
|
||||
$header = 0;
|
||||
|
||||
}
|
||||
if($finalblank) {
|
||||
print STDERR "$f:$line:1:ERROR: trailing blank line\n";
|
||||
|
||||
@ -180,6 +180,26 @@ while(my $filename = <$git_ls_files>) {
|
||||
$linepos += $line;
|
||||
}
|
||||
|
||||
$search = $content;
|
||||
$linepos = 0;
|
||||
while($search =~ /\n\n *}\n/) {
|
||||
my $part = substr($search, 0, $+[0] - 1);
|
||||
$search = substr($search, $+[0]);
|
||||
my $line = ($part =~ tr/\n//);
|
||||
push @err, sprintf("line %d: '}' preceded by empty line", $linepos + $line);
|
||||
$linepos += $line + 1;
|
||||
}
|
||||
|
||||
$search = $content;
|
||||
$linepos = 0;
|
||||
while($search =~ /\n\{\n\n/) {
|
||||
my $part = substr($search, 0, $+[0]);
|
||||
$search = substr($search, $+[0]);
|
||||
my $line = ($part =~ tr/\n//);
|
||||
push @err, sprintf("line %d: top-level '{' followed by empty line", $linepos + $line);
|
||||
$linepos += $line;
|
||||
}
|
||||
|
||||
if($content =~ /([\x00-\x08\x0b\x0c\x0e-\x1f\x7f])/) {
|
||||
push @err, "content: has binary contents";
|
||||
}
|
||||
|
||||
@ -111,7 +111,6 @@ for my $l (@output) {
|
||||
$alllines += $len;
|
||||
$allscore += ($len * $score);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $showncutoff;
|
||||
|
||||
@ -185,12 +185,12 @@ static SANITIZEcode msdosify(char ** const sanitized, const char *file_name,
|
||||
and a filename cannot have more than a single dot. We leave the
|
||||
first non-leading dot alone, unless it comes too close to the
|
||||
beginning of the name: we want sh.lex.c to become sh_lex.c, not
|
||||
sh.lex-c. */
|
||||
sh.lex-c. */
|
||||
else if(*s == '.') {
|
||||
if((flags & SANITIZE_ALLOW_PATH) && idx == 0 &&
|
||||
(s[1] == '/' || s[1] == '\\' ||
|
||||
(s[1] == '.' && (s[2] == '/' || s[2] == '\\')))) {
|
||||
/* Copy "./" and "../" verbatim. */
|
||||
/* Copy "./" and "../" verbatim. */
|
||||
*d++ = *s++;
|
||||
if(d == dlimit)
|
||||
break;
|
||||
@ -225,7 +225,7 @@ static SANITIZEcode msdosify(char ** const sanitized, const char *file_name,
|
||||
*d = 'x';
|
||||
}
|
||||
else {
|
||||
/* libg++ etc. */
|
||||
/* libg++ etc. */
|
||||
if(dlimit - d < 4) {
|
||||
*d++ = 'x';
|
||||
if(d == dlimit)
|
||||
@ -326,7 +326,7 @@ static SANITIZEcode rename_if_reserved_dos(char ** const sanitized,
|
||||
Examples: CON => _CON, CON.EXT => CON_EXT, CON:ADS => CON_ADS
|
||||
https://web.archive.org/web/20160314141551/support.microsoft.com/en-us/kb/74496
|
||||
https://learn.microsoft.com/windows/win32/fileio/naming-a-file
|
||||
*/
|
||||
*/
|
||||
for(p = buffer; p; p = (p == buffer && buffer != base ? base : NULL)) {
|
||||
size_t p_len;
|
||||
int x = (curl_strnequal(p, "CON", 3) ||
|
||||
|
||||
@ -456,7 +456,7 @@ UNITTEST ParameterError parse_cert_parameter(const char *cert_parameter,
|
||||
#ifdef _WIN32
|
||||
if((param_place == &cert_parameter[1]) &&
|
||||
(cert_parameter[2] == '\\' || cert_parameter[2] == '/') &&
|
||||
(ISALPHA(cert_parameter[0]))) {
|
||||
ISALPHA(cert_parameter[0])) {
|
||||
/* colon in the second column, followed by a backslash, and the
|
||||
first character is an alphabetic letter:
|
||||
|
||||
@ -559,7 +559,7 @@ static const struct sizeunit *getunit(char unit)
|
||||
We support P, T, G, M and K (case insensitive) suffixes.
|
||||
|
||||
Unit test 1623
|
||||
*/
|
||||
*/
|
||||
UNITTEST ParameterError GetSizeParameter(const char *arg, curl_off_t *out)
|
||||
{
|
||||
const char *unit = arg;
|
||||
@ -1016,7 +1016,7 @@ static ParameterError set_rate(const char *nextarg)
|
||||
/m == per minute
|
||||
/h == per hour (default)
|
||||
/d == per day (24 hours)
|
||||
*/
|
||||
*/
|
||||
ParameterError err = PARAM_OK;
|
||||
const char *p = nextarg;
|
||||
curl_off_t denominator;
|
||||
@ -1256,7 +1256,7 @@ static ParameterError parse_ech(struct OperationConfig *config,
|
||||
warnf("Could not read file \"%s\" "
|
||||
"specified for \"--ech ecl:\" option",
|
||||
nextarg);
|
||||
return PARAM_BAD_USE; /* */
|
||||
return PARAM_BAD_USE;
|
||||
}
|
||||
err = file2string(&tmpcfg, file);
|
||||
if(file != stdin)
|
||||
@ -2791,7 +2791,7 @@ static ParameterError opt_string(struct OperationConfig *config,
|
||||
/* use <eth0> or <192.168.10.10> style addresses. Anything except
|
||||
this will make us try to get the "default" address.
|
||||
NOTE: this is a changed behavior since the released 4.1!
|
||||
*/
|
||||
*/
|
||||
err = getstr(&config->ftpport, nextarg, DENY_BLANK);
|
||||
break;
|
||||
case C_FTP_SSL_CCC_MODE: /* --ftp-ssl-ccc-mode */
|
||||
@ -2809,11 +2809,11 @@ static ParameterError opt_string(struct OperationConfig *config,
|
||||
err = add2list(&config->telnet_options, nextarg);
|
||||
break;
|
||||
case C_USER: /* --user */
|
||||
/* user:password */
|
||||
/* user:password */
|
||||
err = getstr(&config->userpwd, nextarg, ALLOW_BLANK);
|
||||
break;
|
||||
case C_PROXY_USER: /* --proxy-user */
|
||||
/* Proxy user:password */
|
||||
/* Proxy user:password */
|
||||
err = getstr(&config->proxyuserpwd, nextarg, ALLOW_BLANK);
|
||||
break;
|
||||
case C_WRITE_OUT: /* --write-out */
|
||||
|
||||
@ -209,7 +209,8 @@ ParameterError parseconfig(const char *filename, int max_recursive,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONFIG
|
||||
curl_mfprintf(tool_stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
|
||||
curl_mfprintf(tool_stderr, "PARAM: \"%s\"\n",
|
||||
(param ? param : "(null)"));
|
||||
#endif
|
||||
res = getparameter(option, param, &usedarg, config, max_recursive);
|
||||
config = global->last;
|
||||
|
||||
@ -93,7 +93,7 @@ static CURLcode glob_set(struct URLGlob *glob, const char **patternp,
|
||||
{
|
||||
/* processes a set expression with the point behind the opening '{'
|
||||
','-separated elements are collected until the next closing '}'
|
||||
*/
|
||||
*/
|
||||
struct URLPattern *pat;
|
||||
bool done = FALSE;
|
||||
const char *pattern = *patternp;
|
||||
@ -217,7 +217,7 @@ static CURLcode glob_range(struct URLGlob *glob, const char **patternp,
|
||||
- num range: e.g. "0-9]", "17-2000]"
|
||||
- num range with leading zeros: e.g. "001-999]"
|
||||
expression is checked for well-formedness and collected until the next ']'
|
||||
*/
|
||||
*/
|
||||
struct URLPattern *pat;
|
||||
const char *pattern = *patternp;
|
||||
const char *c;
|
||||
@ -460,7 +460,7 @@ static CURLcode glob_parse(struct URLGlob *glob, const char *pattern,
|
||||
curlx_dyn_reset(&glob->buf);
|
||||
}
|
||||
else {
|
||||
if(!*pattern) /* done */
|
||||
if(!*pattern) /* done */
|
||||
break;
|
||||
else if(*pattern == '{') {
|
||||
/* process set pattern */
|
||||
|
||||
@ -97,7 +97,7 @@ void vms_special_exit(int code, int vms_show)
|
||||
#endif
|
||||
|
||||
if(code > CURL_LAST) { /* If CURL_LAST exceeded then */
|
||||
vms_code = CURL_LAST; /* curlmsg.h is out of sync. */
|
||||
vms_code = CURL_LAST; /* curlmsg.h is out of sync. */
|
||||
}
|
||||
else {
|
||||
vms_code = vms_cond[code] | vms_show;
|
||||
|
||||
@ -322,7 +322,7 @@ static CURLcode empty_multi_test(void)
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
/* calling curl_multi_waitfds() on an empty multi handle. */
|
||||
/* calling curl_multi_waitfds() on an empty multi handle. */
|
||||
mresult = curl_multi_waitfds(multi, ufds, 10, &fd_count);
|
||||
|
||||
if(mresult != CURLM_OK) {
|
||||
|
||||
@ -330,15 +330,15 @@ static bool bad_long(CURLcode res, int check)
|
||||
static bool bad_neg(int check)
|
||||
{
|
||||
switch(check) {
|
||||
case CURLOPT_DNS_CACHE_TIMEOUT:
|
||||
case CURLOPT_INFILESIZE:
|
||||
case CURLOPT_INFILESIZE_LARGE:
|
||||
case CURLOPT_MAXREDIRS:
|
||||
case CURLOPT_POSTFIELDSIZE:
|
||||
case CURLOPT_POSTFIELDSIZE_LARGE:
|
||||
case CURLOPT_RESUME_FROM:
|
||||
case CURLOPT_RESUME_FROM_LARGE:
|
||||
return TRUE;
|
||||
case CURLOPT_DNS_CACHE_TIMEOUT:
|
||||
case CURLOPT_INFILESIZE:
|
||||
case CURLOPT_INFILESIZE_LARGE:
|
||||
case CURLOPT_MAXREDIRS:
|
||||
case CURLOPT_POSTFIELDSIZE:
|
||||
case CURLOPT_POSTFIELDSIZE_LARGE:
|
||||
case CURLOPT_RESUME_FROM:
|
||||
case CURLOPT_RESUME_FROM_LARGE:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ elsif($ARGV[0] eq "postprocess") {
|
||||
}
|
||||
close(IN);
|
||||
|
||||
@canondir = sort {substr($a,57) cmp substr($b,57)} @canondir;
|
||||
@canondir = sort {substr($a, 57) cmp substr($b, 57)} @canondir;
|
||||
my $newfile = $logfile . ".new";
|
||||
open(OUT, ">$newfile") || die "$!";
|
||||
print OUT join('', @canondir);
|
||||
|
||||
@ -154,7 +154,6 @@ sub memanalyze {
|
||||
|
||||
$sizeataddr{$addr}=-1; # set -1 to mark as freed
|
||||
$getmem{$addr}="$source:$linenum";
|
||||
|
||||
}
|
||||
}
|
||||
elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {
|
||||
@ -380,7 +379,6 @@ sub memanalyze {
|
||||
push @res, "FREEADDRINFO ($source:$linenum)\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
push @res, "Not recognized prefix line: $line\n";
|
||||
|
||||
@ -1447,7 +1447,6 @@ sub singletest_check {
|
||||
}
|
||||
|
||||
$ok .= "p";
|
||||
|
||||
}
|
||||
else {
|
||||
$ok .= "-"; # protocol not checked
|
||||
@ -1609,7 +1608,6 @@ sub singletest_check {
|
||||
}
|
||||
|
||||
$ok .= "P";
|
||||
|
||||
}
|
||||
else {
|
||||
$ok .= "-"; # proxy not checked
|
||||
|
||||
@ -519,7 +519,6 @@ static curl_socket_t sockit(curl_socket_t fd)
|
||||
rep = s_config.connectrep;
|
||||
}
|
||||
|
||||
/* */
|
||||
response[SOCKS5_VERSION] = s_config.responseversion;
|
||||
|
||||
/*
|
||||
|
||||
@ -311,7 +311,7 @@ sub serverfortest {
|
||||
push @lprotocols, "dns";
|
||||
|
||||
if(! grep /^\Q$server\E$/, @lprotocols) {
|
||||
if(substr($server,0,5) ne "socks") {
|
||||
if(substr($server, 0, 5) ne "socks") {
|
||||
if($tlsext) {
|
||||
return ("curl lacks $tlsext support", 4);
|
||||
}
|
||||
|
||||
@ -279,7 +279,6 @@ while(<$r>) {
|
||||
push @toolhelp, $combo;
|
||||
$opts{$combo} |= 4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
close($r);
|
||||
|
||||
@ -315,7 +315,7 @@ static CURLcode test_unit1664(const char *arg)
|
||||
/* CURL_OFF_T is typically 9223372036854775807 */
|
||||
static const char *nums[] = {
|
||||
"9223372036854775807", /* 2^63 -1 */
|
||||
"9223372036854775808", /* 2^63 */
|
||||
"9223372036854775808", /* 2^63 */
|
||||
"18446744073709551615", /* 2^64 - 1 */
|
||||
"18446744073709551616", /* 2^64 */
|
||||
"18446744073709551617", /* 2^64 + 1 */
|
||||
@ -429,7 +429,7 @@ static CURLcode test_unit1664(const char *arg)
|
||||
/* CURL_OFF_T is typically 2^63-1 */
|
||||
static const char *nums[] = {
|
||||
"777777777777777777777", /* 2^63 -1 */
|
||||
"1000000000000000000000", /* 2^63 */
|
||||
"1000000000000000000000", /* 2^63 */
|
||||
"111111111111111111111",
|
||||
"222222222222222222222",
|
||||
"333333333333333333333",
|
||||
@ -453,7 +453,7 @@ static CURLcode test_unit1664(const char *arg)
|
||||
/* CURL_OFF_T is typically 2^63-1 */
|
||||
static const char *nums[] = {
|
||||
"7FFFFFFFFFFFFFFF", /* 2^63 -1 */
|
||||
"8000000000000000", /* 2^63 */
|
||||
"8000000000000000", /* 2^63 */
|
||||
"1111111111111111",
|
||||
"2222222222222222",
|
||||
"3333333333333333",
|
||||
|
||||
@ -360,17 +360,17 @@ static CURLcode test_unit2600(const char *arg)
|
||||
/* CNCT HE v4 v6 v4 v6 MIN MAX */
|
||||
{ 1, TURL, "test.com:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 1, 0, 200, TC_TMOT, R_FAIL, NULL },
|
||||
/* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
/* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
{ 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 2, 0, 400, TC_TMOT, R_FAIL, NULL },
|
||||
/* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
/* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
#ifdef USE_IPV6
|
||||
{ 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 0, 1, 200, TC_TMOT, R_FAIL, NULL },
|
||||
/* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
/* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
{ 4, TURL, "test.com:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 0, 2, 400, TC_TMOT, R_FAIL, NULL },
|
||||
/* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
/* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
{ 5, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 1, 1, 350, TC_TMOT, R_FAIL, "v6" },
|
||||
/* mixed ip4+6, v6 always first, v4 kicks in on HE, fails after ~350ms */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user