mirror of
https://github.com/curl/curl.git
synced 2026-08-13 22:20:55 +03:00
tidy-up: miscellaneous
- apply more clang-format. - lib/version: use `CURL_ARRAYSIZE()`. - INSTALL-CMAKE.md: sync-up an option description with others. - examples: delete unused main args. - examples/ftpgetinfo: document `_CRT_SECURE_NO_WARNINGS` symbol. - delete remaining stray duplicate lines. - acinclude.m4: drop an unnecessary x-hack. - vtls/mbedtls: join a URL split into two lines. - src/tool_cb_see: add parentheses around macro expressions. - src/tool_operate: move literals to the right side of comparisons. - libtests: sync up fopen/fstat error messages between tests. - curl_setup.h: replace `if ! defined __LP64` with `ifndef __LP64`. I assume it makes no difference on Tandem systems, as the latter form is already used in `include/curl/system.h`. Closes #20018
This commit is contained in:
parent
cd9da30e76
commit
308c347c8b
53 changed files with 988 additions and 1005 deletions
|
|
@ -1168,7 +1168,7 @@ AS_HELP_STRING([--without-ca-path], [Do not use a default CA path]),
|
||||||
dnl --with-ca-path given
|
dnl --with-ca-path given
|
||||||
capath="$want_capath"
|
capath="$want_capath"
|
||||||
ca="no"
|
ca="no"
|
||||||
elif test "x$ca_native" != "xno"; then
|
elif test "$ca_native" != "no"; then
|
||||||
# native ca configured, do not look further
|
# native ca configured, do not look further
|
||||||
ca="no"
|
ca="no"
|
||||||
capath="no"
|
capath="no"
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ Details via CMake
|
||||||
- `OPENSSL_USE_STATIC_LIBS`: Look for static OpenSSL libraries.
|
- `OPENSSL_USE_STATIC_LIBS`: Look for static OpenSSL libraries.
|
||||||
- `ZLIB_INCLUDE_DIR`: Absolute path to zlib include directory.
|
- `ZLIB_INCLUDE_DIR`: Absolute path to zlib include directory.
|
||||||
- `ZLIB_LIBRARY`: Absolute path to `zlib` library.
|
- `ZLIB_LIBRARY`: Absolute path to `zlib` library.
|
||||||
- `ZLIB_USE_STATIC_LIBS`: Look for static ZLIB library (requires CMake v3.24).
|
- `ZLIB_USE_STATIC_LIBS`: Look for static `zlib` library (requires CMake v3.24).
|
||||||
|
|
||||||
## Dependency options (tools)
|
## Dependency options (tools)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -451,15 +451,13 @@ void sigint_handler(int signo)
|
||||||
g_should_exit_ = 1;
|
g_should_exit_ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
struct GlobalInfo g;
|
struct GlobalInfo g;
|
||||||
struct itimerspec its;
|
struct itimerspec its;
|
||||||
struct epoll_event ev;
|
struct epoll_event ev;
|
||||||
struct epoll_event events[10];
|
struct epoll_event events[10];
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
|
|
||||||
result = curl_global_init(CURL_GLOBAL_ALL);
|
result = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if(result)
|
if(result)
|
||||||
|
|
|
||||||
|
|
@ -410,12 +410,10 @@ static int init_fifo(struct GlobalInfo *g)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
struct GlobalInfo g;
|
struct GlobalInfo g;
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
|
|
||||||
result = curl_global_init(CURL_GLOBAL_ALL);
|
result = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if(result)
|
if(result)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS /* for fopen() */
|
#define _CRT_SECURE_NO_WARNINGS /* for ctime(), fopen() */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -419,12 +419,10 @@ static void clean_fifo(struct GlobalInfo *g)
|
||||||
unlink(fifo);
|
unlink(fifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
struct GlobalInfo g;
|
struct GlobalInfo g;
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
|
|
||||||
result = curl_global_init(CURL_GLOBAL_ALL);
|
result = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if(result)
|
if(result)
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
/* A list of connections to the same destination. */
|
/* A list of connections to the same destination. */
|
||||||
struct cpool_bundle {
|
struct cpool_bundle {
|
||||||
struct Curl_llist conns; /* connections in the bundle */
|
struct Curl_llist conns; /* connections in the bundle */
|
||||||
|
|
@ -167,7 +166,6 @@ static struct cpool_bundle *cpool_find_bundle(struct cpool *cpool,
|
||||||
conn->destination, strlen(conn->destination) + 1);
|
conn->destination, strlen(conn->destination) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void cpool_remove_bundle(struct cpool *cpool,
|
static void cpool_remove_bundle(struct cpool *cpool,
|
||||||
struct cpool_bundle *bundle)
|
struct cpool_bundle *bundle)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -287,8 +287,10 @@ static const struct Curl_cwtype deflate_encoding = {
|
||||||
sizeof(struct zlib_writer)
|
sizeof(struct zlib_writer)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gzip handler.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Gzip handler. */
|
|
||||||
static CURLcode gzip_do_init(struct Curl_easy *data,
|
static CURLcode gzip_do_init(struct Curl_easy *data,
|
||||||
struct Curl_cwriter *writer)
|
struct Curl_cwriter *writer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef __TANDEM /* for ns*-tandem-nsk systems */
|
#ifdef __TANDEM /* for ns*-tandem-nsk systems */
|
||||||
# if ! defined __LP64
|
# ifndef __LP64
|
||||||
# include <floss.h> /* FLOSS is only used for 32-bit builds. */
|
# include <floss.h> /* FLOSS is only used for 32-bit builds. */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -919,7 +919,10 @@ extern curl_calloc_callback Curl_ccalloc;
|
||||||
* This macro also assigns NULL to given pointer when free'd.
|
* This macro also assigns NULL to given pointer when free'd.
|
||||||
*/
|
*/
|
||||||
#define Curl_safefree(ptr) \
|
#define Curl_safefree(ptr) \
|
||||||
do { curlx_free(ptr); (ptr) = NULL;} while(0)
|
do { \
|
||||||
|
curlx_free(ptr); \
|
||||||
|
(ptr) = NULL; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#include <curl/curl.h> /* for CURL_EXTERN, mprintf.h */
|
#include <curl/curl.h> /* for CURL_EXTERN, mprintf.h */
|
||||||
|
|
||||||
|
|
@ -1002,14 +1005,12 @@ CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd,
|
||||||
|
|
||||||
/* FILE functions */
|
/* FILE functions */
|
||||||
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
|
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
|
||||||
CURL_EXTERN ALLOC_FUNC
|
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fopen(const char *file, const char *mode,
|
||||||
FILE *curl_dbg_fopen(const char *file, const char *mode,
|
|
||||||
int line, const char *source);
|
int line, const char *source);
|
||||||
CURL_EXTERN ALLOC_FUNC
|
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_freopen(const char *file,
|
||||||
FILE *curl_dbg_freopen(const char *file, const char *mode, FILE *fh,
|
const char *mode, FILE *fh,
|
||||||
int line, const char *source);
|
int line, const char *source);
|
||||||
CURL_EXTERN ALLOC_FUNC
|
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
||||||
FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
|
||||||
int line, const char *source);
|
int line, const char *source);
|
||||||
|
|
||||||
#define sclose(sockfd) curl_dbg_sclose(sockfd, __LINE__, __FILE__)
|
#define sclose(sockfd) curl_dbg_sclose(sockfd, __LINE__, __FILE__)
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,6 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!ev->msbump && ev->ms >= 0) {
|
if(!ev->msbump && ev->ms >= 0) {
|
||||||
/* If nothing updated the timeout, we decrease it by the spent time.
|
/* If nothing updated the timeout, we decrease it by the spent time.
|
||||||
* If it was updated, it has the new timeout time stored already.
|
* If it was updated, it has the new timeout time stored already.
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif /* !__INTEL_COMPILER */
|
||||||
|
|
||||||
static CURL_INLINE void curl_simple_lock_lock(curl_simple_lock *lock)
|
static CURL_INLINE void curl_simple_lock_lock(curl_simple_lock *lock)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3685,7 +3685,6 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* ftp_perform()
|
* ftp_perform()
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ struct IMAP {
|
||||||
BIT(uidvalidity_set);
|
BIT(uidvalidity_set);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Local API functions */
|
/* Local API functions */
|
||||||
static CURLcode imap_regular_transfer(struct Curl_easy *data,
|
static CURLcode imap_regular_transfer(struct Curl_easy *data,
|
||||||
struct IMAP *imap,
|
struct IMAP *imap,
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,6 @@ static char *Curl_basename(char *path)
|
||||||
#define basename(x) Curl_basename(x)
|
#define basename(x) Curl_basename(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Set readback state. */
|
/* Set readback state. */
|
||||||
static void mimesetstate(struct mime_state *state,
|
static void mimesetstate(struct mime_state *state,
|
||||||
enum mimestate tok, void *ptr)
|
enum mimestate tok, void *ptr)
|
||||||
|
|
@ -272,7 +271,6 @@ static void mimesetstate(struct mime_state *state,
|
||||||
state->offset = 0;
|
state->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Escape header string into allocated memory. */
|
/* Escape header string into allocated memory. */
|
||||||
static char *escape_string(struct Curl_easy *data,
|
static char *escape_string(struct Curl_easy *data,
|
||||||
const char *src, enum mimestrategy strategy)
|
const char *src, enum mimestrategy strategy)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@
|
||||||
#include "bufref.h"
|
#include "bufref.h"
|
||||||
#include "curlx/strparse.h"
|
#include "curlx/strparse.h"
|
||||||
|
|
||||||
|
|
||||||
/* meta key for storing protocol meta at easy handle */
|
/* meta key for storing protocol meta at easy handle */
|
||||||
#define CURL_META_RTSP_EASY "meta:proto:rtsp:easy"
|
#define CURL_META_RTSP_EASY "meta:proto:rtsp:easy"
|
||||||
/* meta key for storing protocol meta at connection */
|
/* meta key for storing protocol meta at connection */
|
||||||
|
|
@ -72,7 +71,6 @@ struct RTSP {
|
||||||
long CSeq_recv; /* CSeq received */
|
long CSeq_recv; /* CSeq received */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define RTP_PKT_LENGTH(p) ((((unsigned int)((unsigned char)((p)[2]))) << 8) | \
|
#define RTP_PKT_LENGTH(p) ((((unsigned int)((unsigned char)((p)[2]))) << 8) | \
|
||||||
((unsigned int)((unsigned char)((p)[3]))))
|
((unsigned int)((unsigned char)((p)[3]))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1703,7 +1703,6 @@ static CURLcode smtp_regular_transfer(struct Curl_easy *data,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void smtp_easy_dtor(void *key, size_t klen, void *entry)
|
static void smtp_easy_dtor(void *key, size_t klen, void *entry)
|
||||||
{
|
{
|
||||||
struct SMTP *smtp = entry;
|
struct SMTP *smtp = entry;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@
|
||||||
#define CURL_EMPTY 0
|
#define CURL_EMPTY 0
|
||||||
#define CURL_OPPOSITE 1
|
#define CURL_OPPOSITE 1
|
||||||
|
|
||||||
|
|
||||||
/* meta key for storing protocol meta at easy handle */
|
/* meta key for storing protocol meta at easy handle */
|
||||||
#define CURL_META_TELNET_EASY "meta:proto:telnet:easy"
|
#define CURL_META_TELNET_EASY "meta:proto:telnet:easy"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,6 @@ struct tftp_conn {
|
||||||
BIT(remote_pinned);
|
BIT(remote_pinned);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static CURLcode tftp_rx(struct tftp_conn *state, tftp_event_t event);
|
static CURLcode tftp_rx(struct tftp_conn *state, tftp_event_t event);
|
||||||
static CURLcode tftp_tx(struct tftp_conn *state, tftp_event_t event);
|
static CURLcode tftp_tx(struct tftp_conn *state, tftp_event_t event);
|
||||||
|
|
@ -162,7 +161,6 @@ static CURLcode tftp_translate_code(tftp_error_t error);
|
||||||
/*
|
/*
|
||||||
* TFTP protocol handler.
|
* TFTP protocol handler.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const struct Curl_handler Curl_handler_tftp = {
|
const struct Curl_handler Curl_handler_tftp = {
|
||||||
"tftp", /* scheme */
|
"tftp", /* scheme */
|
||||||
tftp_setup_connection, /* setup_connection */
|
tftp_setup_connection, /* setup_connection */
|
||||||
|
|
|
||||||
|
|
@ -551,9 +551,7 @@ static const struct feat features_table[] = {
|
||||||
{NULL, NULL, 0}
|
{NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *feature_names[sizeof(features_table) /
|
static const char *feature_names[CURL_ARRAYSIZE(features_table)] = { NULL };
|
||||||
sizeof(features_table[0])] = {NULL};
|
|
||||||
|
|
||||||
|
|
||||||
static curl_version_info_data version_info = {
|
static curl_version_info_data version_info = {
|
||||||
CURLVERSION_NOW,
|
CURLVERSION_NOW,
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@
|
||||||
#define NW_CHUNK_SIZE (64 * 1024)
|
#define NW_CHUNK_SIZE (64 * 1024)
|
||||||
#define NW_SEND_CHUNKS 1
|
#define NW_SEND_CHUNKS 1
|
||||||
|
|
||||||
|
|
||||||
int Curl_vquic_init(void)
|
int Curl_vquic_init(void)
|
||||||
{
|
{
|
||||||
#if defined(USE_NGTCP2) && defined(OPENSSL_QUIC_API2)
|
#if defined(USE_NGTCP2) && defined(OPENSSL_QUIC_API2)
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,6 @@ static const char *myssh_statename(sshstate state)
|
||||||
#define myssh_statename(x) ""
|
#define myssh_statename(x) ""
|
||||||
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
|
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
|
||||||
|
|
||||||
|
|
||||||
#define myssh_to(x, y, z) myssh_set_state(x, y, z)
|
#define myssh_to(x, y, z) myssh_set_state(x, y, z)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ const struct Curl_handler Curl_handler_scp = {
|
||||||
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SFTP protocol handler.
|
* SFTP protocol handler.
|
||||||
*/
|
*/
|
||||||
|
|
@ -353,7 +352,6 @@ static const char *myssh_statename(sshstate state)
|
||||||
#define myssh_statename(x) ""
|
#define myssh_statename(x) ""
|
||||||
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
|
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
|
||||||
|
|
||||||
|
|
||||||
#define myssh_state(x, y, z) myssh_set_state(x, y, z)
|
#define myssh_state(x, y, z) myssh_set_state(x, y, z)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -229,8 +229,8 @@ static const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_fr = {
|
||||||
1024, /* RSA min key len */
|
1024, /* RSA min key len */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* See https://web.archive.org/web/20200921194007/tls.mbed.org/discussions/
|
/* See:
|
||||||
generic/howto-determine-exact-buffer-len-for-mbedtls_pk_write_pubkey_der
|
* https://web.archive.org/web/20200921194007/tls.mbed.org/discussions/generic/howto-determine-exact-buffer-len-for-mbedtls_pk_write_pubkey_der
|
||||||
*/
|
*/
|
||||||
#define RSA_PUB_DER_MAX_BYTES (38 + 2 * MBEDTLS_MPI_MAX_SIZE)
|
#define RSA_PUB_DER_MAX_BYTES (38 + 2 * MBEDTLS_MPI_MAX_SIZE)
|
||||||
#define ECP_PUB_DER_MAX_BYTES (30 + 2 * MBEDTLS_ECP_MAX_BYTES)
|
#define ECP_PUB_DER_MAX_BYTES (30 + 2 * MBEDTLS_ECP_MAX_BYTES)
|
||||||
|
|
|
||||||
|
|
@ -1443,7 +1443,6 @@ fail:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static CURLcode client_cert(struct Curl_easy *data,
|
static CURLcode client_cert(struct Curl_easy *data,
|
||||||
SSL_CTX* ctx,
|
SSL_CTX* ctx,
|
||||||
char *cert_file,
|
char *cert_file,
|
||||||
|
|
@ -3629,7 +3628,6 @@ static CURLcode ossl_init_ssl(struct ossl_ctx *octx,
|
||||||
alpns_requested, sess_reuse_cb);
|
alpns_requested, sess_reuse_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static CURLcode ossl_init_method(struct Curl_cfilter *cf,
|
static CURLcode ossl_init_method(struct Curl_cfilter *cf,
|
||||||
struct Curl_easy *data,
|
struct Curl_easy *data,
|
||||||
struct ssl_peer *peer,
|
struct ssl_peer *peer,
|
||||||
|
|
@ -4669,7 +4667,6 @@ out:
|
||||||
}
|
}
|
||||||
#endif /* ! CURL_DISABLE_VERBOSE_STRINGS */
|
#endif /* ! CURL_DISABLE_VERBOSE_STRINGS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_APPLE_SECTRUST
|
#ifdef USE_APPLE_SECTRUST
|
||||||
struct ossl_certs_ctx {
|
struct ossl_certs_ctx {
|
||||||
STACK_OF(X509) *sk;
|
STACK_OF(X509) *sk;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
#include <wolfssl/options.h>
|
#include <wolfssl/options.h>
|
||||||
#include <wolfssl/version.h>
|
#include <wolfssl/version.h>
|
||||||
|
|
||||||
|
|
||||||
#if LIBWOLFSSL_VERSION_HEX < 0x03004006 /* wolfSSL 3.4.6 (2015) */
|
#if LIBWOLFSSL_VERSION_HEX < 0x03004006 /* wolfSSL 3.4.6 (2015) */
|
||||||
#error "wolfSSL version should be at least 3.4.6"
|
#error "wolfSSL version should be at least 3.4.6"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@
|
||||||
/* #define CURL_ASN1_CHARACTER_STRING 29 */
|
/* #define CURL_ASN1_CHARACTER_STRING 29 */
|
||||||
#define CURL_ASN1_BMP_STRING 30
|
#define CURL_ASN1_BMP_STRING 30
|
||||||
|
|
||||||
|
|
||||||
#ifdef WANT_EXTRACT_CERTINFO
|
#ifdef WANT_EXTRACT_CERTINFO
|
||||||
/* ASN.1 OID table entry. */
|
/* ASN.1 OID table entry. */
|
||||||
struct Curl_OID {
|
struct Curl_OID {
|
||||||
|
|
|
||||||
2
lib/ws.c
2
lib/ws.c
|
|
@ -43,7 +43,6 @@
|
||||||
#include "curlx/strparse.h"
|
#include "curlx/strparse.h"
|
||||||
#include "curlx/warnless.h"
|
#include "curlx/warnless.h"
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
RFC 6455 Section 5.2
|
RFC 6455 Section 5.2
|
||||||
|
|
||||||
|
|
@ -770,7 +769,6 @@ static const struct Curl_cwtype ws_cw_decode = {
|
||||||
sizeof(struct ws_cw_ctx)
|
sizeof(struct ws_cw_ctx)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data,
|
static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data,
|
||||||
const char *msg)
|
const char *msg)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRERROR_R], [
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
|
dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Checks if the preprocessor _REENTRANT definition
|
dnl Checks if the preprocessor _REENTRANT definition
|
||||||
|
|
|
||||||
|
|
@ -229,8 +229,7 @@ int tool_progress_cb(void *clientp,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void progressbarinit(struct ProgressData *bar,
|
void progressbarinit(struct ProgressData *bar, struct OperationConfig *config)
|
||||||
struct OperationConfig *config)
|
|
||||||
{
|
{
|
||||||
memset(bar, 0, sizeof(struct ProgressData));
|
memset(bar, 0, sizeof(struct ProgressData));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ struct ProgressData {
|
||||||
|
|
||||||
struct OperationConfig;
|
struct OperationConfig;
|
||||||
|
|
||||||
void progressbarinit(struct ProgressData *bar,
|
void progressbarinit(struct ProgressData *bar, struct OperationConfig *config);
|
||||||
struct OperationConfig *config);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** callback for CURLOPT_PROGRESSFUNCTION
|
** callback for CURLOPT_PROGRESSFUNCTION
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
|
||||||
both represent the same value. Maximum offset used here when we lseek
|
both represent the same value. Maximum offset used here when we lseek
|
||||||
using a 'long' data type offset */
|
using a 'long' data type offset */
|
||||||
|
|
||||||
#define OUR_MAX_SEEK_L 2147483647L - 1L
|
#define OUR_MAX_SEEK_L (2147483647L - 1L)
|
||||||
#define OUR_MAX_SEEK_O 0x7FFFFFFF - 0x1
|
#define OUR_MAX_SEEK_O (0x7FFFFFFF - 0x1)
|
||||||
|
|
||||||
/* The offset check following here is only interesting if curl_off_t is
|
/* The offset check following here is only interesting if curl_off_t is
|
||||||
larger than off_t and we are not using the Win32 large file support
|
larger than off_t and we are not using the Win32 large file support
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ int getfiletime(const char *filename, curl_off_t *stamp)
|
||||||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
|
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
|
||||||
|
|
||||||
hfile = CreateFile(tchar_filename, FILE_READ_ATTRIBUTES,
|
hfile = CreateFile(tchar_filename, FILE_READ_ATTRIBUTES,
|
||||||
(FILE_SHARE_READ | FILE_SHARE_WRITE |
|
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
|
||||||
FILE_SHARE_DELETE),
|
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
NULL, OPEN_EXISTING, 0, NULL);
|
||||||
curlx_free(tchar_filename);
|
curlx_free(tchar_filename);
|
||||||
if(hfile != INVALID_HANDLE_VALUE) {
|
if(hfile != INVALID_HANDLE_VALUE) {
|
||||||
|
|
@ -110,8 +109,7 @@ void setfiletime(curl_off_t filetime, const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
hfile = CreateFile(tchar_filename, FILE_WRITE_ATTRIBUTES,
|
hfile = CreateFile(tchar_filename, FILE_WRITE_ATTRIBUTES,
|
||||||
(FILE_SHARE_READ | FILE_SHARE_WRITE |
|
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
|
||||||
FILE_SHARE_DELETE),
|
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
NULL, OPEN_EXISTING, 0, NULL);
|
||||||
curlx_free(tchar_filename);
|
curlx_free(tchar_filename);
|
||||||
if(hfile != INVALID_HANDLE_VALUE) {
|
if(hfile != INVALID_HANDLE_VALUE) {
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,10 @@
|
||||||
#define NOTE_PREFIX "Note: "
|
#define NOTE_PREFIX "Note: "
|
||||||
#define ERROR_PREFIX "curl: "
|
#define ERROR_PREFIX "curl: "
|
||||||
|
|
||||||
static void voutf(const char *prefix,
|
static void voutf(const char *prefix, const char *fmt, va_list ap)
|
||||||
const char *fmt,
|
CURL_PRINTF(2, 0);
|
||||||
va_list ap) CURL_PRINTF(2, 0);
|
|
||||||
|
|
||||||
static void voutf(const char *prefix,
|
static void voutf(const char *prefix, const char *fmt, va_list ap)
|
||||||
const char *fmt,
|
|
||||||
va_list ap)
|
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
|
||||||
|
|
@ -377,21 +377,21 @@ static CURLcode retrycheck(struct OperationConfig *config,
|
||||||
RETRY_FTP,
|
RETRY_FTP,
|
||||||
RETRY_LAST /* not used */
|
RETRY_LAST /* not used */
|
||||||
} retry = RETRY_NO;
|
} retry = RETRY_NO;
|
||||||
if((CURLE_OPERATION_TIMEDOUT == result) ||
|
if((result == CURLE_OPERATION_TIMEDOUT) ||
|
||||||
(CURLE_COULDNT_RESOLVE_HOST == result) ||
|
(result == CURLE_COULDNT_RESOLVE_HOST) ||
|
||||||
(CURLE_COULDNT_RESOLVE_PROXY == result) ||
|
(result == CURLE_COULDNT_RESOLVE_PROXY) ||
|
||||||
(CURLE_FTP_ACCEPT_TIMEOUT == result))
|
(result == CURLE_FTP_ACCEPT_TIMEOUT))
|
||||||
/* retry timeout always */
|
/* retry timeout always */
|
||||||
retry = RETRY_TIMEOUT;
|
retry = RETRY_TIMEOUT;
|
||||||
else if(config->retry_connrefused &&
|
else if(config->retry_connrefused &&
|
||||||
(CURLE_COULDNT_CONNECT == result)) {
|
(result == CURLE_COULDNT_CONNECT)) {
|
||||||
long oserrno = 0;
|
long oserrno = 0;
|
||||||
curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
|
curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
|
||||||
if(SOCKECONNREFUSED == oserrno)
|
if(SOCKECONNREFUSED == oserrno)
|
||||||
retry = RETRY_CONNREFUSED;
|
retry = RETRY_CONNREFUSED;
|
||||||
}
|
}
|
||||||
else if((CURLE_OK == result) ||
|
else if((result == CURLE_OK) ||
|
||||||
(config->fail && (CURLE_HTTP_RETURNED_ERROR == result))) {
|
(config->fail && (result == CURLE_HTTP_RETURNED_ERROR))) {
|
||||||
/* If it returned OK. _or_ failonerror was enabled and it
|
/* If it returned OK. _or_ failonerror was enabled and it
|
||||||
returned due to such an error, check for HTTP transient
|
returned due to such an error, check for HTTP transient
|
||||||
errors to retry on. */
|
errors to retry on. */
|
||||||
|
|
|
||||||
|
|
@ -306,10 +306,18 @@ ParameterError secs2ms(long *valp, const char *str)
|
||||||
{
|
{
|
||||||
curl_off_t secs;
|
curl_off_t secs;
|
||||||
long ms = 0;
|
long ms = 0;
|
||||||
const unsigned int digs[] = { 1, 10, 100, 1000, 10000, 100000,
|
const unsigned int digs[] = {
|
||||||
1000000, 10000000, 100000000 };
|
1,
|
||||||
if(!str ||
|
10,
|
||||||
curlx_str_number(&str, &secs, LONG_MAX / 1000 - 1))
|
100,
|
||||||
|
1000,
|
||||||
|
10000,
|
||||||
|
100000,
|
||||||
|
1000000,
|
||||||
|
10000000,
|
||||||
|
100000000
|
||||||
|
};
|
||||||
|
if(!str || curlx_str_number(&str, &secs, LONG_MAX / 1000 - 1))
|
||||||
return PARAM_BAD_NUMERIC;
|
return PARAM_BAD_NUMERIC;
|
||||||
if(!curlx_str_single(&str, '.')) {
|
if(!curlx_str_single(&str, '.')) {
|
||||||
curl_off_t fracs;
|
curl_off_t fracs;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@
|
||||||
|
|
||||||
Return 0 on success, non-zero on error.
|
Return 0 on success, non-zero on error.
|
||||||
*/
|
*/
|
||||||
int jsonquoted(const char *in, size_t len,
|
int jsonquoted(const char *in, size_t len, struct dynbuf *out, bool lowercase)
|
||||||
struct dynbuf *out, bool lowercase)
|
|
||||||
{
|
{
|
||||||
const unsigned char *i = (const unsigned char *)in;
|
const unsigned char *i = (const unsigned char *)in;
|
||||||
const unsigned char *in_end = &i[len];
|
const unsigned char *in_end = &i[len];
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
#include "tool_writeout.h"
|
#include "tool_writeout.h"
|
||||||
|
|
||||||
int jsonquoted(const char *in, size_t len,
|
int jsonquoted(const char *in, size_t len, struct dynbuf *out, bool lowercase);
|
||||||
struct dynbuf *out, bool lowercase);
|
|
||||||
|
|
||||||
void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
||||||
size_t nentries,
|
size_t nentries,
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ static CURLcode test_lib505(const char *URL)
|
||||||
|
|
||||||
hd_src = curlx_fopen(libtest_arg2, "rb");
|
hd_src = curlx_fopen(libtest_arg2, "rb");
|
||||||
if(!hd_src) {
|
if(!hd_src) {
|
||||||
curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
|
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||||
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
|
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ static CURLcode test_lib525(const char *URL)
|
||||||
|
|
||||||
hd_src = curlx_fopen(libtest_arg2, "rb");
|
hd_src = curlx_fopen(libtest_arg2, "rb");
|
||||||
if(!hd_src) {
|
if(!hd_src) {
|
||||||
curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
|
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||||
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
return TEST_ERR_FOPEN;
|
return TEST_ERR_FOPEN;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ static CURLcode test_lib541(const char *URL)
|
||||||
|
|
||||||
hd_src = curlx_fopen(libtest_arg2, "rb");
|
hd_src = curlx_fopen(libtest_arg2, "rb");
|
||||||
if(!hd_src) {
|
if(!hd_src) {
|
||||||
curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
|
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||||
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
|
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ static CURLcode test_lib568(const char *URL)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
|
char errbuf[STRERROR_LEN];
|
||||||
int sdp;
|
int sdp;
|
||||||
FILE *sdpf = NULL;
|
FILE *sdpf = NULL;
|
||||||
struct_stat file_info;
|
struct_stat file_info;
|
||||||
|
|
@ -67,7 +68,9 @@ static CURLcode test_lib568(const char *URL)
|
||||||
|
|
||||||
sdp = curlx_open(libtest_arg2, O_RDONLY);
|
sdp = curlx_open(libtest_arg2, O_RDONLY);
|
||||||
if(sdp == -1) {
|
if(sdp == -1) {
|
||||||
curl_mfprintf(stderr, "cannot open %s\n", libtest_arg2);
|
curl_mfprintf(stderr, "open() failed with error (%d) %s\n",
|
||||||
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
result = TEST_ERR_MAJOR_BAD;
|
result = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +79,9 @@ static CURLcode test_lib568(const char *URL)
|
||||||
|
|
||||||
sdpf = curlx_fopen(libtest_arg2, "rb");
|
sdpf = curlx_fopen(libtest_arg2, "rb");
|
||||||
if(!sdpf) {
|
if(!sdpf) {
|
||||||
curl_mfprintf(stderr, "cannot fopen %s\n", libtest_arg2);
|
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||||
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
result = TEST_ERR_MAJOR_BAD;
|
result = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ static CURLcode test_lib572(const char *URL)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
|
char errbuf[STRERROR_LEN];
|
||||||
int params;
|
int params;
|
||||||
FILE *paramsf = NULL;
|
FILE *paramsf = NULL;
|
||||||
struct_stat file_info;
|
struct_stat file_info;
|
||||||
|
|
@ -85,7 +86,9 @@ static CURLcode test_lib572(const char *URL)
|
||||||
/* PUT style GET_PARAMETERS */
|
/* PUT style GET_PARAMETERS */
|
||||||
params = curlx_open(libtest_arg2, O_RDONLY);
|
params = curlx_open(libtest_arg2, O_RDONLY);
|
||||||
if(params == -1) {
|
if(params == -1) {
|
||||||
curl_mfprintf(stderr, "cannot open %s\n", libtest_arg2);
|
curl_mfprintf(stderr, "open() failed with error (%d) %s\n",
|
||||||
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
result = TEST_ERR_MAJOR_BAD;
|
result = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +97,9 @@ static CURLcode test_lib572(const char *URL)
|
||||||
|
|
||||||
paramsf = curlx_fopen(libtest_arg2, "rb");
|
paramsf = curlx_fopen(libtest_arg2, "rb");
|
||||||
if(!paramsf) {
|
if(!paramsf) {
|
||||||
curl_mfprintf(stderr, "cannot fopen %s\n", libtest_arg2);
|
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||||
|
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
|
||||||
|
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||||
result = TEST_ERR_MAJOR_BAD;
|
result = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ static CURLcode test_unit1664(const char *arg)
|
||||||
i, orgline, rc, (int)(line - orgline));
|
i, orgline, rc, (int)(line - orgline));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static const char *single[] = {
|
static const char *single[] = {
|
||||||
"a",
|
"a",
|
||||||
|
|
@ -169,6 +170,7 @@ static CURLcode test_unit1664(const char *arg)
|
||||||
i, orgline, rc, (int)(line - orgline));
|
i, orgline, rc, (int)(line - orgline));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static const char *nums[] = {
|
static const char *nums[] = {
|
||||||
"1",
|
"1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue