mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
parent
7a1e99eefa
commit
0476e4fc65
2
.github/scripts/typos.toml
vendored
2
.github/scripts/typos.toml
vendored
@ -9,7 +9,7 @@ extend-ignore-identifiers-re = [
|
||||
"^(ECT0|ECT1|HELO|htpt|PASE)$",
|
||||
"^[A-Za-z0-9_-]*(EDE|GOST)[A-Z0-9_-]*$", # ciphers
|
||||
"^0x[0-9a-fA-F]+FUL$", # unsigned long hex literals ending with 'F'
|
||||
"^(eyeballers|HELO_smtp|optin|passin|perfec|SMTP_HELO)$",
|
||||
"^(eyeballers|HELO_smtp|Januar|optin|passin|perfec|SMTP_HELO)$",
|
||||
"^(clen|req_clen|smtp_perform_helo|smtp_state_helo_resp|Tru64|_stati64)$",
|
||||
"secur32",
|
||||
"proxys", # this should be limited to tests/http/*. Short for secure proxy.
|
||||
|
||||
@ -81,7 +81,7 @@ static const char *urls[] = {
|
||||
};
|
||||
|
||||
#define MAX_PARALLEL 10 /* number of simultaneous transfers */
|
||||
#define NUM_URLS (sizeof(urls) / sizeof(char *))
|
||||
#define NUM_URLS (sizeof(urls) / sizeof(char *))
|
||||
|
||||
static size_t write_cb(char *data, size_t n, size_t l, void *userp)
|
||||
{
|
||||
|
||||
@ -268,7 +268,7 @@ static curl_socket_t opensocket(void *clientp,
|
||||
|
||||
if(ip && filter->type == CONNECTION_FILTER_BLACKLIST) {
|
||||
if(filter->verbose) {
|
||||
char buf[128] = {0};
|
||||
char buf[128] = { 0 };
|
||||
inet_ntop(address->family, cinaddr, buf, sizeof(buf));
|
||||
fprintf(stderr, "* Rejecting IP %s due to blacklist entry %s.\n",
|
||||
buf, ip->str);
|
||||
@ -277,7 +277,7 @@ static curl_socket_t opensocket(void *clientp,
|
||||
}
|
||||
else if(!ip && filter->type == CONNECTION_FILTER_WHITELIST) {
|
||||
if(filter->verbose) {
|
||||
char buf[128] = {0};
|
||||
char buf[128] = { 0 };
|
||||
inet_ntop(address->family, cinaddr, buf, sizeof(buf));
|
||||
fprintf(stderr,
|
||||
"* Rejecting IP %s due to missing whitelist entry.\n", buf);
|
||||
|
||||
@ -83,7 +83,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *pointer)
|
||||
BIO *cbio = BIO_new_mem_buf(mypem, sizeof(mypem));
|
||||
X509_STORE *cts = SSL_CTX_get_cert_store((SSL_CTX *)sslctx);
|
||||
ossl_valsize_t i;
|
||||
STACK_OF(X509_INFO) *inf;
|
||||
STACK_OF(X509_INFO) * inf;
|
||||
|
||||
(void)curl;
|
||||
(void)pointer;
|
||||
|
||||
@ -123,8 +123,8 @@ static CURL *make_handle(const char *url)
|
||||
/* HREF finder implemented in libxml2 but could be any HTML parser */
|
||||
static size_t follow_links(CURLM *multi, struct memory *mem, const char *url)
|
||||
{
|
||||
int opts = HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | \
|
||||
HTML_PARSE_NOWARNING | HTML_PARSE_NONET;
|
||||
int opts = HTML_PARSE_NOBLANKS | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING |
|
||||
HTML_PARSE_NONET;
|
||||
htmlDocPtr doc = htmlReadMemory(mem->buf, (int)mem->size, url, NULL, opts);
|
||||
size_t count;
|
||||
int i;
|
||||
|
||||
@ -244,7 +244,7 @@ static void timer_cb(struct GlobalInfo *g, int revents)
|
||||
}
|
||||
|
||||
rc = curl_multi_socket_action(g->multi,
|
||||
CURL_SOCKET_TIMEOUT, 0, &g->still_running);
|
||||
CURL_SOCKET_TIMEOUT, 0, &g->still_running);
|
||||
mcode_or_die("timer_cb: curl_multi_socket_action", rc);
|
||||
check_multi_info(g);
|
||||
}
|
||||
@ -303,7 +303,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
|
||||
{
|
||||
struct GlobalInfo *g = (struct GlobalInfo *)cbp;
|
||||
struct SockInfo *fdp = (struct SockInfo *)sockp;
|
||||
const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
|
||||
const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" };
|
||||
|
||||
fprintf(MSG_OUT, "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
|
||||
if(what == CURL_POLL_REMOVE) {
|
||||
|
||||
@ -270,7 +270,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
|
||||
{
|
||||
struct GlobalInfo *g = (struct GlobalInfo *)cbp;
|
||||
struct SockInfo *fdp = (struct SockInfo *)sockp;
|
||||
const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
|
||||
const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" };
|
||||
|
||||
printf("%s e %p s %i what %i cbp %p sockp %p\n",
|
||||
__PRETTY_FUNCTION__, e, s, what, cbp, sockp);
|
||||
|
||||
@ -43,17 +43,17 @@
|
||||
#ifdef _WIN32
|
||||
#define close closesocket
|
||||
#else
|
||||
#include <sys/types.h> /* socket types */
|
||||
#include <sys/socket.h> /* socket definitions */
|
||||
#include <sys/types.h> /* socket types */
|
||||
#include <sys/socket.h> /* socket definitions */
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h> /* inet (3) functions */
|
||||
#include <unistd.h> /* misc. Unix functions */
|
||||
#include <arpa/inet.h> /* inet (3) functions */
|
||||
#include <unistd.h> /* misc. Unix functions */
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* The IP address and port number to connect to */
|
||||
#define IPADDR "127.0.0.1"
|
||||
#define IPADDR "127.0.0.1"
|
||||
#define PORTNUM 80
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
|
||||
@ -103,7 +103,7 @@ int main(int argc, char **argv)
|
||||
CURL *curl;
|
||||
|
||||
/* help data */
|
||||
struct callback_data data = {0};
|
||||
struct callback_data data = { 0 };
|
||||
|
||||
/* global initialization */
|
||||
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
@ -42,7 +42,7 @@ static size_t write_response(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
return fwrite(ptr, size, nmemb, writehere);
|
||||
}
|
||||
|
||||
#define FTPBODY "ftp-list"
|
||||
#define FTPBODY "ftp-list"
|
||||
#define FTPHEADERS "ftp-responses"
|
||||
|
||||
int main(void)
|
||||
|
||||
@ -40,8 +40,7 @@ struct FtpFile {
|
||||
FILE *stream;
|
||||
};
|
||||
|
||||
static size_t write_cb(void *buffer, size_t size, size_t nmemb,
|
||||
void *stream)
|
||||
static size_t write_cb(void *buffer, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
struct FtpFile *out = (struct FtpFile *)stream;
|
||||
if(!out->stream) {
|
||||
@ -53,7 +52,6 @@ static size_t write_cb(void *buffer, size_t size, size_t nmemb,
|
||||
return fwrite(buffer, size, nmemb, out->stream);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
|
||||
@ -52,10 +52,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define LOCAL_FILE "/tmp/uploadthis.txt"
|
||||
#define UPLOAD_FILE_AS "while-uploading.txt"
|
||||
#define REMOTE_URL "ftp://example.com/" UPLOAD_FILE_AS
|
||||
#define RENAME_FILE_TO "renamed-and-fine.txt"
|
||||
#define LOCAL_FILE "/tmp/uploadthis.txt"
|
||||
#define UPLOAD_FILE_AS "while-uploading.txt"
|
||||
#define REMOTE_URL "ftp://example.com/" UPLOAD_FILE_AS
|
||||
#define RENAME_FILE_TO "renamed-and-fine.txt"
|
||||
|
||||
/* NOTE: if you want this example to work on Windows with libcurl as a DLL,
|
||||
you MUST also provide a read callback with CURLOPT_READFUNCTION. Failing to
|
||||
|
||||
@ -72,7 +72,6 @@ static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static int upload(CURL *curl, const char *remotepath,
|
||||
const char *localpath, long timeout, long tries)
|
||||
{
|
||||
|
||||
@ -66,9 +66,9 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#define MSG_OUT g_print /* Change to "g_error" to write to stderr */
|
||||
#define SHOW_VERBOSE 0L /* Set to non-zero for libcurl messages */
|
||||
#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */
|
||||
#define MSG_OUT g_print /* Change to "g_error" to write to stderr */
|
||||
#define SHOW_VERBOSE 0L /* Set to non-zero for libcurl messages */
|
||||
#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */
|
||||
|
||||
/* Global information, common to all connections */
|
||||
struct GlobalInfo {
|
||||
@ -261,7 +261,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
|
||||
{
|
||||
struct GlobalInfo *g = (struct GlobalInfo *)cbp;
|
||||
struct SockInfo *fdp = (struct SockInfo *)sockp;
|
||||
static const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
|
||||
static const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" };
|
||||
|
||||
MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
|
||||
if(what == CURL_POLL_REMOVE) {
|
||||
|
||||
@ -274,7 +274,7 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
|
||||
{
|
||||
struct GlobalInfo *g = (struct GlobalInfo *)cbp;
|
||||
struct SockInfo *fdp = (struct SockInfo *)sockp;
|
||||
const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
|
||||
const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" };
|
||||
|
||||
fprintf(MSG_OUT, "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]);
|
||||
if(what == CURL_POLL_REMOVE) {
|
||||
|
||||
@ -93,7 +93,7 @@ int main(void)
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct state st = {0};
|
||||
struct state st = { 0 };
|
||||
|
||||
/* enable HSTS for this handle */
|
||||
curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
|
||||
|
||||
@ -79,8 +79,8 @@ int main(int argc, char **argv)
|
||||
CURL *curl;
|
||||
char curl_errbuf[CURL_ERROR_SIZE];
|
||||
TidyDoc tdoc;
|
||||
TidyBuffer docbuf = {0};
|
||||
TidyBuffer tidy_errbuf = {0};
|
||||
TidyBuffer docbuf = { 0 };
|
||||
TidyBuffer tidy_errbuf = { 0 };
|
||||
CURLcode res;
|
||||
|
||||
if(argc != 2) {
|
||||
|
||||
@ -54,7 +54,6 @@
|
||||
//
|
||||
// libxml callback context structure
|
||||
//
|
||||
|
||||
struct Context {
|
||||
Context() : addTitle(false) {}
|
||||
|
||||
@ -71,7 +70,6 @@ static std::string buffer;
|
||||
//
|
||||
// libcurl write callback function
|
||||
//
|
||||
|
||||
static size_t writer(char *data, size_t size, size_t nmemb,
|
||||
std::string *writerData)
|
||||
{
|
||||
@ -86,7 +84,6 @@ static size_t writer(char *data, size_t size, size_t nmemb,
|
||||
//
|
||||
// libcurl connection initialization
|
||||
//
|
||||
|
||||
static bool init(CURL *&curl, const char *url)
|
||||
{
|
||||
CURLcode res;
|
||||
@ -134,7 +131,6 @@ static bool init(CURL *&curl, const char *url)
|
||||
//
|
||||
// libxml start element callback function
|
||||
//
|
||||
|
||||
static void StartElement(void *voidContext,
|
||||
const xmlChar *name,
|
||||
const xmlChar **attributes)
|
||||
@ -151,7 +147,6 @@ static void StartElement(void *voidContext,
|
||||
//
|
||||
// libxml end element callback function
|
||||
//
|
||||
|
||||
static void EndElement(void *voidContext,
|
||||
const xmlChar *name)
|
||||
{
|
||||
@ -164,7 +159,6 @@ static void EndElement(void *voidContext,
|
||||
//
|
||||
// Text handling helper function
|
||||
//
|
||||
|
||||
static void handleCharacters(Context *context,
|
||||
const xmlChar *chars,
|
||||
int length)
|
||||
@ -177,7 +171,6 @@ static void handleCharacters(Context *context,
|
||||
//
|
||||
// libxml PCDATA callback function
|
||||
//
|
||||
|
||||
static void Characters(void *voidContext,
|
||||
const xmlChar *chars,
|
||||
int length)
|
||||
@ -190,7 +183,6 @@ static void Characters(void *voidContext,
|
||||
//
|
||||
// libxml CDATA callback function
|
||||
//
|
||||
|
||||
static void cdata(void *voidContext,
|
||||
const xmlChar *chars,
|
||||
int length)
|
||||
@ -203,9 +195,7 @@ static void cdata(void *voidContext,
|
||||
//
|
||||
// libxml SAX callback structure
|
||||
//
|
||||
|
||||
static htmlSAXHandler saxHandler =
|
||||
{
|
||||
static htmlSAXHandler saxHandler = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@ -243,7 +233,6 @@ static htmlSAXHandler saxHandler =
|
||||
//
|
||||
// Parse given (assumed to be) HTML text and return the title
|
||||
//
|
||||
|
||||
static void parseHtml(const std::string &html,
|
||||
std::string &title)
|
||||
{
|
||||
|
||||
@ -200,10 +200,10 @@ int main(int argc, char **argv)
|
||||
/* if given a number, do that many transfers */
|
||||
num_transfers = atoi(argv[1]);
|
||||
if((num_transfers < 1) || (num_transfers > 1000))
|
||||
num_transfers = 3; /* a suitable low default */
|
||||
num_transfers = 3; /* a suitable low default */
|
||||
}
|
||||
else
|
||||
num_transfers = 3; /* a suitable low default */
|
||||
num_transfers = 3; /* a suitable low default */
|
||||
|
||||
res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(res)
|
||||
|
||||
@ -136,7 +136,7 @@ static int setup(CURL *curl, const char *url)
|
||||
{
|
||||
out_download = fopen(OUTPUTFILE, "wb");
|
||||
if(!out_download)
|
||||
return 1; /* failed */
|
||||
return 1; /* failed */
|
||||
|
||||
/* set the same URL */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
|
||||
@ -72,8 +72,8 @@ static int my_gettimeofday(struct timeval *tp, void *tzp)
|
||||
{
|
||||
(void)tzp;
|
||||
if(tp) {
|
||||
/* Offset between 1601-01-01 and 1970-01-01 in 100 nanosec units */
|
||||
#define WIN32_FT_OFFSET (116444736000000000)
|
||||
/* Offset between 1601-01-01 and 1970-01-01 in 100 nanosec units */
|
||||
#define WIN32_FT_OFFSET (116444736000000000)
|
||||
union {
|
||||
CURL_TYPEOF_CURL_OFF_T ns100; /* time since 1 Jan 1601 in 100ns units */
|
||||
FILETIME ft;
|
||||
|
||||
@ -36,9 +36,9 @@
|
||||
* Note that this example requires libcurl 7.30.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *payload_text =
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n"
|
||||
@ -95,7 +95,7 @@ int main(void)
|
||||
if(curl) {
|
||||
size_t filesize;
|
||||
long infilesize = LONG_MAX;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
|
||||
@ -39,7 +39,8 @@ int main(void)
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
const char *urls[] = { "https://example.com",
|
||||
const char *urls[] = {
|
||||
"https://example.com",
|
||||
"https://curl.se",
|
||||
"https://www.example/",
|
||||
NULL /* end of list */
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
|
||||
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
||||
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
||||
#define HANDLECOUNT 2 /* Number of simultaneous transfers */
|
||||
|
||||
int main(void)
|
||||
|
||||
@ -183,8 +183,8 @@ static int handle_socket(CURL *curl, curl_socket_t s, int action, void *userp,
|
||||
case CURL_POLL_IN:
|
||||
case CURL_POLL_OUT:
|
||||
case CURL_POLL_INOUT:
|
||||
curl_context = socketp ?
|
||||
(struct curl_context *)socketp : create_curl_context(s);
|
||||
curl_context =
|
||||
socketp ? (struct curl_context *)socketp : create_curl_context(s);
|
||||
|
||||
curl_multi_assign(multi, s, (void *)curl_context);
|
||||
|
||||
@ -197,7 +197,7 @@ static int handle_socket(CURL *curl, curl_socket_t s, int action, void *userp,
|
||||
|
||||
event_del(curl_context->event);
|
||||
event_assign(curl_context->event, base, curl_context->sockfd,
|
||||
(short)events, curl_perform, curl_context);
|
||||
(short)events, curl_perform, curl_context);
|
||||
event_add(curl_context->event, NULL);
|
||||
|
||||
break;
|
||||
|
||||
@ -41,9 +41,9 @@
|
||||
* Download an HTTP file and upload an FTP file simultaneously.
|
||||
*/
|
||||
|
||||
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
|
||||
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
||||
#define HANDLECOUNT 2 /* Number of simultaneous transfers */
|
||||
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
|
||||
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
||||
#define HANDLECOUNT 2 /* Number of simultaneous transfers */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@ -140,7 +140,7 @@ int main(void)
|
||||
rc = 0;
|
||||
#else
|
||||
/* Portable sleep for platforms other than Windows. */
|
||||
struct timeval wait = {0};
|
||||
struct timeval wait = { 0 };
|
||||
wait.tv_usec = 100 * 1000; /* 100ms */
|
||||
rc = select(0, NULL, NULL, NULL, &wait);
|
||||
#endif
|
||||
@ -155,7 +155,7 @@ int main(void)
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(multi, &still_running);
|
||||
break;
|
||||
|
||||
@ -201,8 +201,8 @@ static int cb_socket(CURL *curl, curl_socket_t s, int action,
|
||||
case CURL_POLL_IN:
|
||||
case CURL_POLL_OUT:
|
||||
case CURL_POLL_INOUT:
|
||||
curl_context = socketp ?
|
||||
(struct curl_context *)socketp : create_curl_context(s, uv);
|
||||
curl_context =
|
||||
socketp ? (struct curl_context *)socketp : create_curl_context(s, uv);
|
||||
|
||||
curl_multi_assign(uv->multi, s, (void *)curl_context);
|
||||
|
||||
@ -230,7 +230,7 @@ static int cb_socket(CURL *curl, curl_socket_t s, int action,
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
CURLcode res;
|
||||
struct datauv uv = {0};
|
||||
struct datauv uv = { 0 };
|
||||
int running_handles;
|
||||
|
||||
if(argc <= 1)
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
https://curl.se/libcurl/c/threadsafe.html
|
||||
|
||||
*/
|
||||
static const char * const urls[NUMT]= {
|
||||
static const char * const urls[NUMT] = {
|
||||
"https://curl.se/",
|
||||
"ftp://example.com/",
|
||||
"https://example.net/",
|
||||
|
||||
@ -31,8 +31,9 @@
|
||||
#include <curl/curl.h>
|
||||
|
||||
/* silly test data to POST */
|
||||
static const char data[]="Lorem ipsum dolor sit amet, consectetur adipiscing "
|
||||
"elit. Sed vel urna neque. Ut quis leo metus. Quisque eleifend, ex at "
|
||||
static const char data[] =
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
|
||||
"Sed vel urna neque. Ut quis leo metus. Quisque eleifend, ex at "
|
||||
"laoreet rhoncus, odio ipsum semper metus, at tempus ante urna in mauris. "
|
||||
"Suspendisse ornare tempor venenatis. Ut dui neque, pellentesque a ______ "
|
||||
"eget, mattis vitae ligula. Fusce ut pharetra est. Ut ullamcorper mi ac "
|
||||
@ -61,7 +62,7 @@ static size_t read_cb(char *dest, size_t size, size_t nmemb, void *userp)
|
||||
return copy_this_much; /* we copied this many bytes */
|
||||
}
|
||||
|
||||
return 0; /* no more data left to deliver */
|
||||
return 0; /* no more data left to deliver */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
||||
@ -68,7 +68,7 @@ int main(void)
|
||||
return (int)res;
|
||||
|
||||
chunk.memory = malloc(1); /* grown as needed by realloc above */
|
||||
chunk.size = 0; /* no data at this point */
|
||||
chunk.size = 0; /* no data at this point */
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
||||
@ -30,8 +30,8 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 3000000
|
||||
#define STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES 6000
|
||||
#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 3000000
|
||||
#define STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES 6000
|
||||
|
||||
struct myprogress {
|
||||
curl_off_t lastruntime; /* type depends on version, see above */
|
||||
|
||||
@ -29,14 +29,14 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#if !CURL_AT_LEAST_VERSION(7,87,0)
|
||||
#if !CURL_AT_LEAST_VERSION(7, 87, 0)
|
||||
#error "too old libcurl"
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
curl_version_info_data *ver;
|
||||
const char *const *ptr;
|
||||
const char * const *ptr;
|
||||
|
||||
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(res)
|
||||
|
||||
@ -128,7 +128,7 @@ int main(void)
|
||||
do {
|
||||
nsent = 0;
|
||||
res = curl_easy_send(curl, request + nsent_total,
|
||||
request_len - nsent_total, &nsent);
|
||||
request_len - nsent_total, &nsent);
|
||||
nsent_total += nsent;
|
||||
|
||||
if(res == CURLE_AGAIN && !wait_on_socket(sockfd, 0, 60000L)) {
|
||||
|
||||
@ -73,8 +73,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
gnutls_x509_crt_import(cert, &chainp[i], GNUTLS_X509_FMT_DER)) {
|
||||
if(GNUTLS_E_SUCCESS ==
|
||||
gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_FULL, &dn)) {
|
||||
fprintf(stderr, "Certificate #%u: %.*s", i,
|
||||
(int)dn.size, dn.data);
|
||||
fprintf(stderr, "Certificate #%u: %.*s", i, (int)dn.size,
|
||||
dn.data);
|
||||
|
||||
gnutls_free(dn.data);
|
||||
}
|
||||
|
||||
@ -40,13 +40,13 @@
|
||||
/* The libcurl options want plain addresses, the viewable headers in the mail
|
||||
* can get a full name as well.
|
||||
*/
|
||||
#define FROM_ADDR "<ursel@example.org>"
|
||||
#define SENDER_ADDR "<kurt@example.org>"
|
||||
#define TO_ADDR "<addressee@example.net>"
|
||||
#define FROM_ADDR "<ursel@example.org>"
|
||||
#define SENDER_ADDR "<kurt@example.org>"
|
||||
#define TO_ADDR "<addressee@example.net>"
|
||||
|
||||
#define FROM_MAIL "Ursel " FROM_ADDR
|
||||
#define SENDER_MAIL "Kurt " SENDER_ADDR
|
||||
#define TO_MAIL "A Receiver " TO_ADDR
|
||||
#define FROM_MAIL "Ursel " FROM_ADDR
|
||||
#define SENDER_MAIL "Kurt " SENDER_ADDR
|
||||
#define TO_MAIL "A Receiver " TO_ADDR
|
||||
|
||||
static const char *payload_text =
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n"
|
||||
@ -99,7 +99,7 @@ int main(void)
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* This is the URL for your mailserver. In this example we connect to the
|
||||
smtp-submission port as we require an authenticated connection. */
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
/* The libcurl options want plain addresses, the viewable headers in the mail
|
||||
* can get a full name as well.
|
||||
*/
|
||||
#define FROM_ADDR "<sender@example.org>"
|
||||
#define TO_ADDR "<addressee@example.net>"
|
||||
#define CC_ADDR "<info@example.org>"
|
||||
#define FROM_ADDR "<sender@example.org>"
|
||||
#define TO_ADDR "<addressee@example.net>"
|
||||
#define CC_ADDR "<info@example.org>"
|
||||
|
||||
#define FROM_MAIL "Sender Person " FROM_ADDR
|
||||
#define TO_MAIL "A Receiver " TO_ADDR
|
||||
@ -96,7 +96,7 @@ int main(void)
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
* Note that this example requires libcurl 7.56.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
#define FROM "<sender@example.org>"
|
||||
#define TO "<addressee@example.net>"
|
||||
#define CC "<info@example.org>"
|
||||
|
||||
static const char *headers_text[] = {
|
||||
"Date: Tue, 22 Aug 2017 14:08:43 +0100",
|
||||
@ -47,7 +47,7 @@ static const char *headers_text[] = {
|
||||
"From: " FROM " (Example User)",
|
||||
"Cc: " CC " (Another example User)",
|
||||
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
|
||||
"rfcpedant.example.org>",
|
||||
"rfcpedant.example.org>",
|
||||
"Subject: example sending a MIME-formatted message",
|
||||
NULL
|
||||
};
|
||||
@ -66,7 +66,6 @@ static const char inline_html[] =
|
||||
"email viewers able to handle HTML.</p>"
|
||||
"</body></html>\r\n";
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
* libcurl's multi interface.
|
||||
*/
|
||||
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
|
||||
static const char *payload_text =
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n"
|
||||
@ -94,7 +94,7 @@ int main(void)
|
||||
if(multi) {
|
||||
int still_running = 1;
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* This is the URL for your mailserver */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
|
||||
static const char *payload_text =
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n"
|
||||
@ -93,7 +93,7 @@ int main(void)
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
* Note that this example requires libcurl 7.20.0 or above.
|
||||
*/
|
||||
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
#define FROM_MAIL "<sender@example.com>"
|
||||
#define TO_MAIL "<recipient@example.com>"
|
||||
#define CC_MAIL "<info@example.com>"
|
||||
|
||||
static const char *payload_text =
|
||||
"Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n"
|
||||
@ -93,7 +93,7 @@ int main(void)
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
struct curl_slist *recipients = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
/* Set username and password */
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
|
||||
|
||||
@ -58,8 +58,8 @@
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS /* for _snprintf(), fopen(), gmtime(),
|
||||
localtime(), sscanf() */
|
||||
#define _CRT_SECURE_NO_WARNINGS /* for _snprintf(), fopen(), gmtime(),
|
||||
localtime(), sscanf() */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -74,9 +74,9 @@ int main(void)
|
||||
#else
|
||||
|
||||
#if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
|
||||
defined(WINAPI_FAMILY)
|
||||
defined(WINAPI_FAMILY)
|
||||
# include <winapifamily.h>
|
||||
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
# define CURL_WINDOWS_UWP
|
||||
# endif
|
||||
@ -100,8 +100,8 @@ int main(void)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define MAX_STRING 256
|
||||
#define MAX_STRING1 MAX_STRING + 1
|
||||
#define MAX_STRING 256
|
||||
#define MAX_STRING1 MAX_STRING + 1
|
||||
|
||||
#define SYNCTIME_UA "synctime/1.0"
|
||||
|
||||
@ -111,8 +111,7 @@ struct conf {
|
||||
char timeserver[MAX_STRING1];
|
||||
};
|
||||
|
||||
static const char DefaultTimeServer[3][MAX_STRING1] =
|
||||
{
|
||||
static const char DefaultTimeServer[3][MAX_STRING1] = {
|
||||
"https://nist.time.gov/",
|
||||
"https://www.google.com/"
|
||||
};
|
||||
@ -128,8 +127,8 @@ static int AutoSyncTime;
|
||||
static SYSTEMTIME SYSTime;
|
||||
static SYSTEMTIME LOCALTime;
|
||||
|
||||
#define HTTP_COMMAND_HEAD 0
|
||||
#define HTTP_COMMAND_GET 1
|
||||
#define HTTP_COMMAND_HEAD 0
|
||||
#define HTTP_COMMAND_GET 1
|
||||
|
||||
static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
@ -167,17 +166,17 @@ static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
||||
|
||||
if(RetVal == 7) {
|
||||
int i;
|
||||
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
||||
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
||||
for(i = 0; i < 12; i++) {
|
||||
if(strcmp(MthStr[i], TmpStr2) == 0) {
|
||||
SYSTime.wMonth = (WORD)(i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AutoSyncTime = 3; /* Computer clock is adjusted */
|
||||
AutoSyncTime = 3; /* Computer clock is adjusted */
|
||||
}
|
||||
else {
|
||||
AutoSyncTime = 0; /* Error in sscanf() fields conversion */
|
||||
AutoSyncTime = 0; /* Error in sscanf() fields conversion */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,7 +221,7 @@ static CURLcode SyncTime_CURL_Fetch(CURL *curl, const char *URL_Str,
|
||||
res = curl_easy_perform(curl);
|
||||
if(outfile)
|
||||
fclose(outfile);
|
||||
return res; /* (CURLE_OK) */
|
||||
return res; /* (CURLE_OK) */
|
||||
}
|
||||
|
||||
static void showUsage(void)
|
||||
@ -251,7 +250,7 @@ static int conf_init(struct conf *conf)
|
||||
|
||||
*conf->http_proxy = 0;
|
||||
for(i = 0; i < MAX_STRING1; i++)
|
||||
conf->proxy_user[i] = 0; /* Clean up password from memory */
|
||||
conf->proxy_user[i] = 0; /* Clean up password from memory */
|
||||
*conf->timeserver = 0;
|
||||
return 1;
|
||||
}
|
||||
@ -263,9 +262,9 @@ int main(int argc, char *argv[])
|
||||
struct conf conf[1];
|
||||
int RetValue;
|
||||
|
||||
ShowAllHeader = 0; /* Do not show HTTP Header */
|
||||
AutoSyncTime = 0; /* Do not synchronise computer clock */
|
||||
RetValue = 0; /* Successful Exit */
|
||||
ShowAllHeader = 0; /* Do not show HTTP Header */
|
||||
AutoSyncTime = 0; /* Do not synchronise computer clock */
|
||||
RetValue = 0; /* Successful Exit */
|
||||
conf_init(conf);
|
||||
|
||||
if(argc > 1) {
|
||||
@ -295,7 +294,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if(*conf->timeserver == 0) /* Use default server for time information */
|
||||
if(*conf->timeserver == 0) /* Use default server for time information */
|
||||
snprintf(conf->timeserver, MAX_STRING, "%s", DefaultTimeServer[0]);
|
||||
|
||||
/* Init CURL before usage */
|
||||
|
||||
@ -33,8 +33,8 @@ static size_t write_cb(char *b, size_t size, size_t nitems, void *p)
|
||||
CURL *curl = p;
|
||||
size_t i;
|
||||
const struct curl_ws_frame *frame = curl_ws_meta(curl);
|
||||
fprintf(stderr, "Type: %s\n", frame->flags & CURLWS_BINARY ?
|
||||
"binary" : "text");
|
||||
fprintf(stderr, "Type: %s\n",
|
||||
frame->flags & CURLWS_BINARY ? "binary" : "text");
|
||||
fprintf(stderr, "Bytes: %u", (unsigned int)(nitems * size));
|
||||
for(i = 0; i < nitems; i++)
|
||||
fprintf(stderr, "%02x ", (unsigned char)b[i]);
|
||||
|
||||
@ -35,8 +35,8 @@ static size_t write_cb(char *b, size_t size, size_t nitems, void *p)
|
||||
size_t i;
|
||||
unsigned int blen = (unsigned int)(nitems * size);
|
||||
const struct curl_ws_frame *frame = curl_ws_meta(curl);
|
||||
fprintf(stderr, "Type: %s\n", frame->flags & CURLWS_BINARY ?
|
||||
"binary" : "text");
|
||||
fprintf(stderr, "Type: %s\n",
|
||||
frame->flags & CURLWS_BINARY ? "binary" : "text");
|
||||
if(frame->flags & CURLWS_BINARY) {
|
||||
fprintf(stderr, "Bytes: %u", blen);
|
||||
for(i = 0; i < nitems; i++)
|
||||
@ -111,7 +111,6 @@ int main(int argc, const char *argv[])
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &rctx);
|
||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
|
||||
|
||||
/* Perform the request, res gets the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
/* Check for errors */
|
||||
|
||||
@ -49,10 +49,10 @@ static CURLcode ping(CURL *curl, const char *send_payload)
|
||||
buf += sent; /* deduct what was sent */
|
||||
blen -= sent;
|
||||
}
|
||||
else if(res == CURLE_AGAIN) { /* blocked on sending */
|
||||
else if(res == CURLE_AGAIN) { /* blocked on sending */
|
||||
fprintf(stderr, "ws: sent PING blocked, waiting a second\n");
|
||||
sleep(1); /* either select() on socket or max timeout would
|
||||
be good here. */
|
||||
sleep(1); /* either select() on socket or max timeout would
|
||||
be good here. */
|
||||
}
|
||||
else /* real error sending */
|
||||
break;
|
||||
@ -85,8 +85,7 @@ retry:
|
||||
same ? "same" : "different");
|
||||
}
|
||||
else if(meta->flags & CURLWS_TEXT) {
|
||||
fprintf(stderr, "ws: received TEXT frame '%.*s'\n", (int)rlen,
|
||||
buffer);
|
||||
fprintf(stderr, "ws: received TEXT frame '%.*s'\n", (int)rlen, buffer);
|
||||
}
|
||||
else if(meta->flags & CURLWS_BINARY) {
|
||||
fprintf(stderr, "ws: received BINARY frame of %u bytes\n",
|
||||
@ -99,10 +98,10 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
else if(res == CURLE_AGAIN) { /* blocked on receiving */
|
||||
else if(res == CURLE_AGAIN) { /* blocked on receiving */
|
||||
fprintf(stderr, "ws: PONG not there yet, waiting a second\n");
|
||||
sleep(1); /* either select() on socket or max timeout would
|
||||
be good here. */
|
||||
sleep(1); /* either select() on socket or max timeout would
|
||||
be good here. */
|
||||
goto retry;
|
||||
}
|
||||
if(res)
|
||||
|
||||
@ -102,7 +102,7 @@ const char *Curl_bufref_ptr(const struct bufref *br)
|
||||
DEBUGASSERT(br->signature == SIGNATURE);
|
||||
DEBUGASSERT(br->ptr || !br->len);
|
||||
|
||||
return (const char *) br->ptr;
|
||||
return (const char *)br->ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -1036,7 +1036,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
||||
/* Only show this when NOT reading the cookies from a file */
|
||||
infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, "
|
||||
"expire %" FMT_OFF_T,
|
||||
replaces ? "Replaced":"Added", co->name, co->value,
|
||||
replaces ? "Replaced" : "Added", co->name, co->value,
|
||||
co->domain, co->path, co->expires);
|
||||
|
||||
if(!replaces)
|
||||
|
||||
@ -238,8 +238,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
||||
# bytes
|
||||
* @return always CURLE_OK
|
||||
*/
|
||||
static CURLcode Curl_sha512_256_finish(unsigned char *digest,
|
||||
void *context)
|
||||
static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context)
|
||||
{
|
||||
Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context;
|
||||
|
||||
@ -453,19 +452,19 @@ static void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS],
|
||||
|
||||
/* 'Ch' and 'Maj' macro functions are defined with widely-used optimization.
|
||||
See FIPS PUB 180-4 formulae 4.8, 4.9. */
|
||||
#define Sha512_Ch(x, y, z) ( (z) ^ ((x) & ((y) ^ (z))) )
|
||||
#define Sha512_Maj(x, y, z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) )
|
||||
#define Sha512_Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
|
||||
#define Sha512_Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y))))
|
||||
|
||||
/* Four 'Sigma' macro functions.
|
||||
See FIPS PUB 180-4 formulae 4.10, 4.11, 4.12, 4.13. */
|
||||
#define SIG0(x) \
|
||||
( Curl_rotr64((x), 28) ^ Curl_rotr64((x), 34) ^ Curl_rotr64((x), 39) )
|
||||
(Curl_rotr64((x), 28) ^ Curl_rotr64((x), 34) ^ Curl_rotr64((x), 39))
|
||||
#define SIG1(x) \
|
||||
( Curl_rotr64((x), 14) ^ Curl_rotr64((x), 18) ^ Curl_rotr64((x), 41) )
|
||||
(Curl_rotr64((x), 14) ^ Curl_rotr64((x), 18) ^ Curl_rotr64((x), 41))
|
||||
#define sig0(x) \
|
||||
( Curl_rotr64((x), 1) ^ Curl_rotr64((x), 8) ^ ((x) >> 7) )
|
||||
(Curl_rotr64((x), 1) ^ Curl_rotr64((x), 8) ^ ((x) >> 7))
|
||||
#define sig1(x) \
|
||||
( Curl_rotr64((x), 19) ^ Curl_rotr64((x), 61) ^ ((x) >> 6) )
|
||||
(Curl_rotr64((x), 19) ^ Curl_rotr64((x), 61) ^ ((x) >> 6))
|
||||
|
||||
if(1) {
|
||||
unsigned int t;
|
||||
@ -628,9 +627,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
||||
if(length >= bytes_left) {
|
||||
/* Combine new data with data in the buffer and process the full
|
||||
block. */
|
||||
memcpy(((unsigned char *)ctx_buf) + bytes_have,
|
||||
data,
|
||||
bytes_left);
|
||||
memcpy(((unsigned char *)ctx_buf) + bytes_have, data, bytes_left);
|
||||
data += bytes_left;
|
||||
length -= bytes_left;
|
||||
Curl_sha512_256_transform(ctx->H, ctx->buffer);
|
||||
|
||||
@ -252,7 +252,7 @@ static CURLFORMcode FormAddCheck(struct FormInfo *first_form,
|
||||
(form->flags & HTTPPOST_BUFFER)) &&
|
||||
!Curl_bufref_ptr(&form->contenttype)) {
|
||||
const char *f = Curl_bufref_ptr((form->flags & HTTPPOST_BUFFER) ?
|
||||
&form->showfilename : &form->value);
|
||||
&form->showfilename : &form->value);
|
||||
const char *type = Curl_mime_contenttype(f);
|
||||
if(!type)
|
||||
type = prevtype;
|
||||
@ -276,7 +276,7 @@ static CURLFORMcode FormAddCheck(struct FormInfo *first_form,
|
||||
if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
|
||||
HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
|
||||
HTTPPOST_CALLBACK))) {
|
||||
if(FormInfoCopyField(&form->value, (size_t) form->contentslength))
|
||||
if(FormInfoCopyField(&form->value, (size_t)form->contentslength))
|
||||
return CURL_FORMADD_MEMORY;
|
||||
}
|
||||
post = AddHttpPost(form, post, httppost, last_post);
|
||||
@ -315,11 +315,11 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
struct curl_httppost *newchain = NULL;
|
||||
struct curl_httppost *lastnode = NULL;
|
||||
|
||||
#define form_ptr_arg(t) (forms ? (t) (void *) avalue : va_arg(params, t))
|
||||
#define form_ptr_arg(t) (forms ? (t)(void *)avalue : va_arg(params, t))
|
||||
#ifdef HAVE_STDINT_H
|
||||
#define form_int_arg(t) (forms ? (t) (uintptr_t) avalue : va_arg(params, t))
|
||||
#define form_int_arg(t) (forms ? (t)(uintptr_t)avalue : va_arg(params, t))
|
||||
#else
|
||||
#define form_int_arg(t) (forms ? (t) (void *) avalue : va_arg(params, t))
|
||||
#define form_int_arg(t) (forms ? (t)(void *)avalue : va_arg(params, t))
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -391,7 +391,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(curr->namelength)
|
||||
retval = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
curr->namelength = (size_t) form_int_arg(long);
|
||||
curr->namelength = (size_t)form_int_arg(long);
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -412,7 +412,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
}
|
||||
break;
|
||||
case CURLFORM_CONTENTSLENGTH:
|
||||
curr->contentslength = (curl_off_t)(size_t) form_int_arg(long);
|
||||
curr->contentslength = (curl_off_t)(size_t)form_int_arg(long);
|
||||
break;
|
||||
|
||||
case CURLFORM_CONTENTLEN:
|
||||
@ -493,7 +493,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(curr->bufferlength)
|
||||
retval = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
curr->bufferlength = (size_t) form_int_arg(long);
|
||||
curr->bufferlength = (size_t)form_int_arg(long);
|
||||
break;
|
||||
|
||||
case CURLFORM_STREAM:
|
||||
@ -521,7 +521,7 @@ static CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(avalue) {
|
||||
form = NewFormInfo();
|
||||
if(!form || Curl_bufref_memdup0(&form->contenttype, avalue,
|
||||
strlen(avalue))) {
|
||||
strlen(avalue))) {
|
||||
curlx_free(form);
|
||||
retval = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
@ -793,10 +793,10 @@ CURLcode Curl_getformdata(CURL *data,
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
result = curl_mime_data_cb(part, (curl_off_t) -1,
|
||||
(curl_read_callback) fread,
|
||||
result = curl_mime_data_cb(part, (curl_off_t)-1,
|
||||
(curl_read_callback)fread,
|
||||
curlx_fseek,
|
||||
NULL, (void *) stdin);
|
||||
NULL, (void *)stdin);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
@ -81,8 +81,8 @@
|
||||
|
||||
/* macro to check for a three-digit ftp status code at the start of the
|
||||
given string */
|
||||
#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
|
||||
ISDIGIT(line[2]))
|
||||
#define STATUSCODE(line) \
|
||||
(ISDIGIT(line[0]) && ISDIGIT(line[1]) && ISDIGIT(line[2]))
|
||||
|
||||
/* macro to check for the last line in an FTP server response */
|
||||
#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))
|
||||
@ -1749,8 +1749,7 @@ static CURLcode ftp_epsv_disable(struct Curl_easy *data,
|
||||
return result;
|
||||
}
|
||||
|
||||
static CURLcode ftp_control_addr_dup(struct Curl_easy *data,
|
||||
char **newhostp)
|
||||
static CURLcode ftp_control_addr_dup(struct Curl_easy *data, char **newhostp)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
struct ip_quadruple ipquad;
|
||||
|
||||
@ -217,7 +217,7 @@ static timediff_t dnscache_prune(struct Curl_hash *hostcache,
|
||||
user.oldest_ms = 0;
|
||||
|
||||
Curl_hash_clean_with_criterium(hostcache,
|
||||
(void *) &user,
|
||||
(void *)&user,
|
||||
dnscache_entry_is_stale);
|
||||
|
||||
return user.oldest_ms;
|
||||
|
||||
@ -448,7 +448,7 @@ static CURLcode calc_payload_hash(struct Curl_easy *data,
|
||||
else
|
||||
post_data_len = (size_t)data->set.postfieldsize;
|
||||
}
|
||||
result = Curl_sha256it(sha_hash, (const unsigned char *) post_data,
|
||||
result = Curl_sha256it(sha_hash, (const unsigned char *)post_data,
|
||||
post_data_len);
|
||||
if(!result)
|
||||
sha256_to_hex(sha_hex, sha_hash);
|
||||
|
||||
10
lib/ldap.c
10
lib/ldap.c
@ -143,11 +143,11 @@ static void ldap_free_urldesc_low(LDAPURLDesc *ludp);
|
||||
#endif /* !HAVE_LDAP_URL_PARSE */
|
||||
|
||||
#ifdef DEBUG_LDAP
|
||||
#define LDAP_TRACE(x) \
|
||||
do { \
|
||||
ldap_trace_low("%u: ", __LINE__); \
|
||||
ldap_trace_low x; \
|
||||
} while(0)
|
||||
#define LDAP_TRACE(x) \
|
||||
do { \
|
||||
ldap_trace_low("%u: ", __LINE__); \
|
||||
ldap_trace_low x; \
|
||||
} while(0)
|
||||
|
||||
static void ldap_trace_low(const char *fmt, ...) CURL_PRINTF(1, 2);
|
||||
#else
|
||||
|
||||
@ -1769,7 +1769,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
||||
if(!use_set_uh) {
|
||||
char *newurl;
|
||||
uc = curl_url_set(uh, CURLUPART_URL, Curl_bufref_ptr(&data->state.url),
|
||||
(unsigned int) (CURLU_GUESS_SCHEME |
|
||||
(unsigned int)(CURLU_GUESS_SCHEME |
|
||||
CURLU_NON_SUPPORT_SCHEME |
|
||||
(data->set.disallow_username_in_url ?
|
||||
CURLU_DISALLOW_USER : 0) |
|
||||
@ -3199,7 +3199,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
if(!unix_path && CONN_IS_PROXIED(conn) && conn->socks_proxy.host.name &&
|
||||
!strncmp(UNIX_SOCKET_PREFIX"/",
|
||||
!strncmp(UNIX_SOCKET_PREFIX "/",
|
||||
conn->socks_proxy.host.name, sizeof(UNIX_SOCKET_PREFIX)))
|
||||
unix_path = conn->socks_proxy.host.name + sizeof(UNIX_SOCKET_PREFIX) - 1;
|
||||
#endif
|
||||
|
||||
@ -452,10 +452,10 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
chlg_buf[0].cbBuffer = 0;
|
||||
chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[1].pvBuffer = CURL_UNCONST(request);
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *)request));
|
||||
chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[2].pvBuffer = CURL_UNCONST(uripath);
|
||||
chlg_buf[2].cbBuffer = curlx_uztoul(strlen((const char *) uripath));
|
||||
chlg_buf[2].cbBuffer = curlx_uztoul(strlen((const char *)uripath));
|
||||
chlg_buf[3].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[3].pvBuffer = NULL;
|
||||
chlg_buf[3].cbBuffer = 0;
|
||||
@ -495,7 +495,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
/* Populate our identity domain */
|
||||
if(Curl_override_sspi_http_realm((const char *) digest->input_token,
|
||||
if(Curl_override_sspi_http_realm((const char *)digest->input_token,
|
||||
&identity)) {
|
||||
Curl_sspi_free_identity(&identity);
|
||||
curlx_free(output_token);
|
||||
@ -552,7 +552,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
chlg_buf[0].cbBuffer = curlx_uztoul(digest->input_token_len);
|
||||
chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[1].pvBuffer = CURL_UNCONST(request);
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *)request));
|
||||
chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[2].pvBuffer = NULL;
|
||||
chlg_buf[2].cbBuffer = 0;
|
||||
@ -565,7 +565,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
resp_buf.pvBuffer = output_token;
|
||||
resp_buf.cbBuffer = curlx_uztoul(token_max);
|
||||
|
||||
spn = curlx_convert_UTF8_to_tchar((const char *) uripath);
|
||||
spn = curlx_convert_UTF8_to_tchar((const char *)uripath);
|
||||
if(!spn) {
|
||||
Curl_pSecFn->FreeCredentialsHandle(&credentials);
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
#include "../curlx/warnless.h"
|
||||
|
||||
|
||||
#define QUIC_MAX_STREAMS (256 * 1024)
|
||||
#define QUIC_MAX_STREAMS (256 * 1024)
|
||||
#define QUIC_HANDSHAKE_TIMEOUT (10 * NGTCP2_SECONDS)
|
||||
|
||||
/* A stream window is the maximum amount we need to buffer for
|
||||
@ -91,12 +91,11 @@
|
||||
* spares. Memory consumption goes down when streams run empty,
|
||||
* have a large upload done, etc. */
|
||||
#define H3_STREAM_POOL_SPARES \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE ) / 2
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE) / 2
|
||||
/* Receive and Send max number of chunks just follows from the
|
||||
* chunk size and window size */
|
||||
#define H3_STREAM_SEND_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
/*
|
||||
* Store ngtcp2 version info in this buffer.
|
||||
@ -959,7 +958,7 @@ static CURLcode cf_ngtcp2_adjust_pollset(struct Curl_cfilter *cf,
|
||||
|
||||
CF_DATA_SAVE(save, cf, data);
|
||||
c_exhaust = want_send && (!ngtcp2_conn_get_cwnd_left(ctx->qconn) ||
|
||||
!ngtcp2_conn_get_max_data_left(ctx->qconn));
|
||||
!ngtcp2_conn_get_max_data_left(ctx->qconn));
|
||||
s_exhaust = want_send && stream && stream->id >= 0 &&
|
||||
stream->quic_flow_blocked;
|
||||
want_recv = (want_recv || c_exhaust || s_exhaust);
|
||||
@ -2513,7 +2512,7 @@ static CURLcode cf_connect_start(struct Curl_cfilter *cf,
|
||||
CURLcode result;
|
||||
const struct Curl_sockaddr_ex *sockaddr = NULL;
|
||||
int qfd;
|
||||
static const struct alpn_spec ALPN_SPEC_H3 = {{ "h3", "h3-29" }, 2};
|
||||
static const struct alpn_spec ALPN_SPEC_H3 = { { "h3", "h3-29" }, 2 };
|
||||
|
||||
DEBUGASSERT(ctx->initialized);
|
||||
ctx->dcid.datalen = NGTCP2_MAX_CIDLEN;
|
||||
|
||||
@ -70,13 +70,13 @@
|
||||
* spares. Memory consumption goes down when streams run empty,
|
||||
* have a large upload done, etc. */
|
||||
#define H3_STREAM_POOL_SPARES \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE ) / 2
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE) / 2
|
||||
/* Receive and Send max number of chunks just follows from the
|
||||
* chunk size and window size */
|
||||
#define H3_STREAM_RECV_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
#define H3_STREAM_SEND_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
#if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC)
|
||||
typedef uint32_t sslerr_t;
|
||||
@ -87,8 +87,7 @@ typedef unsigned long sslerr_t;
|
||||
|
||||
/* How to access `call_data` from a cf_osslq filter */
|
||||
#undef CF_CTX_CALL_DATA
|
||||
#define CF_CTX_CALL_DATA(cf) \
|
||||
((struct cf_osslq_ctx *)(cf)->ctx)->call_data
|
||||
#define CF_CTX_CALL_DATA(cf) ((struct cf_osslq_ctx *)(cf)->ctx)->call_data
|
||||
|
||||
static CURLcode cf_progress_ingress(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data);
|
||||
@ -954,7 +953,7 @@ static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t stream_id,
|
||||
(void)conn;
|
||||
|
||||
if(stream && stream->s.ssl) {
|
||||
SSL_STREAM_RESET_ARGS args = {0};
|
||||
SSL_STREAM_RESET_ARGS args = { 0 };
|
||||
args.quic_error_code = app_error_code;
|
||||
rv = !SSL_stream_reset(stream->s.ssl, &args, sizeof(args));
|
||||
CURL_TRC_CF(data, cf, "[%" PRId64 "] reset -> %d", stream_id, rv);
|
||||
|
||||
@ -65,11 +65,11 @@
|
||||
* stream buffer to not keep spares. Memory consumption goes down when streams
|
||||
* run empty, have a large upload done, etc. */
|
||||
#define H3_STREAM_POOL_SPARES \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE ) / 2
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE) / 2
|
||||
/* Receive and Send max number of chunks just follows from the
|
||||
* chunk size and window size */
|
||||
#define H3_STREAM_RECV_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
/*
|
||||
* Store quiche version info in this buffer.
|
||||
@ -1228,7 +1228,7 @@ static CURLcode cf_quiche_ctx_open(struct Curl_cfilter *cf,
|
||||
int rv;
|
||||
CURLcode result;
|
||||
const struct Curl_sockaddr_ex *sockaddr;
|
||||
static const struct alpn_spec ALPN_SPEC_H3 = {{ "h3" }, 1};
|
||||
static const struct alpn_spec ALPN_SPEC_H3 = { { "h3" }, 1 };
|
||||
|
||||
DEBUGASSERT(ctx->q.sockfd != CURL_SOCKET_BAD);
|
||||
DEBUGASSERT(ctx->initialized);
|
||||
|
||||
@ -178,12 +178,12 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
|
||||
if(!cert)
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
else if(peer->sni &&
|
||||
(wolfSSL_X509_check_host(cert, peer->sni, strlen(peer->sni), 0, NULL)
|
||||
== WOLFSSL_FAILURE))
|
||||
(wolfSSL_X509_check_host(cert, peer->sni, strlen(peer->sni), 0,
|
||||
NULL) == WOLFSSL_FAILURE))
|
||||
result = CURLE_PEER_FAILED_VERIFICATION;
|
||||
else if(!peer->sni &&
|
||||
(wolfSSL_X509_check_ip_asc(cert, peer->hostname, 0)
|
||||
== WOLFSSL_FAILURE))
|
||||
(wolfSSL_X509_check_ip_asc(cert, peer->hostname,
|
||||
0) == WOLFSSL_FAILURE))
|
||||
result = CURLE_PEER_FAILED_VERIFICATION;
|
||||
wolfSSL_X509_free(cert);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
|
||||
CURLcode result = CURLE_OK;
|
||||
#ifdef HAVE_SENDMSG
|
||||
struct iovec msg_iov;
|
||||
struct msghdr msg = {0};
|
||||
struct msghdr msg = { 0 };
|
||||
ssize_t rv;
|
||||
#if defined(__linux__) && defined(UDP_SEGMENT)
|
||||
uint8_t msg_ctrl[32];
|
||||
@ -153,8 +153,7 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
|
||||
}
|
||||
#endif
|
||||
|
||||
while((rv = sendmsg(qctx->sockfd, &msg, 0)) == -1 &&
|
||||
SOCKERRNO == SOCKEINTR)
|
||||
while((rv = sendmsg(qctx->sockfd, &msg, 0)) == -1 && SOCKERRNO == SOCKEINTR)
|
||||
;
|
||||
|
||||
if(!curlx_sztouz(rv, psent)) {
|
||||
@ -516,7 +515,7 @@ static CURLcode recvmsg_packets(struct Curl_cfilter *cf,
|
||||
}
|
||||
curlx_strerror(SOCKERRNO, errstr, sizeof(errstr));
|
||||
failf(data, "QUIC: recvmsg() unexpectedly returned %zd (errno=%d; %s)",
|
||||
rc, SOCKERRNO, errstr);
|
||||
rc, SOCKERRNO, errstr);
|
||||
result = CURLE_RECV_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@ -581,7 +580,7 @@ static CURLcode recvfrom_packets(struct Curl_cfilter *cf,
|
||||
}
|
||||
curlx_strerror(SOCKERRNO, errstr, sizeof(errstr));
|
||||
failf(data, "QUIC: recvfrom() unexpectedly returned %zd (errno=%d; %s)",
|
||||
rv, SOCKERRNO, errstr);
|
||||
rv, SOCKERRNO, errstr);
|
||||
result = CURLE_RECV_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
#ifdef USE_HTTP3
|
||||
|
||||
#define MAX_PKT_BURST 10
|
||||
#define MAX_PKT_BURST 10
|
||||
#define MAX_UDP_PAYLOAD_SIZE 1452
|
||||
|
||||
struct cf_quic_ctx {
|
||||
|
||||
@ -54,31 +54,31 @@
|
||||
#ifdef USE_APPLE_SECTRUST
|
||||
#define SSL_SYSTEM_VERIFIER
|
||||
|
||||
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) \
|
||||
&& MAC_OS_X_VERSION_MAX_ALLOWED >= 101400) \
|
||||
|| (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \
|
||||
&& __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000)
|
||||
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && \
|
||||
MAC_OS_X_VERSION_MAX_ALLOWED >= 101400) || \
|
||||
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
|
||||
__IPHONE_OS_VERSION_MAX_ALLOWED >= 120000)
|
||||
#define SUPPORTS_SecTrustEvaluateWithError 1
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORTS_SecTrustEvaluateWithError) \
|
||||
&& ((defined(MAC_OS_X_VERSION_MIN_REQUIRED) \
|
||||
&& MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) \
|
||||
|| (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) \
|
||||
&& __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000))
|
||||
#if defined(SUPPORTS_SecTrustEvaluateWithError) && \
|
||||
((defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || \
|
||||
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED >= 120000))
|
||||
#define REQUIRES_SecTrustEvaluateWithError 1
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORTS_SecTrustEvaluateWithError) \
|
||||
&& !defined(HAVE_BUILTIN_AVAILABLE) \
|
||||
&& !defined(REQUIRES_SecTrustEvaluateWithError)
|
||||
#if defined(SUPPORTS_SecTrustEvaluateWithError) && \
|
||||
!defined(HAVE_BUILTIN_AVAILABLE) && \
|
||||
!defined(REQUIRES_SecTrustEvaluateWithError)
|
||||
#undef SUPPORTS_SecTrustEvaluateWithError
|
||||
#endif
|
||||
|
||||
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) \
|
||||
&& MAC_OS_X_VERSION_MAX_ALLOWED >= 100900) \
|
||||
|| (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) \
|
||||
&& __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000)
|
||||
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && \
|
||||
MAC_OS_X_VERSION_MAX_ALLOWED >= 100900) || \
|
||||
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
|
||||
__IPHONE_OS_VERSION_MAX_ALLOWED >= 70000)
|
||||
#define SUPPORTS_SecOCSP 1
|
||||
#endif
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ struct cs_entry {
|
||||
};
|
||||
|
||||
/* !checksrc! disable COMMANOSPACE all */
|
||||
static const struct cs_entry cs_list [] = {
|
||||
static const struct cs_entry cs_list[] = {
|
||||
/* TLS 1.3 ciphers */
|
||||
#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
|
||||
CS_ENTRY(0x1301, TLS,AES,128,GCM,SHA256,,,),
|
||||
@ -549,7 +549,7 @@ static const struct cs_entry cs_list [] = {
|
||||
|
||||
static int cs_str_to_zip(const char *cs_str, size_t cs_len, uint8_t zip[6])
|
||||
{
|
||||
uint8_t indexes[8] = {0};
|
||||
uint8_t indexes[8] = { 0 };
|
||||
const char *entry, *cur;
|
||||
const char *nxt = cs_str;
|
||||
const char *end = cs_str + cs_len;
|
||||
@ -597,7 +597,7 @@ static int cs_str_to_zip(const char *cs_str, size_t cs_len, uint8_t zip[6])
|
||||
|
||||
static int cs_zip_to_str(const uint8_t zip[6], char *buf, size_t buf_size)
|
||||
{
|
||||
uint8_t indexes[8] = {0};
|
||||
uint8_t indexes[8] = { 0 };
|
||||
const char *entry;
|
||||
char separator = '-';
|
||||
int idx, i, r;
|
||||
|
||||
@ -52,8 +52,8 @@
|
||||
#define BACKEND ((struct schannel_ssl_backend_data *)connssl->backend)
|
||||
|
||||
#define MAX_CAFILE_SIZE 1048576 /* 1 MiB */
|
||||
#define BEGIN_CERT "-----BEGIN CERTIFICATE-----"
|
||||
#define END_CERT "\n-----END CERTIFICATE-----"
|
||||
#define BEGIN_CERT "-----BEGIN CERTIFICATE-----"
|
||||
#define END_CERT "\n-----END CERTIFICATE-----"
|
||||
|
||||
struct cert_chain_engine_config_win8 {
|
||||
DWORD cbSize;
|
||||
@ -532,7 +532,7 @@ CURLcode Curl_verify_host(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
DWORD actual_len = 0;
|
||||
PCERT_ALT_NAME_INFO alt_name_info = NULL;
|
||||
DWORD alt_name_info_size = 0;
|
||||
struct num_ip_data ip_blob = {0};
|
||||
struct num_ip_data ip_blob = { 0 };
|
||||
bool Win8_compat;
|
||||
struct num_ip_data *p = &ip_blob;
|
||||
DWORD i;
|
||||
|
||||
@ -153,7 +153,7 @@ static const struct Curl_OID OIDtable[] = {
|
||||
{ "2.16.840.1.101.3.4.2.2", "sha384" },
|
||||
{ "2.16.840.1.101.3.4.2.3", "sha512" },
|
||||
{ "1.2.840.113549.1.9.2", "unstructuredName" },
|
||||
{ (const char *) NULL, (const char *) NULL }
|
||||
{ (const char *)NULL, (const char *)NULL }
|
||||
};
|
||||
|
||||
#endif /* WANT_EXTRACT_CERTINFO */
|
||||
|
||||
@ -174,22 +174,22 @@ static CURLcode test_cli_h2_pausing(const char *URL)
|
||||
handles[i].fail_write = 1;
|
||||
handles[i].curl = curl_easy_init();
|
||||
if(!handles[i].curl ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_WRITEFUNCTION, cb)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_WRITEDATA, &handles[i])
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_FOLLOWLOCATION, 1L)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_VERBOSE, 1L) != CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_DEBUGFUNCTION, cli_debug_cb)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_SSL_VERIFYPEER, 0L)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_RESOLVE, resolve)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_PIPEWAIT, 1L) != CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_URL, url) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "failed configuring easy handle - bailing out\n");
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_WRITEFUNCTION, cb)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_WRITEDATA, &handles[i])
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_FOLLOWLOCATION, 1L)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_VERBOSE, 1L) != CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_DEBUGFUNCTION, cli_debug_cb)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_SSL_VERIFYPEER, 0L)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_RESOLVE, resolve)
|
||||
!= CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_PIPEWAIT, 1L) != CURLE_OK ||
|
||||
curl_easy_setopt(handles[i].curl, CURLOPT_URL, url) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "failed configuring easy handle - bailing out\n");
|
||||
res = (CURLcode)2;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -178,8 +178,8 @@ static int my_progress_d_cb(void *userdata,
|
||||
#endif
|
||||
#ifdef USE_MBEDTLS
|
||||
case CURLSSLBACKEND_MBEDTLS: {
|
||||
const char *version = mbedtls_ssl_get_version(
|
||||
(mbedtls_ssl_context*)tls->internals);
|
||||
const char *version =
|
||||
mbedtls_ssl_get_version((mbedtls_ssl_context *)tls->internals);
|
||||
assert(version);
|
||||
assert(strcmp(version, "unknown"));
|
||||
curl_mfprintf(stderr, "[t-%zu] info mbedTLS using %s\n",
|
||||
@ -190,7 +190,7 @@ static int my_progress_d_cb(void *userdata,
|
||||
#ifdef USE_RUSTLS
|
||||
case CURLSSLBACKEND_RUSTLS: {
|
||||
int v = rustls_connection_get_protocol_version(
|
||||
(struct rustls_connection*)tls->internals);
|
||||
(struct rustls_connection *)tls->internals);
|
||||
assert(v);
|
||||
curl_mfprintf(stderr, "[t-%zu] info rustls TLS version 0x%x\n",
|
||||
t->idx, v);
|
||||
@ -514,8 +514,8 @@ static CURLcode test_cli_hx_download(const char *URL)
|
||||
if(!t->started) {
|
||||
t->curl = curl_easy_init();
|
||||
if(!t->curl ||
|
||||
setup_hx_download(t->curl, url, t, http_version, host, share,
|
||||
use_earlydata, fresh_connect)) {
|
||||
setup_hx_download(t->curl, url, t, http_version, host, share,
|
||||
use_earlydata, fresh_connect)) {
|
||||
curl_mfprintf(stderr, "[t-%zu] FAILED setup\n", i);
|
||||
res = (CURLcode)1;
|
||||
goto cleanup;
|
||||
|
||||
@ -62,7 +62,7 @@ int unitfail; /* for unittests */
|
||||
int coptind;
|
||||
const char *coptarg;
|
||||
|
||||
int cgetopt(int argc, const char *const argv[], const char *optstring)
|
||||
int cgetopt(int argc, const char * const argv[], const char *optstring)
|
||||
{
|
||||
static int optpos = 1;
|
||||
int coptopt;
|
||||
@ -141,7 +141,7 @@ static void memory_tracking_init(void)
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define memory_tracking_init() Curl_nop_stmt
|
||||
#define memory_tracking_init() Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
/* returns a hexdump in a static memory area */
|
||||
|
||||
@ -59,11 +59,11 @@ extern int unitfail; /* for unittests */
|
||||
#define CURL_GNUC_DIAG
|
||||
#endif
|
||||
|
||||
#define test_setopt(A,B,C) \
|
||||
#define test_setopt(A, B, C) \
|
||||
if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \
|
||||
goto test_cleanup
|
||||
|
||||
#define test_multi_setopt(A,B,C) \
|
||||
#define test_multi_setopt(A, B, C) \
|
||||
if((res = curl_multi_setopt((A), (B), (C))) != CURLE_OK) \
|
||||
goto test_cleanup
|
||||
|
||||
@ -79,7 +79,7 @@ extern struct curltime tv_test_start; /* for test timing */
|
||||
|
||||
extern int coptind;
|
||||
extern const char *coptarg;
|
||||
int cgetopt(int argc, const char *const argv[], const char *optstring);
|
||||
int cgetopt(int argc, const char * const argv[], const char *optstring);
|
||||
|
||||
extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
|
||||
struct timeval *tv);
|
||||
@ -100,18 +100,18 @@ void ws_close(CURL *curl);
|
||||
** For portability reasons TEST_ERR_* values should be less than 127.
|
||||
*/
|
||||
|
||||
#define TEST_ERR_MAJOR_BAD CURLE_OBSOLETE20
|
||||
#define TEST_ERR_RUNS_FOREVER CURLE_OBSOLETE24
|
||||
#define TEST_ERR_EASY_INIT CURLE_OBSOLETE29
|
||||
#define TEST_ERR_MULTI CURLE_OBSOLETE32
|
||||
#define TEST_ERR_NUM_HANDLES CURLE_OBSOLETE34
|
||||
#define TEST_ERR_SELECT CURLE_OBSOLETE40
|
||||
#define TEST_ERR_SUCCESS CURLE_OBSOLETE41
|
||||
#define TEST_ERR_FAILURE CURLE_OBSOLETE44
|
||||
#define TEST_ERR_USAGE CURLE_OBSOLETE46
|
||||
#define TEST_ERR_FOPEN CURLE_OBSOLETE50
|
||||
#define TEST_ERR_FSTAT CURLE_OBSOLETE51
|
||||
#define TEST_ERR_BAD_TIMEOUT CURLE_OBSOLETE57
|
||||
#define TEST_ERR_MAJOR_BAD CURLE_OBSOLETE20
|
||||
#define TEST_ERR_RUNS_FOREVER CURLE_OBSOLETE24
|
||||
#define TEST_ERR_EASY_INIT CURLE_OBSOLETE29
|
||||
#define TEST_ERR_MULTI CURLE_OBSOLETE32
|
||||
#define TEST_ERR_NUM_HANDLES CURLE_OBSOLETE34
|
||||
#define TEST_ERR_SELECT CURLE_OBSOLETE40
|
||||
#define TEST_ERR_SUCCESS CURLE_OBSOLETE41
|
||||
#define TEST_ERR_FAILURE CURLE_OBSOLETE44
|
||||
#define TEST_ERR_USAGE CURLE_OBSOLETE46
|
||||
#define TEST_ERR_FOPEN CURLE_OBSOLETE50
|
||||
#define TEST_ERR_FSTAT CURLE_OBSOLETE51
|
||||
#define TEST_ERR_BAD_TIMEOUT CURLE_OBSOLETE57
|
||||
|
||||
/*
|
||||
** Macros for test source code readability/maintainability.
|
||||
@ -144,7 +144,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_easy_init(A,Y,Z) do { \
|
||||
#define exe_easy_init(A, Y, Z) do { \
|
||||
if(((A) = curl_easy_init()) == NULL) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_init() failed\n", (Y), (Z)); \
|
||||
res = TEST_ERR_EASY_INIT; \
|
||||
@ -154,10 +154,10 @@ void ws_close(CURL *curl);
|
||||
#define res_easy_init(A) \
|
||||
exe_easy_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_easy_init(A,Y,Z) do { \
|
||||
exe_easy_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
#define chk_easy_init(A, Y, Z) do { \
|
||||
exe_easy_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define easy_init(A) \
|
||||
@ -165,7 +165,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_init(A,Y,Z) do { \
|
||||
#define exe_multi_init(A, Y, Z) do { \
|
||||
if(((A) = curl_multi_init()) == NULL) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \
|
||||
res = TEST_ERR_MULTI; \
|
||||
@ -175,10 +175,10 @@ void ws_close(CURL *curl);
|
||||
#define res_multi_init(A) \
|
||||
exe_multi_init((A), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_init(A,Y,Z) do { \
|
||||
exe_multi_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
#define chk_multi_init(A, Y, Z) do { \
|
||||
exe_multi_init((A), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_init(A) \
|
||||
@ -186,7 +186,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_easy_setopt(A,B,C,Y,Z) do { \
|
||||
#define exe_easy_setopt(A, B, C, Y, Z) do { \
|
||||
CURLcode ec; \
|
||||
if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_setopt() failed, " \
|
||||
@ -220,21 +220,21 @@ void ws_close(CURL *curl);
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define res_multi_setopt(A,B,C) \
|
||||
#define res_multi_setopt(A, B, C) \
|
||||
exe_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
#define chk_multi_setopt(A,B,C,Y,Z) do { \
|
||||
#define chk_multi_setopt(A, B, C, Y, Z) do { \
|
||||
exe_multi_setopt((A), (B), (C), (Y), (Z)); \
|
||||
if(res) \
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_setopt(A,B,C) \
|
||||
#define multi_setopt(A, B, C) \
|
||||
chk_multi_setopt((A), (B), (C), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_add_handle(A,B,Y,Z) do { \
|
||||
#define exe_multi_add_handle(A, B, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
|
||||
@ -258,7 +258,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_remove_handle(A,B,Y,Z) do { \
|
||||
#define exe_multi_remove_handle(A, B, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
|
||||
@ -283,7 +283,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_perform(A,B,Y,Z) do { \
|
||||
#define exe_multi_perform(A, B, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_perform((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_perform() failed, " \
|
||||
@ -308,7 +308,7 @@ void ws_close(CURL *curl);
|
||||
goto test_cleanup; \
|
||||
} while(0)
|
||||
|
||||
#define multi_perform(A,B) \
|
||||
#define multi_perform(A, B) \
|
||||
chk_multi_perform((A), (B), (__FILE__), (__LINE__))
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
@ -343,7 +343,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_timeout(A,B,Y,Z) do { \
|
||||
#define exe_multi_timeout(A, B, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_timeout() failed, " \
|
||||
@ -373,7 +373,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_poll(A,B,C,D,E,Y,Z) do { \
|
||||
#define exe_multi_poll(A, B, C, D, E, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_poll((A), (B), (C), (D), (E))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_poll() failed, " \
|
||||
@ -403,7 +403,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_multi_wakeup(A,Y,Z) do { \
|
||||
#define exe_multi_wakeup(A, Y, Z) do { \
|
||||
CURLMcode ec; \
|
||||
if((ec = curl_multi_wakeup((A))) != CURLM_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
|
||||
@ -460,7 +460,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
#define TEST_HANG_TIMEOUT 60 * 1000 /* global default */
|
||||
|
||||
#define exe_test_timedout(T,Y,Z) do { \
|
||||
#define exe_test_timedout(T, Y, Z) do { \
|
||||
timediff_t timediff = curlx_timediff_ms(curlx_now(), tv_test_start); \
|
||||
if(timediff > (T)) { \
|
||||
curl_mfprintf(stderr, "%s:%d ABORTING TEST, since it seems " \
|
||||
@ -490,7 +490,7 @@ void ws_close(CURL *curl);
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define exe_global_init(A,Y,Z) do { \
|
||||
#define exe_global_init(A, Y, Z) do { \
|
||||
CURLcode ec; \
|
||||
if((ec = curl_global_init((A))) != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "%s:%d curl_global_init() failed, " \
|
||||
|
||||
@ -34,11 +34,11 @@
|
||||
|
||||
*/
|
||||
|
||||
#define F_RESUME (1 << 0) /* resume/range. */
|
||||
#define F_HTTP416 (1 << 1) /* Server returns http code 416. */
|
||||
#define F_FAIL (1 << 2) /* Fail on error. */
|
||||
#define F_CONTENTRANGE (1 << 3) /* Server sends content-range hdr. */
|
||||
#define F_IGNOREBODY (1 << 4) /* Body should be ignored. */
|
||||
#define F_RESUME (1 << 0) /* resume/range. */
|
||||
#define F_HTTP416 (1 << 1) /* Server returns http code 416. */
|
||||
#define F_FAIL (1 << 2) /* Fail on error. */
|
||||
#define F_CONTENTRANGE (1 << 3) /* Server sends content-range hdr. */
|
||||
#define F_IGNOREBODY (1 << 4) /* Body should be ignored. */
|
||||
|
||||
struct testparams {
|
||||
unsigned int flags; /* ORed flags as above. */
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
static CURLcode test_lib1506(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
CURL *curl[NUM_HANDLES] = { 0 };
|
||||
int running;
|
||||
CURLM *multi = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
static CURLcode test_lib1512(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[2] = {NULL, NULL};
|
||||
CURL *curl[2] = { NULL, NULL };
|
||||
const char *port = libtest_arg3;
|
||||
const char *address = libtest_arg2;
|
||||
char dnsentry[256];
|
||||
|
||||
@ -57,7 +57,7 @@ static CURLcode test_lib1514(const char *URL)
|
||||
|
||||
static char testdata[] = "dummy";
|
||||
|
||||
struct t1514_WriteThis pooh = { testdata, sizeof(testdata)-1 };
|
||||
struct t1514_WriteThis pooh = { testdata, sizeof(testdata) - 1 };
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ static CURLcode test_lib1520(const char *URL)
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
struct curl_slist *rcpt_list = NULL;
|
||||
struct upload_status upload_ctx = {0};
|
||||
struct upload_status upload_ctx = { 0 };
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
|
||||
static CURLcode test_lib1537(const char *URL)
|
||||
{
|
||||
const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
|
||||
const unsigned char a[] = { 0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7 };
|
||||
CURLcode res = CURLE_OK;
|
||||
char *ptr = NULL;
|
||||
int asize;
|
||||
|
||||
@ -29,7 +29,7 @@ struct t1541_transfer_status {
|
||||
int bd_count;
|
||||
};
|
||||
|
||||
#define KN(a) a, #a
|
||||
#define KN(a) a, #a
|
||||
|
||||
static void t1541_geterr(const char *name, CURLcode val, int lineno)
|
||||
{
|
||||
|
||||
@ -30,9 +30,9 @@ static CURLcode test_lib1550(const char *URL)
|
||||
CURLM *multi;
|
||||
CURLcode res = CURLE_OK;
|
||||
static const char * const bl_servers[] =
|
||||
{"Microsoft-IIS/6.0", "nginx/0.8.54", NULL};
|
||||
{ "Microsoft-IIS/6.0", "nginx/0.8.54", NULL };
|
||||
static const char * const bl_sites[] =
|
||||
{"curl.se:443", "example.com:80", NULL};
|
||||
{ "curl.se:443", "example.com:80", NULL };
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
multi = curl_multi_init();
|
||||
|
||||
@ -45,7 +45,7 @@ static CURLcode test_lib1556(const char *URL)
|
||||
CURLcode code;
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
struct headerinfo info = {0};
|
||||
struct headerinfo info = { 0 };
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
|
||||
@ -1859,18 +1859,18 @@ static int get_nothing(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clearurlcase clear_url_list[] ={
|
||||
{CURLUPART_SCHEME, "http", NULL, CURLUE_NO_SCHEME},
|
||||
{CURLUPART_USER, "user", NULL, CURLUE_NO_USER},
|
||||
{CURLUPART_PASSWORD, "password", NULL, CURLUE_NO_PASSWORD},
|
||||
{CURLUPART_OPTIONS, "options", NULL, CURLUE_NO_OPTIONS},
|
||||
{CURLUPART_HOST, "host", NULL, CURLUE_NO_HOST},
|
||||
{CURLUPART_ZONEID, "eth0", NULL, CURLUE_NO_ZONEID},
|
||||
{CURLUPART_PORT, "1234", NULL, CURLUE_NO_PORT},
|
||||
{CURLUPART_PATH, "/hello", "/", CURLUE_OK},
|
||||
{CURLUPART_QUERY, "a=b", NULL, CURLUE_NO_QUERY},
|
||||
{CURLUPART_FRAGMENT, "anchor", NULL, CURLUE_NO_FRAGMENT},
|
||||
{CURLUPART_URL, NULL, NULL, CURLUE_OK},
|
||||
static const struct clearurlcase clear_url_list[] = {
|
||||
{ CURLUPART_SCHEME, "http", NULL, CURLUE_NO_SCHEME },
|
||||
{ CURLUPART_USER, "user", NULL, CURLUE_NO_USER },
|
||||
{ CURLUPART_PASSWORD, "password", NULL, CURLUE_NO_PASSWORD },
|
||||
{ CURLUPART_OPTIONS, "options", NULL, CURLUE_NO_OPTIONS },
|
||||
{ CURLUPART_HOST, "host", NULL, CURLUE_NO_HOST },
|
||||
{ CURLUPART_ZONEID, "eth0", NULL, CURLUE_NO_ZONEID },
|
||||
{ CURLUPART_PORT, "1234", NULL, CURLUE_NO_PORT },
|
||||
{ CURLUPART_PATH, "/hello", "/", CURLUE_OK },
|
||||
{ CURLUPART_QUERY, "a=b", NULL, CURLUE_NO_QUERY },
|
||||
{ CURLUPART_FRAGMENT, "anchor", NULL, CURLUE_NO_FRAGMENT },
|
||||
{ CURLUPART_URL, NULL, NULL, CURLUE_OK },
|
||||
};
|
||||
|
||||
static int clear_url(void)
|
||||
@ -1935,7 +1935,7 @@ static int huge(void)
|
||||
memset(&bigpart[1], 'a', sizeof(bigpart) - 2);
|
||||
bigpart[sizeof(bigpart) - 1] = 0;
|
||||
|
||||
for(i = 0; i < 7; i++) {
|
||||
for(i = 0; i < 7; i++) {
|
||||
char *partp;
|
||||
curl_msnprintf(total, sizeof(total),
|
||||
"%s://%s:%s@%s/%s?%s#%s",
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
|
||||
#define CONN_NUM 3
|
||||
#define CONN_NUM 3
|
||||
#define TIME_BETWEEN_START_SECS 2
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@ -36,7 +36,7 @@ static CURLcode test_lib1597(const char *URL)
|
||||
CURL *curl = NULL;
|
||||
CURLcode res = CURLE_OK;
|
||||
curl_version_info_data *curlinfo;
|
||||
const char *const *proto;
|
||||
const char * const *proto;
|
||||
int n;
|
||||
int i;
|
||||
static CURLcode ok = CURLE_OK;
|
||||
@ -47,22 +47,22 @@ static CURLcode test_lib1597(const char *URL)
|
||||
static char protolist[1024];
|
||||
|
||||
static const struct pair prots[] = {
|
||||
{"goobar", &unsup},
|
||||
{"http ", &unsup},
|
||||
{" http", &unsup},
|
||||
{"http", &httpcode},
|
||||
{"http,", &httpcode},
|
||||
{"https,", &httpscode},
|
||||
{"https,http", &httpscode},
|
||||
{"http,http", &httpcode},
|
||||
{"HTTP,HTTP", &httpcode},
|
||||
{",HTTP,HTTP", &httpcode},
|
||||
{"http,http,ft", &unsup},
|
||||
{"", &bad},
|
||||
{",,", &bad},
|
||||
{protolist, &ok},
|
||||
{"all", &ok},
|
||||
{NULL, NULL},
|
||||
{ "goobar", &unsup },
|
||||
{ "http ", &unsup },
|
||||
{ " http", &unsup },
|
||||
{ "http", &httpcode },
|
||||
{ "http,", &httpcode },
|
||||
{ "https,", &httpscode },
|
||||
{ "https,http", &httpscode },
|
||||
{ "http,http", &httpcode },
|
||||
{ "HTTP,HTTP", &httpcode },
|
||||
{ ",HTTP,HTTP", &httpcode },
|
||||
{ "http,http,ft", &unsup },
|
||||
{ "", &bad },
|
||||
{ ",,", &bad },
|
||||
{ protolist, &ok },
|
||||
{ "all", &ok },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
(void)URL;
|
||||
|
||||
|
||||
@ -49,9 +49,7 @@ static CURLcode test_lib1911(const char *URL)
|
||||
|
||||
curl_mprintf("string length: %zu\n", strlen(testbuf));
|
||||
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
for(o = curl_easy_option_next(NULL); o; o = curl_easy_option_next(o)) {
|
||||
if(o->type == CURLOT_STRING) {
|
||||
CURLcode res;
|
||||
/*
|
||||
|
||||
@ -33,9 +33,7 @@ static CURLcode test_lib1912(const char *URL)
|
||||
int error = 0;
|
||||
#ifdef CURLINC_TYPECHECK_GCC_H
|
||||
const struct curl_easyoption *o;
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
for(o = curl_easy_option_next(NULL); o; o = curl_easy_option_next(o)) {
|
||||
/* Test for mismatch OR missing typecheck macros */
|
||||
if(curlcheck_long_option(o->id) !=
|
||||
(o->type == CURLOT_LONG || o->type == CURLOT_VALUES)) {
|
||||
|
||||
@ -97,7 +97,7 @@ static CURLcode test_lib1915(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl;
|
||||
struct state st = {0};
|
||||
struct state st = { 0 };
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
|
||||
@ -30,9 +30,7 @@ static CURLcode test_lib1918(const char *URL)
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
for(o = curl_easy_option_next(NULL);
|
||||
o;
|
||||
o = curl_easy_option_next(o)) {
|
||||
for(o = curl_easy_option_next(NULL); o; o = curl_easy_option_next(o)) {
|
||||
const struct curl_easyoption *ename =
|
||||
curl_easy_option_by_name(o->name);
|
||||
const struct curl_easyoption *eid =
|
||||
|
||||
@ -29,7 +29,7 @@ static CURLcode test_lib1938(const char *URL)
|
||||
CURLcode res = TEST_ERR_MAJOR_BAD;
|
||||
struct curl_slist *connect_to = NULL;
|
||||
struct curl_slist *list = NULL;
|
||||
unsigned char data[] = {0x70, 0x6f, 0x73, 0x74, 0, 0x44, 0x61, 0x74, 0x61};
|
||||
unsigned char data[] = { 0x70, 0x6f, 0x73, 0x74, 0, 0x44, 0x61, 0x74, 0x61 };
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
|
||||
@ -75,7 +75,7 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
static CURLcode test_lib2032(const char *URL) /* libntlmconnect */
|
||||
static CURLcode test_lib2032(const char *URL) /* libntlmconnect */
|
||||
{
|
||||
enum HandleState {
|
||||
ReadyForNewHandle,
|
||||
@ -175,10 +175,9 @@ static CURLcode test_lib2032(const char *URL) /* libntlmconnect */
|
||||
"handle (trying again)\n");
|
||||
continue;
|
||||
}
|
||||
state = num_handles < MAX_EASY_HANDLES ? ReadyForNewHandle
|
||||
: NoMoreHandles;
|
||||
curl_mfprintf(stderr, "%s:%d new state %d\n",
|
||||
__FILE__, __LINE__, state);
|
||||
state =
|
||||
num_handles < MAX_EASY_HANDLES ? ReadyForNewHandle : NoMoreHandles;
|
||||
curl_mfprintf(stderr, "%s:%d new state %d\n", __FILE__, __LINE__, state);
|
||||
}
|
||||
|
||||
multi_timeout(multi, &timeout);
|
||||
|
||||
@ -46,9 +46,7 @@ static size_t t2301_write_cb(char *b, size_t size, size_t nitems, void *p)
|
||||
unsigned char *buffer = (unsigned char *)b;
|
||||
size_t i;
|
||||
size_t sent;
|
||||
unsigned char pong[] = {
|
||||
0x8a, 0x0
|
||||
};
|
||||
unsigned char pong[] = { 0x8a, 0x0 };
|
||||
size_t incoming = nitems;
|
||||
curl_mfprintf(stderr, "Called CURLOPT_WRITEFUNCTION with %zu bytes: ",
|
||||
nitems);
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
static CURLcode test_lib2402(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
CURL *curl[NUM_HANDLES] = { 0 };
|
||||
int running;
|
||||
CURLM *multi = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
static CURLcode test_lib2404(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
CURL *curl[NUM_HANDLES] = { 0 };
|
||||
int running;
|
||||
CURLM *multi = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -41,22 +41,23 @@
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#define test_check(expected_fds) \
|
||||
if(res != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "test failed with code: %d\n", res); \
|
||||
goto test_cleanup; \
|
||||
} \
|
||||
else if(fd_count != expected_fds) { \
|
||||
#define test_check(expected_fds) \
|
||||
if(res != CURLE_OK) { \
|
||||
curl_mfprintf(stderr, "test failed with code: %d\n", res); \
|
||||
goto test_cleanup; \
|
||||
} \
|
||||
else if(fd_count != expected_fds) { \
|
||||
curl_mfprintf(stderr, "Max number of waitfds: %u not as expected: %u\n", \
|
||||
fd_count, expected_fds); \
|
||||
res = TEST_ERR_FAILURE; \
|
||||
goto test_cleanup; \
|
||||
fd_count, expected_fds); \
|
||||
res = TEST_ERR_FAILURE; \
|
||||
goto test_cleanup; \
|
||||
}
|
||||
|
||||
#define test_run_check(option, expected_fds) do { \
|
||||
res = test_run(URL, option, &fd_count); \
|
||||
test_check(expected_fds); \
|
||||
} while(0)
|
||||
#define test_run_check(option, expected_fds) \
|
||||
do { \
|
||||
res = test_run(URL, option, &fd_count); \
|
||||
test_check(expected_fds); \
|
||||
} while(0)
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
static CURLcode test_lib2502(const char *URL)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
CURL *curl[NUM_HANDLES] = { 0 };
|
||||
int running;
|
||||
CURLM *multi = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
#include "curl_threads.h"
|
||||
|
||||
#define THREAD_SIZE 16
|
||||
#define THREAD_SIZE 16
|
||||
#define PER_THREAD_SIZE 8
|
||||
|
||||
struct Ctx {
|
||||
|
||||
@ -76,8 +76,10 @@ static void custom_free(void *ptr)
|
||||
|
||||
static CURLcode test_lib509(const char *URL)
|
||||
{
|
||||
static const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
|
||||
static const unsigned char a[] = {
|
||||
0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7
|
||||
};
|
||||
CURLcode res;
|
||||
CURL *curl;
|
||||
int asize;
|
||||
|
||||
@ -31,130 +31,130 @@ static CURLcode test_lib517(const char *URL)
|
||||
};
|
||||
|
||||
static const struct dcheck dates[] = {
|
||||
{"Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
|
||||
{"Sunday, 06-Nov-94 08:49:37 GMT", 784111777 },
|
||||
{"Sun Nov 6 08:49:37 1994", 784111777 },
|
||||
{"Sun Nov 6 8:49:37 1994", 784111777 },
|
||||
{"Sun Nov 6 8:9:37 1994", 784109377 },
|
||||
{"Sun Nov 6 008:09:37 1994", -1 },
|
||||
{"Nov Sun 6 8:9:7 1994", 784109347 },
|
||||
{"06 Nov 1994 08:49:37 GMT", 784111777 },
|
||||
{"06-Nov-94 08:49:37 GMT", 784111777 },
|
||||
{"Nov 6 08:49:37 1994", 784111777 },
|
||||
{"06 Nov 1994 08:49:37", 784111777 },
|
||||
{"06-Nov-94 08:49:37", 784111777 },
|
||||
{"1994 Nov 6 08:49:37", 784111777 },
|
||||
{"GMT 08:49:37 06-Nov-94 Sunday", 784111777 },
|
||||
{"94 6 Nov 08:49:37", 784111777 },
|
||||
{"1994 Nov 6", 784080000 },
|
||||
{"06-Nov-94", 784080000 },
|
||||
{"Sun Nov 6 94", 784080000 },
|
||||
{"1994.Nov.6", 784080000 },
|
||||
{"Sun/Nov/6/94/GMT", 784080000 },
|
||||
{"Sun, 06 Nov 1994 08:49:37 CET", 784108177 },
|
||||
{"06 Nov 1994 08:49:37 EST", 784129777 },
|
||||
{"Sun, 06 Nov 1994 08:49:37 UT", 784111777 },
|
||||
{"Sun, 12 Sep 2004 15:05:58 -0700", 1095026758 },
|
||||
{"Sat, 11 Sep 2004 21:32:11 +0200", 1094931131 },
|
||||
{"20040912 15:05:58 -0700", 1095026758 },
|
||||
{"20040911 +0200", 1094853600 },
|
||||
{"Thu, 01-Jan-1970 00:59:59 GMT", 3599 },
|
||||
{"Thu, 01-Jan-1970 01:00:00 GMT", 3600 },
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{"Thu, 19-Apr-2007 16:00:00 GMT", 1176998400 },
|
||||
{"Wed, 25 Apr 2007 21:02:13 GMT", 1177534933 },
|
||||
{"Thu, 19/Apr\\2007 16:00:00 GMT", 1176998400 },
|
||||
{"Fri, 1 Jan 2010 01:01:50 GMT", 1262307710 },
|
||||
{"Wednesday, 1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{", 1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{"1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{"1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{"Wed,18-Apr-07 22:50:12 GMT", 1176936612 },
|
||||
{"WillyWonka , 18-Apr-07 22:50:12 GMT", -1 },
|
||||
{"WillyWonka , 18-Apr-07 22:50:12", -1 },
|
||||
{"WillyWonka , 18-apr-07 22:50:12", -1 },
|
||||
{"Mon, 18-Apr-1977 22:50:13 GMT", 230251813 },
|
||||
{"Mon, 18-Apr-77 22:50:13 GMT", 230251813 },
|
||||
{"Sat, 15-Apr-17\"21:01:22\"GMT", 1492290082 },
|
||||
{"Partyday, 18- April-07 22:50:12", -1 },
|
||||
{"Partyday, 18 - Apri-07 22:50:12", -1 },
|
||||
{"Wednes, 1-Januar-2003 00:00:00 GMT", -1 },/* spellchecker:disable-line */
|
||||
{"Sat, 15-Apr-17 21:01:22", 1492290082 },
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT-2", 1492290082 },
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT BLAH", 1492290082 },
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT-0400", 1492290082 },
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", 1492290082 },
|
||||
{"Sat, 15-Apr-17 21:01:22 DST", -1 },
|
||||
{"Sat, 15-Apr-17 21:01:22 -0400", 1492304482 },
|
||||
{"Sat, 15-Apr-17 21:01:22 (hello there)", -1 },
|
||||
{"Sat, 15-Apr-17 21:01:22 11:22:33", -1 },
|
||||
{"Sat, 15-Apr-17 ::00 21:01:22", -1 },
|
||||
{"Sat, 15-Apr-17 boink:z 21:01:22", -1 },
|
||||
{"Sat, 15-Apr-17 91:22:33 21:01:22", -1 },
|
||||
{"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
|
||||
{"22:50:12 Thu Apr 18 2007 GMT", 1176936612 },
|
||||
{"Thu 22:50:12 Apr 18 2007 GMT", 1176936612 },
|
||||
{"Thu Apr 22:50:12 18 2007 GMT", 1176936612 },
|
||||
{"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
|
||||
{"Thu Apr 18 2007 22:50:12 GMT", 1176936612 },
|
||||
{"Thu Apr 18 2007 GMT 22:50:12", 1176936612 },
|
||||
{ "Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
|
||||
{ "Sunday, 06-Nov-94 08:49:37 GMT", 784111777 },
|
||||
{ "Sun Nov 6 08:49:37 1994", 784111777 },
|
||||
{ "Sun Nov 6 8:49:37 1994", 784111777 },
|
||||
{ "Sun Nov 6 8:9:37 1994", 784109377 },
|
||||
{ "Sun Nov 6 008:09:37 1994", -1 },
|
||||
{ "Nov Sun 6 8:9:7 1994", 784109347 },
|
||||
{ "06 Nov 1994 08:49:37 GMT", 784111777 },
|
||||
{ "06-Nov-94 08:49:37 GMT", 784111777 },
|
||||
{ "Nov 6 08:49:37 1994", 784111777 },
|
||||
{ "06 Nov 1994 08:49:37", 784111777 },
|
||||
{ "06-Nov-94 08:49:37", 784111777 },
|
||||
{ "1994 Nov 6 08:49:37", 784111777 },
|
||||
{ "GMT 08:49:37 06-Nov-94 Sunday", 784111777 },
|
||||
{ "94 6 Nov 08:49:37", 784111777 },
|
||||
{ "1994 Nov 6", 784080000 },
|
||||
{ "06-Nov-94", 784080000 },
|
||||
{ "Sun Nov 6 94", 784080000 },
|
||||
{ "1994.Nov.6", 784080000 },
|
||||
{ "Sun/Nov/6/94/GMT", 784080000 },
|
||||
{ "Sun, 06 Nov 1994 08:49:37 CET", 784108177 },
|
||||
{ "06 Nov 1994 08:49:37 EST", 784129777 },
|
||||
{ "Sun, 06 Nov 1994 08:49:37 UT", 784111777 },
|
||||
{ "Sun, 12 Sep 2004 15:05:58 -0700", 1095026758 },
|
||||
{ "Sat, 11 Sep 2004 21:32:11 +0200", 1094931131 },
|
||||
{ "20040912 15:05:58 -0700", 1095026758 },
|
||||
{ "20040911 +0200", 1094853600 },
|
||||
{ "Thu, 01-Jan-1970 00:59:59 GMT", 3599 },
|
||||
{ "Thu, 01-Jan-1970 01:00:00 GMT", 3600 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{ "Thu, 19-Apr-2007 16:00:00 GMT", 1176998400 },
|
||||
{ "Wed, 25 Apr 2007 21:02:13 GMT", 1177534933 },
|
||||
{ "Thu, 19/Apr\\2007 16:00:00 GMT", 1176998400 },
|
||||
{ "Fri, 1 Jan 2010 01:01:50 GMT", 1262307710 },
|
||||
{ "Wednesday, 1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{ ", 1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{ "1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{ "1-Jan-2003 00:00:00 GMT", 1041379200 },
|
||||
{ "Wed,18-Apr-07 22:50:12 GMT", 1176936612 },
|
||||
{ "WillyWonka , 18-Apr-07 22:50:12 GMT", -1 },
|
||||
{ "WillyWonka , 18-Apr-07 22:50:12", -1 },
|
||||
{ "WillyWonka , 18-apr-07 22:50:12", -1 },
|
||||
{ "Mon, 18-Apr-1977 22:50:13 GMT", 230251813 },
|
||||
{ "Mon, 18-Apr-77 22:50:13 GMT", 230251813 },
|
||||
{ "Sat, 15-Apr-17\"21:01:22\"GMT", 1492290082 },
|
||||
{ "Partyday, 18- April-07 22:50:12", -1 },
|
||||
{ "Partyday, 18 - Apri-07 22:50:12", -1 },
|
||||
{ "Wednes, 1-Januar-2003 00:00:00 GMT", -1 },
|
||||
{ "Sat, 15-Apr-17 21:01:22", 1492290082 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT-2", 1492290082 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT BLAH", 1492290082 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT-0400", 1492290082 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", 1492290082 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 DST", -1 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 -0400", 1492304482 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 (hello there)", -1 },
|
||||
{ "Sat, 15-Apr-17 21:01:22 11:22:33", -1 },
|
||||
{ "Sat, 15-Apr-17 ::00 21:01:22", -1 },
|
||||
{ "Sat, 15-Apr-17 boink:z 21:01:22", -1 },
|
||||
{ "Sat, 15-Apr-17 91:22:33 21:01:22", -1 },
|
||||
{ "Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
|
||||
{ "22:50:12 Thu Apr 18 2007 GMT", 1176936612 },
|
||||
{ "Thu 22:50:12 Apr 18 2007 GMT", 1176936612 },
|
||||
{ "Thu Apr 22:50:12 18 2007 GMT", 1176936612 },
|
||||
{ "Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
|
||||
{ "Thu Apr 18 2007 22:50:12 GMT", 1176936612 },
|
||||
{ "Thu Apr 18 2007 GMT 22:50:12", 1176936612 },
|
||||
|
||||
{"\"Thu Apr 18 22:50:12 2007 GMT\"", 1176936612 },
|
||||
{"-\"22:50:12 Thu Apr 18 2007 GMT\"", 1176936612 },
|
||||
{"*\"Thu 22:50:12 Apr 18 2007 GMT\"", 1176936612 },
|
||||
{";\"Thu Apr 22:50:12 18 2007 GMT\"", 1176936612 },
|
||||
{".\"Thu Apr 18 22:50:12 2007 GMT\"", 1176936612 },
|
||||
{"\"Thu Apr 18 2007 22:50:12 GMT\"", 1176936612 },
|
||||
{"\"Thu Apr 18 2007 GMT 22:50:12\"", 1176936612 },
|
||||
{ "\"Thu Apr 18 22:50:12 2007 GMT\"", 1176936612 },
|
||||
{ "-\"22:50:12 Thu Apr 18 2007 GMT\"", 1176936612 },
|
||||
{ "*\"Thu 22:50:12 Apr 18 2007 GMT\"", 1176936612 },
|
||||
{ ";\"Thu Apr 22:50:12 18 2007 GMT\"", 1176936612 },
|
||||
{ ".\"Thu Apr 18 22:50:12 2007 GMT\"", 1176936612 },
|
||||
{ "\"Thu Apr 18 2007 22:50:12 GMT\"", 1176936612 },
|
||||
{ "\"Thu Apr 18 2007 GMT 22:50:12\"", 1176936612 },
|
||||
|
||||
{"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{"15-Sat, Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{"15-Sat, Apr 21:01:22 GMT 17", 1492290082 },
|
||||
{"15-Sat, Apr 21:01:22 GMT 2017", 1492290082 },
|
||||
{"15 Apr 21:01:22 2017", 1492290082 },
|
||||
{"15 17 Apr 21:01:22", 1492290082 },
|
||||
{"Apr 15 17 21:01:22", 1492290082 },
|
||||
{"Apr 15 21:01:22 17", 1492290082 },
|
||||
{"2017 April 15 21:01:22", -1 },
|
||||
{"15 April 2017 21:01:22", -1 },
|
||||
{"98 April 17 21:01:22", -1 },
|
||||
{"Thu, 012-Aug-2008 20:49:07 GMT", 1218574147 },
|
||||
{"Thu, 999999999999-Aug-2007 20:49:07 GMT", -1 },
|
||||
{"Thu, 12-Aug-2007 20:61:99999999999 GMT", -1 },
|
||||
{"IAintNoDateFool", -1 },
|
||||
{"Thu Apr 18 22:50 2007 GMT", 1176936600 },
|
||||
{"20110623 12:34:56", 1308832496 },
|
||||
{"20110632 12:34:56", -1 },
|
||||
{"20110623 56:34:56", -1 },
|
||||
{"20111323 12:34:56", -1 },
|
||||
{"20110623 12:34:79", -1 },
|
||||
{"Wed, 31 Dec 2008 23:59:60 GMT", 1230768000 },
|
||||
{"Wed, 31 Dec 2008 23:59:61 GMT", -1 },
|
||||
{"Wed, 31 Dec 2008 24:00:00 GMT", -1 },
|
||||
{"Wed, 31 Dec 2008 23:60:59 GMT", -1 },
|
||||
{"20110623 12:3", 1308830580 },
|
||||
{"20110623 1:3", 1308790980 },
|
||||
{"20110623 1:30", 1308792600 },
|
||||
{"20110623 12:12:3", 1308831123 },
|
||||
{"20110623 01:12:3", 1308791523 },
|
||||
{"20110623 01:99:30", -1 },
|
||||
{"Thu, 01-Jan-1970 00:00:00 GMT", 0 },
|
||||
{"Thu, 31-Dec-1969 23:59:58 GMT", -2 },
|
||||
{"Thu, 31-Dec-1969 23:59:59 GMT", 0 }, /* avoids -1 ! */
|
||||
{ "Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{ "15-Sat, Apr-17 21:01:22 GMT", 1492290082 },
|
||||
{ "15-Sat, Apr 21:01:22 GMT 17", 1492290082 },
|
||||
{ "15-Sat, Apr 21:01:22 GMT 2017", 1492290082 },
|
||||
{ "15 Apr 21:01:22 2017", 1492290082 },
|
||||
{ "15 17 Apr 21:01:22", 1492290082 },
|
||||
{ "Apr 15 17 21:01:22", 1492290082 },
|
||||
{ "Apr 15 21:01:22 17", 1492290082 },
|
||||
{ "2017 April 15 21:01:22", -1 },
|
||||
{ "15 April 2017 21:01:22", -1 },
|
||||
{ "98 April 17 21:01:22", -1 },
|
||||
{ "Thu, 012-Aug-2008 20:49:07 GMT", 1218574147 },
|
||||
{ "Thu, 999999999999-Aug-2007 20:49:07 GMT", -1 },
|
||||
{ "Thu, 12-Aug-2007 20:61:99999999999 GMT", -1 },
|
||||
{ "IAintNoDateFool", -1 },
|
||||
{ "Thu Apr 18 22:50 2007 GMT", 1176936600 },
|
||||
{ "20110623 12:34:56", 1308832496 },
|
||||
{ "20110632 12:34:56", -1 },
|
||||
{ "20110623 56:34:56", -1 },
|
||||
{ "20111323 12:34:56", -1 },
|
||||
{ "20110623 12:34:79", -1 },
|
||||
{ "Wed, 31 Dec 2008 23:59:60 GMT", 1230768000 },
|
||||
{ "Wed, 31 Dec 2008 23:59:61 GMT", -1 },
|
||||
{ "Wed, 31 Dec 2008 24:00:00 GMT", -1 },
|
||||
{ "Wed, 31 Dec 2008 23:60:59 GMT", -1 },
|
||||
{ "20110623 12:3", 1308830580 },
|
||||
{ "20110623 1:3", 1308790980 },
|
||||
{ "20110623 1:30", 1308792600 },
|
||||
{ "20110623 12:12:3", 1308831123 },
|
||||
{ "20110623 01:12:3", 1308791523 },
|
||||
{ "20110623 01:99:30", -1 },
|
||||
{ "Thu, 01-Jan-1970 00:00:00 GMT", 0 },
|
||||
{ "Thu, 31-Dec-1969 23:59:58 GMT", -2 },
|
||||
{ "Thu, 31-Dec-1969 23:59:59 GMT", 0 }, /* avoids -1 ! */
|
||||
#if SIZEOF_TIME_T > 4
|
||||
{"Sun, 06 Nov 2044 08:49:37 GMT", (time_t)2362034977LL },
|
||||
{"Sun, 06 Nov 3144 08:49:37 GMT", 37074617377 },
|
||||
{ "Sun, 06 Nov 2044 08:49:37 GMT", (time_t)2362034977LL },
|
||||
{ "Sun, 06 Nov 3144 08:49:37 GMT", 37074617377 },
|
||||
#ifndef HAVE_TIME_T_UNSIGNED
|
||||
{"Sun, 06 Nov 1900 08:49:37 GMT", (time_t)-2182259423LL },
|
||||
{"Sun, 06 Nov 1800 08:49:37 GMT", -5337933023 },
|
||||
{"Thu, 01-Jan-1583 00:00:00 GMT", -12212553600 },
|
||||
{ "Sun, 06 Nov 1900 08:49:37 GMT", (time_t)-2182259423LL },
|
||||
{ "Sun, 06 Nov 1800 08:49:37 GMT", -5337933023 },
|
||||
{ "Thu, 01-Jan-1583 00:00:00 GMT", -12212553600 },
|
||||
#endif /* HAVE_TIME_T_UNSIGNED */
|
||||
{"Thu, 01-Jan-1499 00:00:00 GMT", -1 },
|
||||
{ "Thu, 01-Jan-1499 00:00:00 GMT", -1 },
|
||||
#else
|
||||
{"Sun, 06 Nov 2044 08:49:37 GMT", -1 },
|
||||
{ "Sun, 06 Nov 2044 08:49:37 GMT", -1 },
|
||||
#endif /* SIZEOF_TIME_T > 4 */
|
||||
#ifndef HAVE_TIME_T_UNSIGNED
|
||||
{"Sun, 06 Nov 1968 08:49:37 GMT", -36342623 },
|
||||
{ "Sun, 06 Nov 1968 08:49:37 GMT", -36342623 },
|
||||
#endif /* !HAVE_TIME_T_UNSIGNED */
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
|
||||
#define T518_SAFETY_MARGIN (16)
|
||||
|
||||
#define NUM_OPEN (FD_SETSIZE + 10)
|
||||
#define NUM_NEEDED (NUM_OPEN + T518_SAFETY_MARGIN)
|
||||
#define NUM_OPEN (FD_SETSIZE + 10)
|
||||
#define NUM_NEEDED (NUM_OPEN + T518_SAFETY_MARGIN)
|
||||
|
||||
#if defined(_WIN32) || defined(MSDOS)
|
||||
#define DEV_NULL "NUL"
|
||||
|
||||
@ -52,7 +52,6 @@ static void t530_msg(const char *msg)
|
||||
curl_mfprintf(stderr, "%s %s\n", t530_tag(), msg);
|
||||
}
|
||||
|
||||
|
||||
struct t530_Sockets {
|
||||
curl_socket_t *sockets;
|
||||
int count; /* number of sockets actually stored in array */
|
||||
@ -285,9 +284,9 @@ static CURLcode testone(const char *URL, int timer_fail_at, int socket_fail_at)
|
||||
CURLcode res = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
CURLM *multi = NULL;
|
||||
struct t530_ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
|
||||
struct t530_ReadWriteSockets sockets = { { NULL, 0, 0 }, { NULL, 0, 0 } };
|
||||
int success = 0;
|
||||
struct curltime timeout = {0};
|
||||
struct curltime timeout = { 0 };
|
||||
timeout.tv_sec = (time_t)-1;
|
||||
|
||||
/* set the limits */
|
||||
@ -328,7 +327,7 @@ static CURLcode testone(const char *URL, int timer_fail_at, int socket_fail_at)
|
||||
while(!t530_checkForCompletion(multi, &success)) {
|
||||
fd_set readSet, writeSet;
|
||||
curl_socket_t maxFd = 0;
|
||||
struct timeval tv = {0};
|
||||
struct timeval tv = { 0 };
|
||||
tv.tv_sec = 10;
|
||||
|
||||
FD_ZERO(&readSet);
|
||||
|
||||
@ -118,7 +118,7 @@ static int t537_test_rlimit(int keep_open)
|
||||
/* If the OS allows a HUGE number of open files, we do not run.
|
||||
* Modern debian sid reports a limit of 134217724 and this tests
|
||||
* takes minutes. */
|
||||
#define LIMIT_CAP (256 * 1024)
|
||||
#define LIMIT_CAP (256 * 1024)
|
||||
if(rl.rlim_cur > LIMIT_CAP) {
|
||||
curl_mfprintf(stderr, "soft limit above %ld, not running\n",
|
||||
(long)LIMIT_CAP);
|
||||
|
||||
@ -28,9 +28,10 @@
|
||||
static CURLcode test_lib543(const char *URL)
|
||||
{
|
||||
static const unsigned char a[] = {
|
||||
0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
|
||||
0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
|
||||
0x1d, 0x57, 0xe1};
|
||||
0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
|
||||
0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
|
||||
0x1d, 0x57, 0xe1
|
||||
};
|
||||
|
||||
CURL *curl;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
@ -32,7 +32,8 @@ static CURLcode test_lib544(const char *URL)
|
||||
'T', 'h', 'i', 's', '\0', ' ', 'i', 's', ' ', 't', 'e', 's', 't', ' ',
|
||||
'b', 'i', 'n', 'a', 'r', 'y', ' ', 'd', 'a', 't', 'a', ' ',
|
||||
'w', 'i', 't', 'h', ' ', 'a', 'n', ' ',
|
||||
'e', 'm', 'b', 'e', 'd', 'd', 'e', 'd', ' ', 'N', 'U', 'L'};
|
||||
'e', 'm', 'b', 'e', 'd', 'd', 'e', 'd', ' ', 'N', 'U', 'L'
|
||||
};
|
||||
|
||||
char teststring[sizeof(teststring_init)];
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ static size_t myreadfunc(char *ptr, size_t size, size_t nmemb, void *stream)
|
||||
return size;
|
||||
}
|
||||
|
||||
#define NUM_HEADERS 8
|
||||
#define NUM_HEADERS 8
|
||||
#define SIZE_HEADERS 5000
|
||||
|
||||
static CURLcode test_lib553(const char *URL)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user