From 86b346443b68cde7ef33e1ab770e6c8ab641d2b1 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 27 Nov 2025 04:27:26 +0100 Subject: [PATCH] lib: fix formatting nits (part 2) From `lib/curl*` to `lib/g*`. With fixes to part 1. part 1: 47a1ab2ebecb21485c0e955316d90511e80a3c43 #19764 Closes #19800 --- lib/altsvc.c | 2 +- lib/amigaos.h | 2 +- lib/asyn-ares.c | 3 +- lib/asyn-base.c | 4 +- lib/asyn.h | 4 +- lib/cf-h2-proxy.c | 4 +- lib/cf-https-connect.c | 1 - lib/cf-ip-happy.c | 1 - lib/cf-socket.c | 6 +- lib/cf-socket.h | 2 +- lib/conncache.c | 1 - lib/content_encoding.c | 61 ++-- lib/cookie.c | 15 +- lib/cookie.h | 2 +- lib/curl_addrinfo.c | 54 ++-- lib/curl_addrinfo.h | 31 +- lib/curl_ctype.h | 8 +- lib/curl_fopen.c | 4 +- lib/curl_get_line.c | 5 +- lib/curl_gethostname.c | 1 - lib/curl_gssapi.c | 4 +- lib/curl_hmac.h | 1 - lib/curl_ldap.h | 6 +- lib/curl_memrchr.c | 4 +- lib/curl_memrchr.h | 2 +- lib/curl_ntlm_core.c | 99 +++--- lib/curl_ntlm_core.h | 20 +- lib/curl_range.c | 8 +- lib/curl_rtmp.c | 6 +- lib/curl_sasl.c | 16 +- lib/curl_setup.h | 46 +-- lib/curl_setup_once.h | 48 +-- lib/curl_sha512_256.c | 160 +++++----- lib/curl_sha512_256.h | 5 +- lib/curl_share.c | 20 +- lib/curl_share.h | 6 +- lib/curl_trc.c | 44 ++- lib/curl_trc.h | 12 +- lib/cw-out.c | 2 +- lib/cw-pause.c | 2 +- lib/dict.c | 20 +- lib/doh.c | 62 ++-- lib/doh.h | 6 +- lib/dynhds.c | 11 +- lib/easy.c | 22 +- lib/easy_lock.h | 14 +- lib/easyoptions.c | 688 +++++++++++++++++++++-------------------- lib/escape.c | 10 +- lib/fake_addrinfo.c | 3 +- lib/file.c | 17 +- lib/formdata.c | 99 +++--- lib/formdata.h | 1 - lib/ftp.c | 336 ++++++++++---------- lib/ftplistparser.c | 20 +- lib/getinfo.c | 29 +- lib/optiontable.pl | 8 +- 56 files changed, 978 insertions(+), 1090 deletions(-) diff --git a/lib/altsvc.c b/lib/altsvc.c index cbaf4b4d85..f2906ad4e3 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -42,7 +42,7 @@ #include "curlx/strparse.h" #include "connect.h" -#define MAX_ALTSVC_LINE 4095 +#define MAX_ALTSVC_LINE 4095 #define MAX_ALTSVC_DATELEN 256 #define MAX_ALTSVC_HOSTLEN 2048 #define MAX_ALTSVC_ALPNLEN 10 diff --git a/lib/amigaos.h b/lib/amigaos.h index c99d963ece..58278f0935 100644 --- a/lib/amigaos.h +++ b/lib/amigaos.h @@ -33,7 +33,7 @@ void Curl_amiga_cleanup(void); #else -#define Curl_amiga_init() CURLE_OK +#define Curl_amiga_init() CURLE_OK #define Curl_amiga_cleanup() Curl_nop_stmt #endif diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index ce4f866be6..40ce00db22 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -180,8 +180,7 @@ static CURLcode async_ares_init(struct Curl_easy *data) status = ares_init_options(&ares->channel, &options, optmask); if(status != ARES_SUCCESS) { ares->channel = NULL; - rc = (status == ARES_ENOMEM) ? - CURLE_OUT_OF_MEMORY : CURLE_FAILED_INIT; + rc = (status == ARES_ENOMEM) ? CURLE_OUT_OF_MEMORY : CURLE_FAILED_INIT; goto out; } diff --git a/lib/asyn-base.c b/lib/asyn-base.c index 5358fcb8fa..1db132c1e4 100644 --- a/lib/asyn-base.c +++ b/lib/asyn-base.c @@ -168,9 +168,9 @@ int Curl_ares_perform(ares_channel channel, timediff_t timeout_ms) /* move through the descriptors and ask for processing on them */ for(i = 0; i < num; i++) ares_process_fd(channel, - (pfd[i].revents & (POLLRDNORM|POLLIN)) ? + (pfd[i].revents & (POLLRDNORM | POLLIN)) ? pfd[i].fd : ARES_SOCKET_BAD, - (pfd[i].revents & (POLLWRNORM|POLLOUT)) ? + (pfd[i].revents & (POLLWRNORM | POLLOUT)) ? pfd[i].fd : ARES_SOCKET_BAD); } return nfds; diff --git a/lib/asyn.h b/lib/asyn.h index e5e472e247..87c6532a3d 100644 --- a/lib/asyn.h +++ b/lib/asyn.h @@ -223,7 +223,7 @@ struct doh_probes; /* convert these functions if an asynch resolver is not used */ #define Curl_async_get_impl(x, y) (*(y) = NULL, CURLE_OK) -#define Curl_async_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST +#define Curl_async_is_resolved(x, y) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_await(x, y) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_global_init() CURLE_OK #define Curl_async_global_cleanup() Curl_nop_stmt @@ -266,7 +266,7 @@ void Curl_async_shutdown(struct Curl_easy *data); void Curl_async_destroy(struct Curl_easy *data); #else /* !USE_CURL_ASYNC */ #define Curl_async_shutdown(x) Curl_nop_stmt -#define Curl_async_destroy(x) Curl_nop_stmt +#define Curl_async_destroy(x) Curl_nop_stmt #endif /* USE_CURL_ASYNC */ /********** end of generic resolver interface functions *****************/ diff --git a/lib/cf-h2-proxy.c b/lib/cf-h2-proxy.c index fb2586d1d0..5a58c280e9 100644 --- a/lib/cf-h2-proxy.c +++ b/lib/cf-h2-proxy.c @@ -242,8 +242,8 @@ static int proxy_h2_client_new(struct Curl_cfilter *cf, { struct cf_h2_proxy_ctx *ctx = cf->ctx; nghttp2_option *o; - nghttp2_mem mem = {NULL, Curl_nghttp2_malloc, Curl_nghttp2_free, - Curl_nghttp2_calloc, Curl_nghttp2_realloc}; + nghttp2_mem mem = { NULL, Curl_nghttp2_malloc, Curl_nghttp2_free, + Curl_nghttp2_calloc, Curl_nghttp2_realloc }; int rc = nghttp2_option_new(&o); if(rc) diff --git a/lib/cf-https-connect.c b/lib/cf-https-connect.c index ad815a0fe7..acb3bcdd3a 100644 --- a/lib/cf-https-connect.c +++ b/lib/cf-https-connect.c @@ -244,7 +244,6 @@ static CURLcode baller_connected(struct Curl_cfilter *cf, return result; } - static bool time_to_start_next(struct Curl_cfilter *cf, struct Curl_easy *data, size_t idx, struct curltime now) diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index 72ac59b7d9..d31c6b6caa 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -613,7 +613,6 @@ static int cf_ip_ballers_min_reply_ms(struct cf_ip_ballers *bs, return reply_ms; } - typedef enum { SCFST_INIT, SCFST_WAITING, diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 0e431976c9..1881683cc8 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -643,8 +643,8 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, return CURLE_UNSUPPORTED_PROTOCOL; case IF2IP_FOUND: /* - * We now have the numerical IP address in the 'myhost' buffer - */ + * We now have the numerical IP address in the 'myhost' buffer + */ host = myhost; infof(data, "Local Interface %s is ip %s using address family %i", iface, host, af); @@ -2057,7 +2057,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf, #else struct sockaddr_in add; #endif - curl_socklen_t size = (curl_socklen_t) sizeof(add); + curl_socklen_t size = (curl_socklen_t)sizeof(add); curl_socket_t s_accepted = CURL_SOCKET_BAD; timediff_t timeout_ms; int socketstate = 0; diff --git a/lib/cf-socket.h b/lib/cf-socket.h index e5f69c60f4..fe5ff2fa47 100644 --- a/lib/cf-socket.h +++ b/lib/cf-socket.h @@ -52,7 +52,7 @@ struct Curl_sockaddr_ex { struct Curl_sockaddr_storage buf; } addr; }; -#define curl_sa_addr addr.sa +#define curl_sa_addr addr.sa #define curl_sa_addrbuf addr.buf /* diff --git a/lib/conncache.c b/lib/conncache.c index c7a52b69f6..c50697f177 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -77,7 +77,6 @@ struct cpool_bundle { char dest[1]; /* destination of bundle, allocated to keep dest_len bytes */ }; - static void cpool_discard_conn(struct cpool *cpool, struct Curl_easy *data, struct connectdata *conn, diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 84ed86c1df..47adac0f43 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -86,24 +86,20 @@ struct zlib_writer { z_stream z; /* State structure for zlib. */ }; - -static voidpf -zalloc_cb(voidpf opaque, unsigned int items, unsigned int size) +static voidpf zalloc_cb(voidpf opaque, unsigned int items, unsigned int size) { (void)opaque; /* not a typo, keep it curlx_calloc() */ return (voidpf)curlx_calloc(items, size); } -static void -zfree_cb(voidpf opaque, voidpf ptr) +static void zfree_cb(voidpf opaque, voidpf ptr) { (void)opaque; curlx_free(ptr); } -static CURLcode -process_zlib_error(struct Curl_easy *data, z_stream *z) +static CURLcode process_zlib_error(struct Curl_easy *data, z_stream *z) { if(z->msg) failf(data, "Error while processing content unencoding: %s", @@ -115,9 +111,8 @@ process_zlib_error(struct Curl_easy *data, z_stream *z) return CURLE_BAD_CONTENT_ENCODING; } -static CURLcode -exit_zlib(struct Curl_easy *data, - z_stream *z, zlibInitState *zlib_init, CURLcode result) +static CURLcode exit_zlib(struct Curl_easy *data, z_stream *z, + zlibInitState *zlib_init, CURLcode result) { if(*zlib_init != ZLIB_UNINIT) { if(inflateEnd(z) != Z_OK && result == CURLE_OK) @@ -128,8 +123,7 @@ exit_zlib(struct Curl_easy *data, return result; } -static CURLcode process_trailer(struct Curl_easy *data, - struct zlib_writer *zp) +static CURLcode process_trailer(struct Curl_easy *data, struct zlib_writer *zp) { z_stream *z = &zp->z; CURLcode result = CURLE_OK; @@ -156,7 +150,7 @@ static CURLcode inflate_stream(struct Curl_easy *data, struct Curl_cwriter *writer, int type, zlibInitState started) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ uInt nread = z->avail_in; z_const Bytef *orig_in = z->next_in; @@ -176,7 +170,7 @@ static CURLcode inflate_stream(struct Curl_easy *data, done = TRUE; /* (re)set buffer for decompressed output for every iteration */ - z->next_out = (Bytef *) zp->buffer; + z->next_out = (Bytef *)zp->buffer; z->avail_out = DECOMPRESS_BUFFER_SIZE; status = inflate(z, Z_BLOCK); @@ -237,17 +231,16 @@ static CURLcode inflate_stream(struct Curl_easy *data, return result; } - /* Deflate handler. */ static CURLcode deflate_do_init(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ /* Initialize zlib */ - z->zalloc = (alloc_func) zalloc_cb; - z->zfree = (free_func) zfree_cb; + z->zalloc = (alloc_func)zalloc_cb; + z->zfree = (free_func)zfree_cb; if(inflateInit(z) != Z_OK) return process_zlib_error(data, z); @@ -259,7 +252,7 @@ static CURLcode deflate_do_write(struct Curl_easy *data, struct Curl_cwriter *writer, int type, const char *buf, size_t nbytes) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ if(!(type & CLIENTWRITE_BODY) || !nbytes) @@ -279,7 +272,7 @@ static CURLcode deflate_do_write(struct Curl_easy *data, static void deflate_do_close(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ exit_zlib(data, z, &zp->zlib_init, CURLE_OK); @@ -299,12 +292,12 @@ static const struct Curl_cwtype deflate_encoding = { static CURLcode gzip_do_init(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ /* Initialize zlib */ - z->zalloc = (alloc_func) zalloc_cb; - z->zfree = (free_func) zfree_cb; + z->zalloc = (alloc_func)zalloc_cb; + z->zfree = (free_func)zfree_cb; if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) return process_zlib_error(data, z); @@ -317,7 +310,7 @@ static CURLcode gzip_do_write(struct Curl_easy *data, struct Curl_cwriter *writer, int type, const char *buf, size_t nbytes) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ if(!(type & CLIENTWRITE_BODY) || !nbytes) @@ -338,7 +331,7 @@ static CURLcode gzip_do_write(struct Curl_easy *data, static void gzip_do_close(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zlib_writer *zp = (struct zlib_writer *) writer; + struct zlib_writer *zp = (struct zlib_writer *)writer; z_stream *z = &zp->z; /* zlib state structure */ exit_zlib(data, z, &zp->zlib_init, CURLE_OK); @@ -402,7 +395,7 @@ static CURLcode brotli_map_error(BrotliDecoderErrorCode be) static CURLcode brotli_do_init(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct brotli_writer *bp = (struct brotli_writer *) writer; + struct brotli_writer *bp = (struct brotli_writer *)writer; (void)data; bp->br = BrotliDecoderCreateInstance(NULL, NULL, NULL); @@ -413,8 +406,8 @@ static CURLcode brotli_do_write(struct Curl_easy *data, struct Curl_cwriter *writer, int type, const char *buf, size_t nbytes) { - struct brotli_writer *bp = (struct brotli_writer *) writer; - const uint8_t *src = (const uint8_t *) buf; + struct brotli_writer *bp = (struct brotli_writer *)writer; + const uint8_t *src = (const uint8_t *)buf; uint8_t *dst; size_t dstleft; CURLcode result = CURLE_OK; @@ -428,7 +421,7 @@ static CURLcode brotli_do_write(struct Curl_easy *data, while((nbytes || r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) && result == CURLE_OK) { - dst = (uint8_t *) bp->buffer; + dst = (uint8_t *)bp->buffer; dstleft = DECOMPRESS_BUFFER_SIZE; r = BrotliDecoderDecompressStream(bp->br, &nbytes, &src, &dstleft, &dst, NULL); @@ -457,7 +450,7 @@ static CURLcode brotli_do_write(struct Curl_easy *data, static void brotli_do_close(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct brotli_writer *bp = (struct brotli_writer *) writer; + struct brotli_writer *bp = (struct brotli_writer *)writer; (void)data; if(bp->br) { @@ -501,7 +494,7 @@ static void Curl_zstd_free(void *opaque, void *address) static CURLcode zstd_do_init(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zstd_writer *zp = (struct zstd_writer *) writer; + struct zstd_writer *zp = (struct zstd_writer *)writer; (void)data; @@ -523,7 +516,7 @@ static CURLcode zstd_do_write(struct Curl_easy *data, const char *buf, size_t nbytes) { CURLcode result = CURLE_OK; - struct zstd_writer *zp = (struct zstd_writer *) writer; + struct zstd_writer *zp = (struct zstd_writer *)writer; ZSTD_inBuffer in; ZSTD_outBuffer out; size_t errorCode; @@ -560,7 +553,7 @@ static CURLcode zstd_do_write(struct Curl_easy *data, static void zstd_do_close(struct Curl_easy *data, struct Curl_cwriter *writer) { - struct zstd_writer *zp = (struct zstd_writer *) writer; + struct zstd_writer *zp = (struct zstd_writer *)writer; (void)data; if(zp->zds) { @@ -614,7 +607,7 @@ static const struct Curl_cwtype * const transfer_unencoders[] = { }; /* Provide a list of comma-separated names of supported encodings. -*/ + */ void Curl_all_content_encodings(char *buf, size_t blen) { size_t len = 0; diff --git a/lib/cookie.c b/lib/cookie.c index 81a57942b2..e3cf8e4e0c 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -661,13 +661,12 @@ parse_cookie_header(struct Curl_easy *data, return CURLE_OK; } -static CURLcode -parse_netscape(struct Cookie *co, - struct CookieInfo *ci, - bool *okay, - const char *lineptr, - bool secure) /* TRUE if connection is over secure - origin */ +static CURLcode parse_netscape(struct Cookie *co, + struct CookieInfo *ci, + bool *okay, + const char *lineptr, + bool secure) /* TRUE if connection is over + secure origin */ { /* * This line is NOT an HTTP header style line, we do offer support for @@ -1247,7 +1246,7 @@ static int cookie_sort_ct(const void *p1, const void *p2) bool Curl_secure_context(struct connectdata *conn, const char *host) { - return conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) || + return conn->handler->protocol & (CURLPROTO_HTTPS | CURLPROTO_WSS) || curl_strequal("localhost", host) || !strcmp(host, "127.0.0.1") || !strcmp(host, "::1"); diff --git a/lib/cookie.h b/lib/cookie.h index 5e9f5f7823..c1fb23ee4c 100644 --- a/lib/cookie.h +++ b/lib/cookie.h @@ -52,7 +52,7 @@ struct Cookie { * draft-ietf-httpbis-rfc6265bis-02 */ #define COOKIE_PREFIX__SECURE (1 << 0) -#define COOKIE_PREFIX__HOST (1 << 1) +#define COOKIE_PREFIX__HOST (1 << 1) #define COOKIE_HASH_SIZE 63 diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 67c2f4177d..7993631bf1 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -71,8 +71,7 @@ # define vqualifier #endif -void -Curl_freeaddrinfo(struct Curl_addrinfo *cahead) +void Curl_freeaddrinfo(struct Curl_addrinfo *cahead) { struct Curl_addrinfo *vqualifier canext; struct Curl_addrinfo *ca; @@ -83,7 +82,6 @@ Curl_freeaddrinfo(struct Curl_addrinfo *cahead) } } - #ifdef HAVE_GETADDRINFO /* * Curl_getaddrinfo_ex() @@ -98,12 +96,10 @@ Curl_freeaddrinfo(struct Curl_addrinfo *cahead) * There should be no single call to system's getaddrinfo() in the * whole library, any such call should be 'routed' through this one. */ - -int -Curl_getaddrinfo_ex(const char *nodename, - const char *servname, - const struct addrinfo *hints, - struct Curl_addrinfo **result) +int Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + struct Curl_addrinfo **result) { const struct addrinfo *ai; struct addrinfo *aihead; @@ -176,7 +172,6 @@ Curl_getaddrinfo_ex(const char *nodename, if(calast) calast->ai_next = ca; calast = ca; - } /* destroy the addrinfo list */ @@ -208,7 +203,6 @@ Curl_getaddrinfo_ex(const char *nodename, } #endif /* HAVE_GETADDRINFO */ - /* * Curl_he2ai() * @@ -248,10 +242,8 @@ Curl_getaddrinfo_ex(const char *nodename, * * #define h_addr h_addr_list[0] */ - #if !(defined(HAVE_GETADDRINFO) && defined(HAVE_GETADDRINFO_THREADSAFE)) -struct Curl_addrinfo * -Curl_he2ai(const struct hostent *he, int port) +struct Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port) { struct Curl_addrinfo *ai; struct Curl_addrinfo *prevai = NULL; @@ -350,10 +342,8 @@ Curl_he2ai(const struct hostent *he, int port) * returns a Curl_addrinfo chain filled in correctly with information for the * given address/host */ - -static CURLcode -ip2addr(struct Curl_addrinfo **addrp, - int af, const void *inaddr, const char *hostname, int port) +static CURLcode ip2addr(struct Curl_addrinfo **addrp, int af, + const void *inaddr, const char *hostname, int port) { struct Curl_addrinfo *ai; size_t addrsize; @@ -473,7 +463,7 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, return NULL; ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo)); - sa_un = (void *) ai->ai_addr; + sa_un = (void *)ai->ai_addr; sa_un->sun_family = AF_UNIX; /* sun_path must be able to store the null-terminated path */ @@ -508,10 +498,8 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, * family otherwise present in memdebug.c. I put these ones here since they * require a bunch of structs I did not want to include in memdebug.c */ - -void -curl_dbg_freeaddrinfo(struct addrinfo *freethis, - int line, const char *source) +void curl_dbg_freeaddrinfo(struct addrinfo *freethis, + int line, const char *source) { curl_dbg_log("ADDR %s:%d freeaddrinfo(%p)\n", source, line, (void *)freethis); @@ -533,7 +521,6 @@ curl_dbg_freeaddrinfo(struct addrinfo *freethis, } #endif /* CURLDEBUG && HAVE_FREEADDRINFO */ - #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) /* * curl_dbg_getaddrinfo() @@ -542,13 +529,11 @@ curl_dbg_freeaddrinfo(struct addrinfo *freethis, * family otherwise present in memdebug.c. I put these ones here since they * require a bunch of structs I did not want to include in memdebug.c */ - -int -curl_dbg_getaddrinfo(const char *hostname, - const char *service, - const struct addrinfo *hints, - struct addrinfo **result, - int line, const char *source) +int curl_dbg_getaddrinfo(const char *hostname, + const char *service, + const struct addrinfo *hints, + struct addrinfo **result, + int line, const char *source) { #ifdef USE_LWIPSOCK int res = lwip_getaddrinfo(hostname, service, hints, result); @@ -566,11 +551,10 @@ curl_dbg_getaddrinfo(const char *hostname, #endif if(res == 0) /* success */ - curl_dbg_log("ADDR %s:%d getaddrinfo() = %p\n", - source, line, (void *)*result); + curl_dbg_log("ADDR %s:%d getaddrinfo() = %p\n", source, line, + (void *)*result); else - curl_dbg_log("ADDR %s:%d getaddrinfo() failed\n", - source, line); + curl_dbg_log("ADDR %s:%d getaddrinfo() failed\n", source, line); return res; } #endif /* CURLDEBUG && HAVE_GETADDRINFO */ diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h index 9a26c67849..378b31ed05 100644 --- a/lib/curl_addrinfo.h +++ b/lib/curl_addrinfo.h @@ -60,20 +60,17 @@ struct Curl_addrinfo { struct Curl_addrinfo *ai_next; }; -void -Curl_freeaddrinfo(struct Curl_addrinfo *cahead); +void Curl_freeaddrinfo(struct Curl_addrinfo *cahead); #ifdef HAVE_GETADDRINFO -int -Curl_getaddrinfo_ex(const char *nodename, - const char *servname, - const struct addrinfo *hints, - struct Curl_addrinfo **result); +int Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + struct Curl_addrinfo **result); #endif #if !(defined(HAVE_GETADDRINFO) && defined(HAVE_GETADDRINFO_THREADSAFE)) -struct Curl_addrinfo * -Curl_he2ai(const struct hostent *he, int port); +struct Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port); #endif bool Curl_is_ipaddr(const char *address); @@ -85,23 +82,23 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, #endif #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \ - defined(HAVE_FREEADDRINFO) -void -curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line, const char *source); + defined(HAVE_FREEADDRINFO) +void curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line, + const char *source); #endif #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) -int -curl_dbg_getaddrinfo(const char *hostname, const char *service, - const struct addrinfo *hints, struct addrinfo **result, - int line, const char *source); +int curl_dbg_getaddrinfo(const char *hostname, const char *service, + const struct addrinfo *hints, + struct addrinfo **result, int line, + const char *source); #endif #ifdef HAVE_GETADDRINFO #ifdef USE_RESOLVE_ON_IPS void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port); #else -#define Curl_addrinfo_set_port(x,y) +#define Curl_addrinfo_set_port(x, y) #endif #endif diff --git a/lib/curl_ctype.h b/lib/curl_ctype.h index 48c3c37c35..153a8f9c6c 100644 --- a/lib/curl_ctype.h +++ b/lib/curl_ctype.h @@ -25,17 +25,17 @@ ***************************************************************************/ #define ISLOWHEXALHA(x) (((x) >= 'a') && ((x) <= 'f')) -#define ISUPHEXALHA(x) (((x) >= 'A') && ((x) <= 'F')) +#define ISUPHEXALHA(x) (((x) >= 'A') && ((x) <= 'F')) #define ISLOWCNTRL(x) ((unsigned char)(x) <= 0x1f) -#define IS7F(x) ((x) == 0x7f) +#define IS7F(x) ((x) == 0x7f) #define ISLOWPRINT(x) (((x) >= 9) && ((x) <= 0x0d)) #define ISPRINT(x) (ISLOWPRINT(x) || (((x) >= ' ') && ((x) <= 0x7e))) #define ISGRAPH(x) (ISLOWPRINT(x) || (((x) > ' ') && ((x) <= 0x7e))) -#define ISCNTRL(x) (ISLOWCNTRL(x) || IS7F(x)) -#define ISALPHA(x) (ISLOWER(x) || ISUPPER(x)) +#define ISCNTRL(x) (ISLOWCNTRL(x) || IS7F(x)) +#define ISALPHA(x) (ISLOWER(x) || ISUPPER(x)) #define ISXDIGIT(x) (ISDIGIT(x) || ISLOWHEXALHA(x) || ISUPHEXALHA(x)) #define ISODIGIT(x) (((x) >= '0') && ((x) <= '7')) #define ISALNUM(x) (ISDIGIT(x) || ISLOWER(x) || ISUPPER(x)) diff --git a/lib/curl_fopen.c b/lib/curl_fopen.c index cccf849acb..383b307e21 100644 --- a/lib/curl_fopen.c +++ b/lib/curl_fopen.c @@ -62,10 +62,10 @@ static char *dirslash(const char *path) n = strlen(path); if(n) { /* find the rightmost path separator, if any */ - while(n && !IS_SEP(path[n-1])) + while(n && !IS_SEP(path[n - 1])) --n; /* skip over all the path separators, if any */ - while(n && IS_SEP(path[n-1])) + while(n && IS_SEP(path[n - 1])) --n; } if(curlx_dyn_addn(&out, path, n)) diff --git a/lib/curl_get_line.c b/lib/curl_get_line.c index ea31eb182f..5e553f4d31 100644 --- a/lib/curl_get_line.c +++ b/lib/curl_get_line.c @@ -29,8 +29,7 @@ #include "curl_get_line.h" -#define appendnl(b) \ - curlx_dyn_addn(buf, "\n", 1) +#define appendnl(b) curlx_dyn_addn(buf, "\n", 1) /* * Curl_get_line() returns only complete whole lines that end with newline. @@ -57,7 +56,7 @@ CURLcode Curl_get_line(struct dynbuf *buf, FILE *input, bool *eof) /* now check the full line */ rlen = curlx_dyn_len(buf); b = curlx_dyn_ptr(buf); - if(rlen && (b[rlen-1] == '\n')) + if(rlen && (b[rlen - 1] == '\n')) /* LF at end of the line */ return CURLE_OK; /* all good */ if(*eof) diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c index 9f2624ff05..e339e60798 100644 --- a/lib/curl_gethostname.c +++ b/lib/curl_gethostname.c @@ -93,5 +93,4 @@ int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen) return 0; #endif - } diff --git a/lib/curl_gssapi.c b/lib/curl_gssapi.c index 7f5bd72954..31addb8fbc 100644 --- a/lib/curl_gssapi.c +++ b/lib/curl_gssapi.c @@ -154,7 +154,7 @@ stub_gss_init_sec_context(OM_uint32 *min, } /* Server response, either D (RA==) or C (Qw==) */ - if(((char *) input_token->value)[0] == 'D') { + if(((char *)input_token->value)[0] == 'D') { /* Done */ switch(ctx->sent) { case STUB_GSS_KRB5: @@ -170,7 +170,7 @@ stub_gss_init_sec_context(OM_uint32 *min, } } - if(((char *) input_token->value)[0] != 'C') { + if(((char *)input_token->value)[0] != 'C') { /* We only support Done or Continue */ *min = STUB_GSS_SERVER_ERR; return GSS_S_FAILURE; diff --git a/lib/curl_hmac.h b/lib/curl_hmac.h index 9675c6c542..285846afe7 100644 --- a/lib/curl_hmac.h +++ b/lib/curl_hmac.h @@ -56,7 +56,6 @@ struct HMAC_context { void *hashctxt2; /* Hash function context 2. */ }; - /* Prototypes. */ struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams, const unsigned char *key, diff --git a/lib/curl_ldap.h b/lib/curl_ldap.h index 9da9b717d5..5ef32a5a30 100644 --- a/lib/curl_ldap.h +++ b/lib/curl_ldap.h @@ -26,9 +26,9 @@ #ifndef CURL_DISABLE_LDAP extern const struct Curl_handler Curl_handler_ldap; -#if !defined(CURL_DISABLE_LDAPS) && \ - ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \ - (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))) +#if !defined(CURL_DISABLE_LDAPS) && \ + ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))) extern const struct Curl_handler Curl_handler_ldaps; #endif diff --git a/lib/curl_memrchr.c b/lib/curl_memrchr.c index 8146458407..d8b4eef9f4 100644 --- a/lib/curl_memrchr.c +++ b/lib/curl_memrchr.c @@ -37,9 +37,7 @@ * backwards from the end of the n bytes pointed to by s instead of forward * from the beginning. */ - -void * -Curl_memrchr(const void *s, int c, size_t n) +void *Curl_memrchr(const void *s, int c, size_t n) { if(n > 0) { const unsigned char *p = s; diff --git a/lib/curl_memrchr.h b/lib/curl_memrchr.h index 3c7dda96ac..73bd346cde 100644 --- a/lib/curl_memrchr.h +++ b/lib/curl_memrchr.h @@ -35,7 +35,7 @@ #else /* HAVE_MEMRCHR */ void *Curl_memrchr(const void *s, int c, size_t n); -#define memrchr(x,y,z) Curl_memrchr((x),(y),(z)) +#define memrchr(x, y, z) Curl_memrchr((x), (y), (z)) #endif /* HAVE_MEMRCHR */ diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index f2c8c2d2a6..8bb273693d 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -53,7 +53,7 @@ #ifdef USE_MBEDTLS #include #if MBEDTLS_VERSION_NUMBER < 0x03020000 - #error "mbedTLS 3.2.0 or later required" +#error "mbedTLS 3.2.0 or later required" #endif #endif @@ -81,13 +81,13 @@ # include # include # ifdef OPENSSL_COEXIST -# define DES_key_schedule WOLFSSL_DES_key_schedule -# define DES_cblock WOLFSSL_DES_cblock -# define DES_set_odd_parity wolfSSL_DES_set_odd_parity -# define DES_set_key wolfSSL_DES_set_key +# define DES_key_schedule WOLFSSL_DES_key_schedule +# define DES_cblock WOLFSSL_DES_cblock +# define DES_set_odd_parity wolfSSL_DES_set_odd_parity +# define DES_set_key wolfSSL_DES_set_key # define DES_set_key_unchecked wolfSSL_DES_set_key_unchecked -# define DES_ecb_encrypt wolfSSL_DES_ecb_encrypt -# define DESKEY(x) ((WOLFSSL_DES_key_schedule *)(x)) +# define DES_ecb_encrypt wolfSSL_DES_ecb_encrypt +# define DESKEY(x) ((WOLFSSL_DES_key_schedule *)(x)) # else # define DESKEY(x) &x # endif @@ -161,8 +161,8 @@ static void curl_des_set_odd_parity(unsigned char *bytes, size_t len) #endif /* USE_CURL_DES_SET_ODD_PARITY */ /* -* Turns a 56-bit key into being 64-bit wide. -*/ + * Turns a 56-bit key into being 64-bit wide. + */ static void extend_key_56_to_64(const unsigned char *key_56, char *key) { key[0] = (char)key_56[0]; @@ -186,7 +186,7 @@ static void setup_des_key(const unsigned char *key_56, DES_cblock key; /* Expand the 56-bit key to 64 bits */ - extend_key_56_to_64(key_56, (char *) &key); + extend_key_56_to_64(key_56, (char *)&key); /* Set the key parity to odd */ DES_set_odd_parity(&key); @@ -197,8 +197,7 @@ static void setup_des_key(const unsigned char *key_56, #elif defined(USE_GNUTLS) -static void setup_des_key(const unsigned char *key_56, - struct des_ctx *des) +static void setup_des_key(const unsigned char *key_56, struct des_ctx *des) { char key[8]; @@ -206,10 +205,10 @@ static void setup_des_key(const unsigned char *key_56, extend_key_56_to_64(key_56, key); /* Set the key parity to odd */ - curl_des_set_odd_parity((unsigned char *) key, sizeof(key)); + curl_des_set_odd_parity((unsigned char *)key, sizeof(key)); /* Set the key */ - des_set_key(des, (const uint8_t *) key); + des_set_key(des, (const uint8_t *)key); } #elif defined(USE_MBEDTLS_DES) @@ -224,11 +223,11 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out, extend_key_56_to_64(key_56, key); /* Set the key parity to odd */ - mbedtls_des_key_set_parity((unsigned char *) key); + mbedtls_des_key_set_parity((unsigned char *)key); /* Perform the encryption */ mbedtls_des_init(&ctx); - mbedtls_des_setkey_enc(&ctx, (unsigned char *) key); + mbedtls_des_setkey_enc(&ctx, (unsigned char *)key); return mbedtls_des_crypt_ecb(&ctx, in, out) == 0; } @@ -248,10 +247,10 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out, extend_key_56_to_64(key_56, ctl.Crypto_Key); /* Set the key parity to odd */ - curl_des_set_odd_parity((unsigned char *) ctl.Crypto_Key, ctl.Data_Len); + curl_des_set_odd_parity((unsigned char *)ctl.Crypto_Key, ctl.Data_Len); /* Perform the encryption */ - _CIPHER((_SPCPTR *) &out, &ctl, (_SPCPTR *) &in); + _CIPHER((_SPCPTR *)&out, &ctl, (_SPCPTR *)&in); return TRUE; } @@ -286,10 +285,10 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out, extend_key_56_to_64(key_56, blob.key); /* Set the key parity to odd */ - curl_des_set_odd_parity((unsigned char *) blob.key, sizeof(blob.key)); + curl_des_set_odd_parity((unsigned char *)blob.key, sizeof(blob.key)); /* Import the key */ - if(!CryptImportKey(hprov, (BYTE *) &blob, sizeof(blob), 0, 0, &hkey)) { + if(!CryptImportKey(hprov, (BYTE *)&blob, sizeof(blob), 0, 0, &hkey)) { CryptReleaseContext(hprov, 0); return FALSE; @@ -308,11 +307,11 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out, #endif /* USE_WIN32_CRYPTO */ - /* - * takes a 21 byte array and treats it as 3 56-bit DES keys. The - * 8 byte plaintext is encrypted with each key and the resulting 24 - * bytes are stored in the results array. - */ +/* + * takes a 21 byte array and treats it as 3 56-bit DES keys. The + * 8 byte plaintext is encrypted with each key and the resulting 24 + * bytes are stored in the results array. + */ void Curl_ntlm_core_lm_resp(const unsigned char *keys, const unsigned char *plaintext, unsigned char *results) @@ -321,16 +320,16 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys, DES_key_schedule ks; setup_des_key(keys, DESKEY(ks)); - DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext), - (DES_cblock*)results, DESKEY(ks), DES_ENCRYPT); + DES_ecb_encrypt((DES_cblock *)CURL_UNCONST(plaintext), + (DES_cblock *)results, DESKEY(ks), DES_ENCRYPT); setup_des_key(keys + 7, DESKEY(ks)); - DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext), - (DES_cblock*)(results + 8), DESKEY(ks), DES_ENCRYPT); + DES_ecb_encrypt((DES_cblock *)CURL_UNCONST(plaintext), + (DES_cblock *)(results + 8), DESKEY(ks), DES_ENCRYPT); setup_des_key(keys + 14, DESKEY(ks)); - DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext), - (DES_cblock*)(results + 16), DESKEY(ks), DES_ENCRYPT); + DES_ecb_encrypt((DES_cblock *)CURL_UNCONST(plaintext), + (DES_cblock *)(results + 16), DESKEY(ks), DES_ENCRYPT); #elif defined(USE_GNUTLS) struct des_ctx des; setup_des_key(keys, &des); @@ -431,7 +430,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(const char *password, size_t len = strlen(password); unsigned char *pw; CURLcode result; - if(len > SIZE_MAX/2) /* avoid integer overflow */ + if(len > SIZE_MAX / 2) /* avoid integer overflow */ return CURLE_OUT_OF_MEMORY; pw = len ? curlx_malloc(len * 2) : (unsigned char *)curlx_strdup(""); if(!pw) @@ -452,7 +451,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(const char *password, #ifndef USE_WINDOWS_SSPI #define NTLMv2_BLOB_SIGNATURE "\x01\x01\x00\x00" -#define NTLMv2_BLOB_LEN (44 -16 + ntlm->target_info_len + 4) +#define NTLMv2_BLOB_LEN (44 - 16 + ntlm->target_info_len + 4) /* Timestamp in tenths of a microsecond since January 1, 1601 00:00:00 UTC. */ struct ms_filetime { @@ -474,11 +473,11 @@ static void time2filetime(struct ms_filetime *ft, time_t t) ft->dwLowDateTime = (unsigned int)(t & 0xFFFFFFFF); ft->dwHighDateTime = 0; -# ifndef HAVE_TIME_T_UNSIGNED +#ifndef HAVE_TIME_T_UNSIGNED /* Extend sign if needed. */ if(ft->dwLowDateTime & 0x80000000) ft->dwHighDateTime = ~(unsigned int)0; -# endif +#endif /* Bias seconds to Jan 1, 1601. 134774 days = 11644473600 seconds = 0x2B6109100 */ @@ -559,20 +558,20 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, unsigned char **ntresp, unsigned int *ntresp_len) { -/* NTLMv2 response structure : ------------------------------------------------------------------------------- -0 HMAC MD5 16 bytes -------BLOB-------------------------------------------------------------------- -16 Signature 0x01010000 -20 Reserved long (0x00000000) -24 Timestamp LE, 64-bit signed value representing the number of - tenths of a microsecond since January 1, 1601. -32 Client Nonce 8 bytes -40 Unknown 4 bytes -44 Target Info N bytes (from the type-2 message) -44+N Unknown 4 bytes ------------------------------------------------------------------------------- -*/ + /* NTLMv2 response structure : + ----------------------------------------------------------------------------- + 0 HMAC MD5 16 bytes + ------BLOB------------------------------------------------------------------- + 16 Signature 0x01010000 + 20 Reserved long (0x00000000) + 24 Timestamp LE, 64-bit signed value representing the number of + tenths of a microsecond since January 1, 1601. + 32 Client Nonce 8 bytes + 40 Unknown 4 bytes + 44 Target Info N bytes (from the type-2 message) + 44+N Unknown 4 bytes + ----------------------------------------------------------------------------- + */ unsigned int len = 0; unsigned char *ptr = NULL; @@ -585,7 +584,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, #ifdef DEBUGBUILD char *force_timestamp = getenv("CURL_FORCETIME"); if(force_timestamp) - time2filetime(&tw, (time_t) 0); + time2filetime(&tw, (time_t)0); else #endif time2filetime(&tw, time(NULL)); diff --git a/lib/curl_ntlm_core.h b/lib/curl_ntlm_core.h index 584f4a17d5..2e23d44bf5 100644 --- a/lib/curl_ntlm_core.h +++ b/lib/curl_ntlm_core.h @@ -58,16 +58,16 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen, unsigned char *ntlmhash, unsigned char *ntlmv2hash); -CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, - unsigned char *challenge_client, - struct ntlmdata *ntlm, - unsigned char **ntresp, - unsigned int *ntresp_len); - -CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash, - unsigned char *challenge_client, - unsigned char *challenge_server, - unsigned char *lmresp); +CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, + unsigned char *challenge_client, + struct ntlmdata *ntlm, + unsigned char **ntresp, + unsigned int *ntresp_len); + +CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash, + unsigned char *challenge_client, + unsigned char *challenge_server, + unsigned char *lmresp); #endif /* !USE_WINDOWS_SSPI */ diff --git a/lib/curl_range.c b/lib/curl_range.c index e9620a29b5..4f78868813 100644 --- a/lib/curl_range.c +++ b/lib/curl_range.c @@ -31,10 +31,10 @@ /* Only include this function if one or more of FTP, FILE are enabled. */ #if !defined(CURL_DISABLE_FTP) || !defined(CURL_DISABLE_FILE) - /* - Check if this is a range download, and if so, set the internal variables - properly. - */ +/* + Check if this is a range download, and if so, set the internal variables + properly. +*/ CURLcode Curl_range(struct Curl_easy *data) { if(data->state.use_range && data->state.range) { diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c index 6f9e7c37b4..1eebbb5b3f 100644 --- a/lib/curl_rtmp.c +++ b/lib/curl_rtmp.c @@ -38,12 +38,12 @@ #include #if defined(USE_WINSOCK) || defined(LWIP_SO_SNDRCVTIMEO_NONSTANDARD) -#define SET_RCVTIMEO(tv,s) int tv = s*1000 +#define SET_RCVTIMEO(tv, s) int tv = s * 1000 #else -#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0} +#define SET_RCVTIMEO(tv, s) struct timeval tv = { s, 0 } #endif -#define DEF_BUFTIME (2*60*60*1000) /* 2 hours */ +#define DEF_BUFTIME (2 * 60 * 60 * 1000) /* 2 hours */ /* meta key for storing RTMP* at connection */ #define CURL_META_RTMP_CONN "meta:proto:rtmp:conn" diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index f0b6e9471e..a4cd5a207b 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -235,7 +235,7 @@ static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data, if(!result && (sasl->params->flags & SASL_FLAG_BASE64)) { unsigned char *msg; size_t msglen; - const char *serverdata = (const char *) Curl_bufref_ptr(out); + const char *serverdata = (const char *)Curl_bufref_ptr(out); if(!*serverdata || *serverdata == '=') Curl_bufref_set(out, NULL, 0, NULL); @@ -355,8 +355,8 @@ static bool sasl_choose_gsasl(struct Curl_easy *data, struct sasl_ctx *sctx) struct gsasldata *gsasl; struct bufref nullmsg; - if(sctx->user && - (sctx->enabledmechs & (SASL_MECH_SCRAM_SHA_256|SASL_MECH_SCRAM_SHA_1))) { + if(sctx->user && (sctx->enabledmechs & + (SASL_MECH_SCRAM_SHA_256 | SASL_MECH_SCRAM_SHA_1))) { gsasl = Curl_auth_gsasl_get(sctx->conn); if(!gsasl) { sctx->result = CURLE_OUT_OF_MEMORY; @@ -364,14 +364,14 @@ static bool sasl_choose_gsasl(struct Curl_easy *data, struct sasl_ctx *sctx) } if((sctx->enabledmechs & SASL_MECH_SCRAM_SHA_256) && - Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_256, - gsasl)) { + Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_256, + gsasl)) { sctx->mech = SASL_MECH_STRING_SCRAM_SHA_256; sctx->sasl->authused = SASL_MECH_SCRAM_SHA_256; } else if((sctx->enabledmechs & SASL_MECH_SCRAM_SHA_1) && - Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_1, - gsasl)) { + Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_1, + gsasl)) { sctx->mech = SASL_MECH_STRING_SCRAM_SHA_1; sctx->sasl->authused = SASL_MECH_SCRAM_SHA_1; } @@ -399,7 +399,7 @@ static bool sasl_choose_digest(struct Curl_easy *data, struct sasl_ctx *sctx) if(!sctx->user) return FALSE; else if((sctx->enabledmechs & SASL_MECH_DIGEST_MD5) && - Curl_auth_is_digest_supported()) { + Curl_auth_is_digest_supported()) { sctx->mech = SASL_MECH_STRING_DIGEST_MD5; sctx->state1 = SASL_DIGESTMD5; sctx->sasl->authused = SASL_MECH_DIGEST_MD5; diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 2cc18cf414..ca275df0ad 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -325,8 +325,8 @@ * Direct macros concatenation does not work because macros * are not expanded before direct concatenation. */ -#define CURL_CONC_MACROS_(A,B) A ## B -#define CURL_CONC_MACROS(A,B) CURL_CONC_MACROS_(A,B) +#define CURL_CONC_MACROS_(A, B) A ## B +#define CURL_CONC_MACROS(A, B) CURL_CONC_MACROS_(A, B) /* curl uses its own printf() function internally. It understands the GNU * format. Use this format, so that it matches the GNU format attribute we @@ -431,9 +431,9 @@ # ifdef __amigaos4__ int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); -# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e) +# define select(a, b, c, d, e) Curl_amiga_select(a, b, c, d, e) # else -# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +# define select(a, b, c, d, e) WaitSelect(a, b, c, d, e, 0) # endif /* must not use libc's fcntl() on bsdsocket.library sockfds! */ # undef HAVE_FCNTL @@ -485,7 +485,7 @@ # undef lseek # define lseek(fdes, offset, whence) _lseeki64(fdes, offset, whence) # undef fstat -# define fstat(fdes,stp) _fstati64(fdes, stp) +# define fstat(fdes, stp) _fstati64(fdes, stp) # define struct_stat struct _stati64 # define LSEEK_ERROR (__int64)-1 # else @@ -500,8 +500,8 @@ /* Requires DJGPP 2.04 */ # include # undef lseek -# define lseek(fdes,offset,whence) llseek(fdes, offset, whence) -# define LSEEK_ERROR (offset_t)-1 +# define lseek(fdes, offset, whence) llseek(fdes, offset, whence) +# define LSEEK_ERROR (offset_t)-1 #endif #ifndef struct_stat @@ -570,7 +570,7 @@ #endif #define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - 1) -#define FMT_OFF_T CURL_FORMAT_CURL_OFF_T +#define FMT_OFF_T CURL_FORMAT_CURL_OFF_T #define FMT_OFF_TU CURL_FORMAT_CURL_OFF_TU #if (SIZEOF_TIME_T == 4) @@ -639,8 +639,8 @@ # ifdef MSDOS /* Watt-32 */ # include -# define select(n,r,w,x,t) select_s(n,r,w,x,t) -# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z)) +# define select(n, r, w, x, t) select_s(n, r, w, x, t) +# define ioctl(x, y, z) ioctlsocket(x, y, (char *)(z)) # include # undef word # undef byte @@ -899,15 +899,15 @@ endings either CRLF or LF so 't' is appropriate. /* Some convenience macros to get the larger/smaller value out of two given. We prefix with CURL to prevent name collisions. */ -#define CURLMAX(x,y) ((x)>(y)?(x):(y)) -#define CURLMIN(x,y) ((x)<(y)?(x):(y)) +#define CURLMAX(x, y) ((x) > (y) ? (x) : (y)) +#define CURLMIN(x, y) ((x) < (y) ? (x) : (y)) /* A convenience macro to provide both the string literal and the length of the string literal in one go, useful for functions that take "string,len" as their argument */ -#define STRCONST(x) x,sizeof(x)-1 +#define STRCONST(x) x, sizeof(x) - 1 -#define CURL_ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define CURL_ARRAYSIZE(A) (sizeof(A) / sizeof((A)[0])) /* Buffer size for error messages retrieved via curlx_strerror() and Curl_sspi_strerror() */ @@ -1033,28 +1033,28 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode, int line, const char *source); -#define sclose(sockfd) curl_dbg_sclose(sockfd,__LINE__,__FILE__) -#define fake_sclose(sockfd) curl_dbg_mark_sclose(sockfd,__LINE__,__FILE__) +#define sclose(sockfd) curl_dbg_sclose(sockfd, __LINE__, __FILE__) +#define fake_sclose(sockfd) curl_dbg_mark_sclose(sockfd, __LINE__, __FILE__) -#define CURL_GETADDRINFO(host,serv,hint,res) \ +#define CURL_GETADDRINFO(host, serv, hint, res) \ curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__) #define CURL_FREEADDRINFO(data) \ curl_dbg_freeaddrinfo(data, __LINE__, __FILE__) -#define CURL_SOCKET(domain,type,protocol) \ +#define CURL_SOCKET(domain, type, protocol) \ curl_dbg_socket((int)domain, type, protocol, __LINE__, __FILE__) #ifdef HAVE_SOCKETPAIR -#define CURL_SOCKETPAIR(domain,type,protocol,socket_vector) \ +#define CURL_SOCKETPAIR(domain, type, protocol, socket_vector) \ curl_dbg_socketpair((int)domain, type, protocol, socket_vector, \ __LINE__, __FILE__) #endif -#define CURL_ACCEPT(sock,addr,len) \ +#define CURL_ACCEPT(sock, addr, len) \ curl_dbg_accept(sock, addr, len, __LINE__, __FILE__) #ifdef HAVE_ACCEPT4 -#define CURL_ACCEPT4(sock,addr,len,flags) \ +#define CURL_ACCEPT4(sock, addr, len, flags) \ curl_dbg_accept4(sock, addr, len, flags, __LINE__, __FILE__) #endif -#define CURL_SEND(a,b,c,d) curl_dbg_send(a,b,c,d, __LINE__, __FILE__) -#define CURL_RECV(a,b,c,d) curl_dbg_recv(a,b,c,d, __LINE__, __FILE__) +#define CURL_SEND(a, b, c, d) curl_dbg_send(a, b, c, d, __LINE__, __FILE__) +#define CURL_RECV(a, b, c, d) curl_dbg_recv(a, b, c, d, __LINE__, __FILE__) #else /* !CURLDEBUG */ diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index 7caf6c9bc5..cf494b2ba8 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -104,7 +104,6 @@ /* * Definition of timeval struct for platforms that do not have it. */ - #ifndef HAVE_STRUCT_TIMEVAL struct timeval { long tv_sec; @@ -112,24 +111,21 @@ struct timeval { }; #endif - /* * If we have the MSG_NOSIGNAL define, make sure we use * it as the fourth argument of function send() */ - #ifdef HAVE_MSG_NOSIGNAL #define SEND_4TH_ARG MSG_NOSIGNAL #else #define SEND_4TH_ARG 0 #endif - #ifdef __minix /* Minix does not support recv on TCP sockets */ -#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ - (RECV_TYPE_ARG2)(y), \ - (RECV_TYPE_ARG3)(z)) +#define sread(x, y, z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z)) #elif defined(HAVE_RECV) /* @@ -154,10 +150,10 @@ struct timeval { * SEND_TYPE_RETV must also be defined. */ -#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ - (RECV_TYPE_ARG2)(y), \ - (RECV_TYPE_ARG3)(z), \ - (RECV_TYPE_ARG4)(0)) +#define sread(x, y, z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z), \ + (RECV_TYPE_ARG4)(0)) #else /* HAVE_RECV */ #ifndef sread #error "Missing definition of macro sread!" @@ -167,25 +163,23 @@ struct timeval { #ifdef __minix /* Minix does not support send on TCP sockets */ -#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ - (SEND_TYPE_ARG2)CURL_UNCONST(y), \ - (SEND_TYPE_ARG3)(z)) +#define swrite(x, y, z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)CURL_UNCONST(y), \ + (SEND_TYPE_ARG3)(z)) #elif defined(HAVE_SEND) -#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ +#define swrite(x, y, z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ (SEND_QUAL_ARG2 SEND_TYPE_ARG2)CURL_UNCONST(y), \ - (SEND_TYPE_ARG3)(z), \ - (SEND_TYPE_ARG4)(SEND_4TH_ARG)) + (SEND_TYPE_ARG3)(z), \ + (SEND_TYPE_ARG4)(SEND_4TH_ARG)) #else /* HAVE_SEND */ #ifndef swrite #error "Missing definition of macro swrite!" #endif #endif /* HAVE_SEND */ - /* * Function-like macro definition used to close a socket. */ - #ifdef HAVE_CLOSESOCKET # define CURL_SCLOSE(x) closesocket((x)) #elif defined(HAVE_CLOSESOCKET_CAMEL) @@ -210,7 +204,6 @@ struct timeval { /* * 'bool' stuff compatible with HP-UX headers. */ - #if defined(__hpux) && !defined(HAVE_BOOL_T) typedef int bool; # define false 0 @@ -218,14 +211,12 @@ struct timeval { # define HAVE_BOOL_T #endif - /* * 'bool' exists on platforms with , i.e. C99 platforms. * On non-C99 platforms there is no bool, so define an enum for that. * On C99 platforms 'false' and 'true' also exist. Enum uses a * global namespace though, so use bool_false and bool_true. */ - #ifndef HAVE_BOOL_T typedef enum { bool_false = 0, @@ -258,7 +249,6 @@ typedef unsigned int bit; * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. */ - #ifndef TRUE #define TRUE true #endif @@ -268,22 +258,18 @@ typedef unsigned int bit; #include "curl_ctype.h" - /* * Macro used to include code only in debug builds. */ - #ifdef DEBUGBUILD #define DEBUGF(x) x #else #define DEBUGF(x) do { } while(0) #endif - /* * Macro used to include assertion code only in debug builds. */ - #undef DEBUGASSERT #ifdef DEBUGBUILD #define DEBUGASSERT(x) assert(x) @@ -291,12 +277,10 @@ typedef unsigned int bit; #define DEBUGASSERT(x) do { } while(0) #endif - /* * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno * (or equivalent) on this platform to hide platform details to code using it. */ - #ifdef USE_WINSOCK #define SOCKERRNO ((int)WSAGetLastError()) #define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) @@ -305,11 +289,9 @@ typedef unsigned int bit; #define SET_SOCKERRNO(x) (errno = (x)) #endif - /* * Portable error number symbolic names defined to Winsock error codes. */ - #ifdef USE_WINSOCK #define SOCKEACCES WSAEACCES #define SOCKEADDRINUSE WSAEADDRINUSE @@ -349,7 +331,6 @@ typedef unsigned int bit; /* * Macro argv_item_t hides platform details to code using it. */ - #ifdef __VMS #define argv_item_t __char_ptr32 #elif defined(_UNICODE) @@ -358,13 +339,10 @@ typedef unsigned int bit; #define argv_item_t char * #endif - /* * We use this ZERO_NULL to avoid picky compiler warnings, * when assigning a NULL pointer to a function pointer var. */ - #define ZERO_NULL 0 - #endif /* HEADER_CURL_SETUP_ONCE_H */ diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index af768fd2aa..cc49aa4c77 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -30,12 +30,12 @@ #include "curlx/warnless.h" /* The recommended order of the TLS backends: - * * OpenSSL - * * GnuTLS - * * wolfSSL - * * Schannel SSPI - * * mbedTLS - * * Rustls + * 1. OpenSSL + * 2. GnuTLS + * 3. wolfSSL + * 4. Schannel SSPI + * 5. mbedTLS + * 6. Rustls * Skip the backend if it does not support the required algorithm */ #ifdef USE_OPENSSL @@ -72,7 +72,6 @@ # endif #endif /* USE_OPENSSL */ - #if !defined(HAS_SHA512_256_IMPLEMENTATION) && defined(USE_GNUTLS) # include # ifdef SHA512_256_DIGEST_SIZE @@ -109,7 +108,7 @@ typedef EVP_MD_CTX *Curl_sha512_256_ctx; */ static CURLcode Curl_sha512_256_init(void *context) { - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; *ctx = EVP_MD_CTX_create(); if(!*ctx) @@ -129,7 +128,6 @@ static CURLcode Curl_sha512_256_init(void *context) return CURLE_FAILED_INIT; } - /** * Process portion of bytes. * @@ -142,7 +140,7 @@ static CURLcode Curl_sha512_256_update(void *context, const unsigned char *data, size_t length) { - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; if(!EVP_DigestUpdate(*ctx, data, length)) return CURLE_SSL_CIPHER; @@ -150,7 +148,6 @@ static CURLcode Curl_sha512_256_update(void *context, return CURLE_OK; } - /** * Finalise SHA-512/256 calculation, return digest. * @@ -163,7 +160,7 @@ static CURLcode Curl_sha512_256_update(void *context, static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) { CURLcode ret; - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; #ifdef NEED_NETBSD_SHA512_256_WORKAROUND /* Use a larger buffer to work around a bug in NetBSD: @@ -202,7 +199,7 @@ typedef struct sha512_256_ctx Curl_sha512_256_ctx; */ static CURLcode Curl_sha512_256_init(void *context) { - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; /* Check whether the header and this file use the same numbers */ DEBUGASSERT(CURL_SHA512_256_DIGEST_LENGTH == CURL_SHA512_256_DIGEST_SIZE); @@ -212,7 +209,6 @@ static CURLcode Curl_sha512_256_init(void *context) return CURLE_OK; } - /** * Process portion of bytes. * @@ -225,7 +221,7 @@ static CURLcode Curl_sha512_256_update(void *context, const unsigned char *data, size_t length) { - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; DEBUGASSERT((data != NULL) || (length == 0)); @@ -234,7 +230,6 @@ static CURLcode Curl_sha512_256_update(void *context, return CURLE_OK; } - /** * Finalise SHA-512/256 calculation, return digest. * @@ -246,7 +241,7 @@ static CURLcode Curl_sha512_256_update(void *context, static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) { - Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context; + Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; sha512_256_digest(ctx, (size_t)CURL_SHA512_256_DIGEST_SIZE, (uint8_t *)digest); @@ -286,32 +281,31 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, /* Bits manipulation macros and functions. Can be moved to other headers to reuse. */ -#define CURL_GET_64BIT_BE(ptr) \ - ( ((uint64_t)(((const uint8_t*)(ptr))[0]) << 56) | \ - ((uint64_t)(((const uint8_t*)(ptr))[1]) << 48) | \ - ((uint64_t)(((const uint8_t*)(ptr))[2]) << 40) | \ - ((uint64_t)(((const uint8_t*)(ptr))[3]) << 32) | \ - ((uint64_t)(((const uint8_t*)(ptr))[4]) << 24) | \ - ((uint64_t)(((const uint8_t*)(ptr))[5]) << 16) | \ - ((uint64_t)(((const uint8_t*)(ptr))[6]) << 8) | \ - (uint64_t)(((const uint8_t*)(ptr))[7]) ) - -#define CURL_PUT_64BIT_BE(ptr,val) do { \ - ((uint8_t*)(ptr))[7]=(uint8_t)((uint64_t)(val)); \ - ((uint8_t*)(ptr))[6]=(uint8_t)(((uint64_t)(val)) >> 8); \ - ((uint8_t*)(ptr))[5]=(uint8_t)(((uint64_t)(val)) >> 16); \ - ((uint8_t*)(ptr))[4]=(uint8_t)(((uint64_t)(val)) >> 24); \ - ((uint8_t*)(ptr))[3]=(uint8_t)(((uint64_t)(val)) >> 32); \ - ((uint8_t*)(ptr))[2]=(uint8_t)(((uint64_t)(val)) >> 40); \ - ((uint8_t*)(ptr))[1]=(uint8_t)(((uint64_t)(val)) >> 48); \ - ((uint8_t*)(ptr))[0]=(uint8_t)(((uint64_t)(val)) >> 56); \ +#define CURL_GET_64BIT_BE(ptr) \ + (((uint64_t)(((const uint8_t *)(ptr))[0]) << 56) | \ + ((uint64_t)(((const uint8_t *)(ptr))[1]) << 48) | \ + ((uint64_t)(((const uint8_t *)(ptr))[2]) << 40) | \ + ((uint64_t)(((const uint8_t *)(ptr))[3]) << 32) | \ + ((uint64_t)(((const uint8_t *)(ptr))[4]) << 24) | \ + ((uint64_t)(((const uint8_t *)(ptr))[5]) << 16) | \ + ((uint64_t)(((const uint8_t *)(ptr))[6]) << 8) | \ + (uint64_t)(((const uint8_t *)(ptr))[7])) + +#define CURL_PUT_64BIT_BE(ptr,val) do { \ + ((uint8_t*)(ptr))[7] = (uint8_t) ((uint64_t)(val)); \ + ((uint8_t*)(ptr))[6] = (uint8_t)(((uint64_t)(val)) >> 8); \ + ((uint8_t*)(ptr))[5] = (uint8_t)(((uint64_t)(val)) >> 16); \ + ((uint8_t*)(ptr))[4] = (uint8_t)(((uint64_t)(val)) >> 24); \ + ((uint8_t*)(ptr))[3] = (uint8_t)(((uint64_t)(val)) >> 32); \ + ((uint8_t*)(ptr))[2] = (uint8_t)(((uint64_t)(val)) >> 40); \ + ((uint8_t*)(ptr))[1] = (uint8_t)(((uint64_t)(val)) >> 48); \ + ((uint8_t*)(ptr))[0] = (uint8_t)(((uint64_t)(val)) >> 56); \ } while(0) /* Defined as a function. The macro version may duplicate the binary code * size as each argument is used twice, so if any calculation is used * as an argument, the calculation could be done twice. */ -static CURL_FORCEINLINE uint64_t Curl_rotr64(uint64_t value, - unsigned int bits) +static CURL_FORCEINLINE uint64_t Curl_rotr64(uint64_t value, unsigned int bits) { bits %= 64; if(bits == 0) @@ -399,7 +393,6 @@ struct Curl_sha512_256ctx { */ typedef struct Curl_sha512_256ctx Curl_sha512_256_ctx; - /** * Initialise structure for SHA-512/256 calculation. * @@ -408,7 +401,7 @@ typedef struct Curl_sha512_256ctx Curl_sha512_256_ctx; */ static CURLcode Curl_sha512_256_init(void *context) { - struct Curl_sha512_256ctx *const ctx = (struct Curl_sha512_256ctx *)context; + struct Curl_sha512_256ctx * const ctx = (struct Curl_sha512_256ctx *)context; /* Check whether the header and this file use the same numbers */ DEBUGASSERT(CURL_SHA512_256_DIGEST_LENGTH == CURL_SHA512_256_DIGEST_SIZE); @@ -434,16 +427,14 @@ static CURLcode Curl_sha512_256_init(void *context) return CURLE_OK; } - /** * Base of the SHA-512/256 transformation. * Gets a full 128 bytes block of data and updates hash values; * @param H hash values * @param data the data buffer with #CURL_SHA512_256_BLOCK_SIZE bytes block */ -static -void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS], - const void *data) +static void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS], + const void *data) { /* Working variables, see FIPS PUB 180-4 section 6.7, 6.4. */ @@ -462,8 +453,8 @@ 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. */ @@ -533,38 +524,41 @@ void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS], * Note: 'wt' must be used exactly one time in this macro as macro for 'wt' calculation may change other data as well every time when used. */ -#define SHA2STEP64(vA,vB,vC,vD,vE,vF,vG,vH,kt,wt) do { \ - (vD) += ((vH) += SIG1((vE)) + Sha512_Ch((vE),(vF),(vG)) + (kt) + (wt)); \ - (vH) += SIG0((vA)) + Sha512_Maj((vA),(vB),(vC)); } while (0) +#define SHA2STEP64(vA, vB, vC, vD, vE, vF, vG, vH, kt, wt) \ + do { \ + (vD) += ((vH) += SIG1((vE)) + Sha512_Ch((vE), (vF), (vG)) + (kt) + (wt)); \ + (vH) += SIG0((vA)) + Sha512_Maj((vA), (vB), (vC)); \ + } while(0) /* One step of SHA-512/256 computation with working variables rotation, see FIPS PUB 180-4 section 6.4.2 step 3. This macro version reassigns all working variables on each step. */ -#define SHA2STEP64RV(vA,vB,vC,vD,vE,vF,vG,vH,kt,wt) do { \ - uint64_t tmp_h_ = (vH); \ - SHA2STEP64((vA),(vB),(vC),(vD),(vE),(vF),(vG),tmp_h_,(kt),(wt)); \ - (vH) = (vG); \ - (vG) = (vF); \ - (vF) = (vE); \ - (vE) = (vD); \ - (vD) = (vC); \ - (vC) = (vB); \ - (vB) = (vA); \ - (vA) = tmp_h_; } while(0) +#define SHA2STEP64RV(vA, vB, vC, vD, vE, vF, vG, vH, kt, wt) \ + do { \ + uint64_t tmp_h_ = (vH); \ + SHA2STEP64((vA), (vB), (vC), (vD), (vE), (vF), (vG), tmp_h_, (kt), (wt)); \ + (vH) = (vG); \ + (vG) = (vF); \ + (vF) = (vE); \ + (vE) = (vD); \ + (vD) = (vC); \ + (vC) = (vB); \ + (vB) = (vA); \ + (vA) = tmp_h_; \ + } while(0) /* Get value of W(t) from input data buffer for 0 <= t <= 15, See FIPS PUB 180-4 section 6.2. Input data must be read in big-endian bytes order, see FIPS PUB 180-4 section 3.1.2. */ -#define SHA512_GET_W_FROM_DATA(buf,t) \ - CURL_GET_64BIT_BE( \ - ((const uint8_t*) (buf)) + (t) * SHA512_256_BYTES_IN_WORD) +#define SHA512_GET_W_FROM_DATA(buf, t) \ + CURL_GET_64BIT_BE(((const uint8_t *)(buf)) + (t) * SHA512_256_BYTES_IN_WORD) /* During first 16 steps, before making any calculation on each step, the W element is read from the input data buffer as a big-endian value and stored in the array of W elements. */ for(t = 0; t < 16; ++t) { - SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], \ + SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], W[t] = SHA512_GET_W_FROM_DATA(data, t)); } @@ -573,15 +567,15 @@ void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS], As only the last 16 'W' are used in calculations, it is possible to use 16 elements array of W as a cyclic buffer. Note: ((t-16) & 15) have same value as (t & 15) */ -#define Wgen(w,t) \ - (uint64_t)( (w)[(t - 16) & 15] + sig1((w)[((t) - 2) & 15]) \ - + (w)[((t) - 7) & 15] + sig0((w)[((t) - 15) & 15]) ) +#define Wgen(w, t) \ + (uint64_t)((w)[((t) - 16) & 15] + sig1((w)[((t) - 2) & 15]) + \ + (w)[((t) - 7) & 15] + sig0((w)[((t) - 15) & 15])) /* During the last 64 steps, before making any calculation on each step, current W element is generated from other W elements of the cyclic buffer and the generated value is stored back in the cyclic buffer. */ for(t = 16; t < 80; ++t) { - SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], \ + SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], W[t & 15] = Wgen(W, t)); } } @@ -598,7 +592,6 @@ void Curl_sha512_256_transform(uint64_t H[SHA512_256_HASH_SIZE_WORDS], H[7] += h; } - /** * Process portion of bytes. * @@ -612,9 +605,9 @@ static CURLcode Curl_sha512_256_update(void *context, size_t length) { unsigned int bytes_have; /**< Number of bytes in the context buffer */ - struct Curl_sha512_256ctx *const ctx = (struct Curl_sha512_256ctx *)context; + struct Curl_sha512_256ctx * const ctx = (struct Curl_sha512_256ctx *)context; /* the void pointer here is required to mute Intel compiler warning */ - void *const ctx_buf = ctx->buffer; + void * const ctx_buf = ctx->buffer; DEBUGASSERT((data != NULL) || (length == 0)); @@ -623,7 +616,7 @@ static CURLcode Curl_sha512_256_update(void *context, /* Note: (count & (CURL_SHA512_256_BLOCK_SIZE-1)) equals (count % CURL_SHA512_256_BLOCK_SIZE) for this block size. */ - bytes_have = (unsigned int) (ctx->count & (CURL_SHA512_256_BLOCK_SIZE - 1)); + bytes_have = (unsigned int)(ctx->count & (CURL_SHA512_256_BLOCK_SIZE - 1)); ctx->count += length; if(length > ctx->count) ctx->count_bits_hi += 1U << 3; /* Value wrap */ @@ -635,7 +628,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, + memcpy(((unsigned char *)ctx_buf) + bytes_have, data, bytes_left); data += bytes_left; @@ -656,13 +649,12 @@ static CURLcode Curl_sha512_256_update(void *context, if(length) { /* Copy incomplete block of new data (if any) to the buffer. */ - memcpy(((unsigned char *) ctx_buf) + bytes_have, data, length); + memcpy(((unsigned char *)ctx_buf) + bytes_have, data, length); } return CURLE_OK; } - /** * Size of "length" insertion in bits. * See FIPS PUB 180-4 section 5.1.2. @@ -684,11 +676,11 @@ static CURLcode Curl_sha512_256_update(void *context, */ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) { - struct Curl_sha512_256ctx *const ctx = (struct Curl_sha512_256ctx *)context; + struct Curl_sha512_256ctx * const ctx = (struct Curl_sha512_256ctx *)context; uint64_t num_bits; /**< Number of processed bits */ unsigned int bytes_have; /**< Number of bytes in the context buffer */ /* the void pointer here is required to mute Intel compiler warning */ - void *const ctx_buf = ctx->buffer; + void * const ctx_buf = ctx->buffer; /* Memorise the number of processed bits. The padding and other data added here during the postprocessing must @@ -697,7 +689,7 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) /* Note: (count & (CURL_SHA512_256_BLOCK_SIZE-1)) equals (count % CURL_SHA512_256_BLOCK_SIZE) for this block size. */ - bytes_have = (unsigned int) (ctx->count & (CURL_SHA512_256_BLOCK_SIZE - 1)); + bytes_have = (unsigned int)(ctx->count & (CURL_SHA512_256_BLOCK_SIZE - 1)); /* Input data must be padded with a single bit "1", then with zeros and the finally the length of data in bits must be added as the final bytes @@ -709,13 +701,13 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) predefined (0x80). */ /* Buffer always have space at least for one byte (as full buffers are processed when formed). */ - ((unsigned char *) ctx_buf)[bytes_have++] = 0x80U; + ((unsigned char *)ctx_buf)[bytes_have++] = 0x80U; if(CURL_SHA512_256_BLOCK_SIZE - bytes_have < SHA512_256_SIZE_OF_LEN_ADD) { /* No space in the current block to put the total length of message. Pad the current block with zeros and process it. */ if(bytes_have < CURL_SHA512_256_BLOCK_SIZE) - memset(((unsigned char *) ctx_buf) + bytes_have, 0, + memset(((unsigned char *)ctx_buf) + bytes_have, 0, CURL_SHA512_256_BLOCK_SIZE - bytes_have); /* Process the full block. */ Curl_sha512_256_transform(ctx->H, ctx->buffer); @@ -724,17 +716,17 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) } /* Pad the rest of the buffer with zeros. */ - memset(((unsigned char *) ctx_buf) + bytes_have, 0, + memset(((unsigned char *)ctx_buf) + bytes_have, 0, CURL_SHA512_256_BLOCK_SIZE - SHA512_256_SIZE_OF_LEN_ADD - bytes_have); /* Put high part of number of bits in processed message and then lower part of number of bits as big-endian values. See FIPS PUB 180-4 section 5.1.2. */ /* Note: the target location is predefined and buffer is always aligned */ - CURL_PUT_64BIT_BE(((unsigned char *) ctx_buf) \ + CURL_PUT_64BIT_BE(((unsigned char *)ctx_buf) \ + CURL_SHA512_256_BLOCK_SIZE \ - SHA512_256_SIZE_OF_LEN_ADD, \ ctx->count_bits_hi); - CURL_PUT_64BIT_BE(((unsigned char *) ctx_buf) \ + CURL_PUT_64BIT_BE(((unsigned char *)ctx_buf) \ + CURL_SHA512_256_BLOCK_SIZE \ - SHA512_256_SIZE_OF_LEN_ADD \ + SHA512_256_BYTES_IN_WORD, \ @@ -775,7 +767,7 @@ CURLcode Curl_sha512_256it(unsigned char *output, const unsigned char *input, if(res != CURLE_OK) return res; - res = Curl_sha512_256_update(&ctx, (const void *) input, input_size); + res = Curl_sha512_256_update(&ctx, (const void *)input, input_size); if(res != CURLE_OK) { (void)Curl_sha512_256_finish(output, &ctx); diff --git a/lib/curl_sha512_256.h b/lib/curl_sha512_256.h index a84e77bc30..c22491ddc0 100644 --- a/lib/curl_sha512_256.h +++ b/lib/curl_sha512_256.h @@ -35,9 +35,8 @@ extern const struct HMAC_params Curl_HMAC_SHA512_256[1]; #define CURL_SHA512_256_DIGEST_LENGTH 32 -CURLcode -Curl_sha512_256it(unsigned char *output, const unsigned char *input, - size_t input_size); +CURLcode Curl_sha512_256it(unsigned char *output, const unsigned char *input, + size_t input_size); #endif /* !CURL_DISABLE_DIGEST_AUTH && !CURL_DISABLE_SHA512_256 */ diff --git a/lib/curl_share.c b/lib/curl_share.c index c6b5126704..109fe76b66 100644 --- a/lib/curl_share.c +++ b/lib/curl_share.c @@ -34,8 +34,7 @@ #include "hsts.h" #include "url.h" -CURLSH * -curl_share_init(void) +CURLSH *curl_share_init(void) { struct Curl_share *share = curlx_calloc(1, sizeof(struct Curl_share)); if(share) { @@ -60,8 +59,7 @@ curl_share_init(void) } #undef curl_share_setopt -CURLSHcode -curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) +CURLSHcode curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) { va_list param; int type; @@ -224,8 +222,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) return res; } -CURLSHcode -curl_share_cleanup(CURLSH *sh) +CURLSHcode curl_share_cleanup(CURLSH *sh) { struct Curl_share *share = sh; if(!GOOD_SHARE_HANDLE(share)) @@ -273,10 +270,8 @@ curl_share_cleanup(CURLSH *sh) return CURLSHE_OK; } - -CURLSHcode -Curl_share_lock(struct Curl_easy *data, curl_lock_data type, - curl_lock_access accesstype) +CURLSHcode Curl_share_lock(struct Curl_easy *data, curl_lock_data type, + curl_lock_access accesstype) { struct Curl_share *share = data->share; @@ -292,8 +287,7 @@ Curl_share_lock(struct Curl_easy *data, curl_lock_data type, return CURLSHE_OK; } -CURLSHcode -Curl_share_unlock(struct Curl_easy *data, curl_lock_data type) +CURLSHcode Curl_share_unlock(struct Curl_easy *data, curl_lock_data type) { struct Curl_share *share = data->share; @@ -302,7 +296,7 @@ Curl_share_unlock(struct Curl_easy *data, curl_lock_data type) if(share->specifier & (unsigned int)(1 << type)) { if(share->unlockfunc) /* only call this if set! */ - share->unlockfunc (data, type, share->clientdata); + share->unlockfunc(data, type, share->clientdata); } return CURLSHE_OK; diff --git a/lib/curl_share.h b/lib/curl_share.h index 974c99dc20..0699356dd4 100644 --- a/lib/curl_share.h +++ b/lib/curl_share.h @@ -38,7 +38,7 @@ struct Curl_ssl_scache; #define GOOD_SHARE_HANDLE(x) ((x) && (x)->magic == CURL_GOOD_SHARE) #define CURL_SHARE_KEEP_CONNECT(s) \ - ((s) && ((s)->specifier & (1<< CURL_LOCK_DATA_CONNECT))) + ((s) && ((s)->specifier & (1 << CURL_LOCK_DATA_CONNECT))) /* this struct is libcurl-private, do not export details */ struct Curl_share { @@ -71,8 +71,8 @@ CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data, CURLSHcode Curl_share_unlock(struct Curl_easy *, curl_lock_data); /* convenience macro to check if this handle is using a shared SSL spool */ -#define CURL_SHARE_ssl_scache(data) (data->share && \ +#define CURL_SHARE_ssl_scache(data) (data->share && \ (data->share->specifier & \ - (1<type = type; if(type & CLIENTWRITE_BODY) Curl_bufq_init2(&cwbuf->b, CW_PAUSE_BUF_CHUNK, 1, - (BUFQ_OPT_SOFT_LIMIT|BUFQ_OPT_NO_SPARES)); + (BUFQ_OPT_SOFT_LIMIT | BUFQ_OPT_NO_SPARES)); else Curl_bufq_init(&cwbuf->b, buflen, 1); } diff --git a/lib/dict.c b/lib/dict.c index f208892f73..a5facf4310 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -60,10 +60,10 @@ #include "progress.h" #include "dict.h" -#define DICT_MATCH "/MATCH:" -#define DICT_MATCH2 "/M:" -#define DICT_MATCH3 "/FIND:" -#define DICT_DEFINE "/DEFINE:" +#define DICT_MATCH "/MATCH:" +#define DICT_MATCH2 "/M:" +#define DICT_MATCH3 "/FIND:" +#define DICT_DEFINE "/DEFINE:" #define DICT_DEFINE2 "/D:" #define DICT_DEFINE3 "/LOOKUP:" @@ -192,9 +192,9 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done) if(result) return result; - if(curl_strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || - curl_strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || - curl_strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { + if(curl_strnequal(path, DICT_MATCH, sizeof(DICT_MATCH) - 1) || + curl_strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2) - 1) || + curl_strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3) - 1)) { word = strchr(path, ':'); if(word) { @@ -239,9 +239,9 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done) } Curl_xfer_setup_recv(data, FIRSTSOCKET, -1); } - else if(curl_strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || - curl_strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || - curl_strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { + else if(curl_strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE) - 1) || + curl_strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2) - 1) || + curl_strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3) - 1)) { word = strchr(path, ':'); if(word) { diff --git a/lib/doh.c b/lib/doh.c index d7b1d54c25..b0f19be73a 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -44,7 +44,7 @@ #define DNS_CLASS_IN 0x01 #ifndef CURL_DISABLE_VERBOSE_STRINGS -static const char * const errors[]={ +static const char * const errors[] = { "", "Bad label", "Out of range", @@ -107,7 +107,7 @@ UNITTEST DOHcode doh_req_encode(const char *host, size_t expected_len; DEBUGASSERT(hostlen); expected_len = 12 + 1 + hostlen + 4; - if(host[hostlen-1]!='.') + if(host[hostlen - 1] != '.') expected_len++; if(expected_len > DOH_MAX_DNSREQ_SIZE) @@ -169,8 +169,8 @@ UNITTEST DOHcode doh_req_encode(const char *host, return DOH_OK; } -static size_t -doh_probe_write_cb(char *contents, size_t size, size_t nmemb, void *userp) +static size_t doh_probe_write_cb(char *contents, size_t size, size_t nmemb, + void *userp) { size_t realsize = size * nmemb; struct Curl_easy *data = userp; @@ -269,7 +269,7 @@ static void doh_probe_dtor(void *key, size_t klen, void *e) } } -#define ERROR_CHECK_SETOPT(x,y) \ +#define ERROR_CHECK_SETOPT(x, y) \ do { \ result = curl_easy_setopt((CURL *)doh, x, y); \ if(result && \ @@ -346,7 +346,7 @@ static CURLcode doh_probe_run(struct Curl_easy *data, ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTPS); #else /* in debug mode, also allow http */ - ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); + ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); #endif ERROR_CHECK_SETOPT(CURLOPT_TIMEOUT_MS, (long)timeout_ms); ERROR_CHECK_SETOPT(CURLOPT_SHARE, (CURLSH *)data->share); @@ -358,11 +358,11 @@ static CURLcode doh_probe_run(struct Curl_easy *data, ERROR_CHECK_SETOPT(CURLOPT_NOSIGNAL, 1L); ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYHOST, - data->set.doh_verifyhost ? 2L : 0L); + data->set.doh_verifyhost ? 2L : 0L); ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYPEER, - data->set.doh_verifypeer ? 1L : 0L); + data->set.doh_verifypeer ? 1L : 0L); ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYSTATUS, - data->set.doh_verifystatus ? 1L : 0L); + data->set.doh_verifystatus ? 1L : 0L); /* Inherit *some* SSL options from the user's transfer. This is a best-guess as to which options are needed for compatibility. #3661 @@ -376,20 +376,16 @@ static CURLcode doh_probe_run(struct Curl_easy *data, doh->set.ssl.custom_capath = data->set.ssl.custom_capath; doh->set.ssl.custom_cablob = data->set.ssl.custom_cablob; if(data->set.str[STRING_SSL_CAFILE]) { - ERROR_CHECK_SETOPT(CURLOPT_CAINFO, - data->set.str[STRING_SSL_CAFILE]); + ERROR_CHECK_SETOPT(CURLOPT_CAINFO, data->set.str[STRING_SSL_CAFILE]); } if(data->set.blobs[BLOB_CAINFO]) { - ERROR_CHECK_SETOPT(CURLOPT_CAINFO_BLOB, - data->set.blobs[BLOB_CAINFO]); + ERROR_CHECK_SETOPT(CURLOPT_CAINFO_BLOB, data->set.blobs[BLOB_CAINFO]); } if(data->set.str[STRING_SSL_CAPATH]) { - ERROR_CHECK_SETOPT(CURLOPT_CAPATH, - data->set.str[STRING_SSL_CAPATH]); + ERROR_CHECK_SETOPT(CURLOPT_CAPATH, data->set.str[STRING_SSL_CAPATH]); } if(data->set.str[STRING_SSL_CRLFILE]) { - ERROR_CHECK_SETOPT(CURLOPT_CRLFILE, - data->set.str[STRING_SSL_CRLFILE]); + ERROR_CHECK_SETOPT(CURLOPT_CRLFILE, data->set.str[STRING_SSL_CRLFILE]); } if(data->set.ssl.certinfo) ERROR_CHECK_SETOPT(CURLOPT_CERTINFO, 1L); @@ -717,7 +713,6 @@ UNITTEST void de_init(struct dohentry *de) curlx_dyn_init(&de->cname[i], DYN_DOH_CNAME); } - UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, size_t dohlen, DNStype dnstype, @@ -851,7 +846,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh, #ifdef USE_HTTTPS if((type != CURL_DNS_TYPE_NS) && !d->numcname && !d->numaddr && - !d->numhttps_rrs) + !d->numhttps_rrs) #else if((type != CURL_DNS_TYPE_NS) && !d->numcname && !d->numaddr) #endif @@ -895,8 +890,7 @@ static void doh_show(struct Curl_easy *data, #ifdef USE_HTTPSRR for(i = 0; i < d->numhttps_rrs; i++) { # ifdef DEBUGBUILD - doh_print_buf(data, "DoH HTTPS", - d->https_rrs[i].val, d->https_rrs[i].len); + doh_print_buf(data, "DoH HTTPS", d->https_rrs[i].val, d->https_rrs[i].len); # else infof(data, "DoH HTTPS RR: length %d", d->https_rrs[i].len); # endif @@ -907,7 +901,7 @@ static void doh_show(struct Curl_easy *data, } } #else -#define doh_show(x,y) +#define doh_show(x, y) #endif /* @@ -1022,16 +1016,16 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname, static const char *doh_type2name(DNStype dnstype) { switch(dnstype) { - case CURL_DNS_TYPE_A: - return "A"; - case CURL_DNS_TYPE_AAAA: - return "AAAA"; + case CURL_DNS_TYPE_A: + return "A"; + case CURL_DNS_TYPE_AAAA: + return "AAAA"; #ifdef USE_HTTPSRR - case CURL_DNS_TYPE_HTTPS: - return "HTTPS"; + case CURL_DNS_TYPE_HTTPS: + return "HTTPS"; #endif - default: - return "unknown"; + default: + return "unknown"; } } #endif @@ -1174,8 +1168,7 @@ UNITTEST void doh_print_httpsrr(struct Curl_easy *data, struct Curl_https_rrinfo *hrr) { DEBUGASSERT(hrr); - infof(data, "HTTPS RR: priority %d, target: %s", - hrr->priority, hrr->target); + infof(data, "HTTPS RR: priority %d, target: %s", hrr->priority, hrr->target); if(hrr->alpns[0] != ALPN_none) infof(data, "HTTPS RR: alpns %u %u %u %u", hrr->alpns[0], hrr->alpns[1], hrr->alpns[2], hrr->alpns[3]); @@ -1285,7 +1278,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data, doh_print_httpsrr(data, hrr); # endif dns->hinfo = hrr; - } + } #endif /* and add the entry to the cache */ data->state.async.dns = dns; @@ -1323,8 +1316,7 @@ void Curl_doh_close(struct Curl_easy *data) doh->probe_resp[slot].probe_mid = UINT32_MAX; /* should have been called before data is removed from multi handle */ DEBUGASSERT(data->multi); - probe_data = data->multi ? Curl_multi_get_easy(data->multi, mid) : - NULL; + probe_data = data->multi ? Curl_multi_get_easy(data->multi, mid) : NULL; if(!probe_data) { DEBUGF(infof(data, "Curl_doh_close: xfer for mid=%u not found!", doh->probe_resp[slot].probe_mid)); diff --git a/lib/doh.h b/lib/doh.h index ffd0cb0879..16732173ab 100644 --- a/lib/doh.h +++ b/lib/doh.h @@ -122,7 +122,7 @@ CURLcode Curl_doh(struct Curl_easy *data, const char *hostname, CURLcode Curl_doh_is_resolved(struct Curl_easy *data, struct Curl_dns_entry **dns); -#define DOH_MAX_ADDR 24 +#define DOH_MAX_ADDR 24 #define DOH_MAX_CNAME 4 #define DOH_MAX_HTTPS 4 @@ -180,8 +180,8 @@ UNITTEST void de_cleanup(struct dohentry *d); #endif #else /* if DoH is disabled */ -#define Curl_doh(a,b,c,d,e) NULL -#define Curl_doh_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST +#define Curl_doh(a, b, c, d, e) NULL +#define Curl_doh_is_resolved(x, y) CURLE_COULDNT_RESOLVE_HOST #endif #endif /* HEADER_CURL_DOH_H */ diff --git a/lib/dynhds.c b/lib/dynhds.c index ebe1beae58..b6654114d6 100644 --- a/lib/dynhds.c +++ b/lib/dynhds.c @@ -55,9 +55,8 @@ entry_new(const char *name, size_t namelen, return e; } -static struct dynhds_entry * -entry_append(struct dynhds_entry *e, - const char *value, size_t valuelen) +static struct dynhds_entry *entry_append(struct dynhds_entry *e, + const char *value, size_t valuelen) { struct dynhds_entry *e2; size_t valuelen2 = e->valuelen + 1 + valuelen; @@ -171,7 +170,7 @@ CURLcode Curl_dynhds_add(struct dynhds *dynhds, if(dynhds->strs_len + namelen + valuelen > dynhds->max_strs_size) return CURLE_OUT_OF_MEMORY; -entry = entry_new(name, namelen, value, valuelen, dynhds->opts); + entry = entry_new(name, namelen, value, valuelen, dynhds->opts); if(!entry) goto out; @@ -234,11 +233,11 @@ CURLcode Curl_dynhds_h1_add_line(struct dynhds *dynhds, } if(!line_len) return CURLE_BAD_FUNCTION_ARGUMENT; - e = dynhds->hds[dynhds->hds_len-1]; + e = dynhds->hds[dynhds->hds_len - 1]; e2 = entry_append(e, line, line_len); if(!e2) return CURLE_OUT_OF_MEMORY; - dynhds->hds[dynhds->hds_len-1] = e2; + dynhds->hds[dynhds->hds_len - 1] = e2; entry_free(e); return CURLE_OK; } diff --git a/lib/easy.c b/lib/easy.c index c60819fcdc..d2f6c36c0d 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -87,7 +87,7 @@ static long easy_init_flags; #ifdef GLOBAL_INIT_IS_THREADSAFE static curl_simple_lock s_lock = CURL_SIMPLE_LOCK_INIT; -#define global_init_lock() curl_simple_lock_lock(&s_lock) +#define global_init_lock() curl_simple_lock_lock(&s_lock) #define global_init_unlock() curl_simple_lock_unlock(&s_lock) #else @@ -208,7 +208,6 @@ fail: return CURLE_FAILED_INIT; } - /** * curl_global_init() globally initializes curl given a bitwise set of the * different features of what to initialize. @@ -411,7 +410,6 @@ static int events_timer(CURLM *multi, /* multi handle */ return 0; } - /* poll2cselect * * convert from poll() bit definitions to libcurl's CURL_CSELECT_* ones @@ -428,7 +426,6 @@ static int poll2cselect(int pollmask) return omask; } - /* socketcb2poll * * convert from libcurl' CURL_POLL_* bit definitions to poll()'s @@ -485,10 +482,9 @@ static int events_socket(CURL *easy, /* easy handle */ /* The socket 's' is already being monitored, update the activity mask. Convert from libcurl bitmask to the poll one. */ m->socket.events = socketcb2poll(what); - infof(data, "socket cb: socket %" FMT_SOCKET_T - " UPDATED as %s%s", s, - (what&CURL_POLL_IN) ? "IN" : "", - (what&CURL_POLL_OUT) ? "OUT" : ""); + infof(data, "socket cb: socket %" FMT_SOCKET_T " UPDATED as %s%s", s, + (what & CURL_POLL_IN) ? "IN" : "", + (what & CURL_POLL_OUT) ? "OUT" : ""); } break; } @@ -512,8 +508,8 @@ static int events_socket(CURL *easy, /* easy handle */ m->socket.revents = 0; ev->list = m; infof(data, "socket cb: socket %" FMT_SOCKET_T " ADDED as %s%s", s, - (what&CURL_POLL_IN) ? "IN" : "", - (what&CURL_POLL_OUT) ? "OUT" : ""); + (what & CURL_POLL_IN) ? "IN" : "", + (what & CURL_POLL_OUT) ? "OUT" : ""); } else return CURLE_OUT_OF_MEMORY; @@ -523,7 +519,6 @@ static int events_socket(CURL *easy, /* easy handle */ return 0; } - /* * events_setup() * @@ -681,7 +676,6 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) return result; } - /* easy_events() * * Runs a transfer in a blocking manner using the events-based API @@ -690,7 +684,7 @@ static CURLcode easy_events(struct Curl_multi *multi) { /* this struct is made static to allow it to be used after this function returns and curl_multi_remove_handle() is called */ - static struct events evs = {-1, FALSE, 0, NULL, 0}; + static struct events evs = { -1, FALSE, 0, NULL, 0 }; /* if running event-based, do some further multi inits */ events_setup(multi, &evs); @@ -738,7 +732,6 @@ static CURLcode easy_transfer(struct Curl_multi *multi) return result; } - /* * easy_perform() is the internal interface that performs a blocking * transfer as previously setup. @@ -1201,7 +1194,6 @@ CURLcode curl_easy_pause(CURL *d, int action) return result; } - static CURLcode easy_connection(struct Curl_easy *data, struct connectdata **connp) { diff --git a/lib/easy_lock.h b/lib/easy_lock.h index f8998cc547..a10fe3103a 100644 --- a/lib/easy_lock.h +++ b/lib/easy_lock.h @@ -30,10 +30,10 @@ #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 -#define curl_simple_lock SRWLOCK +#define curl_simple_lock SRWLOCK #define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT -#define curl_simple_lock_lock(m) AcquireSRWLockExclusive(m) +#define curl_simple_lock_lock(m) AcquireSRWLockExclusive(m) #define curl_simple_lock_unlock(m) ReleaseSRWLockExclusive(m) #elif defined(HAVE_ATOMIC) && defined(HAVE_STDATOMIC_H) @@ -42,7 +42,7 @@ #include #endif -#define curl_simple_lock atomic_int +#define curl_simple_lock atomic_int #define CURL_SIMPLE_LOCK_INIT 0 #ifndef __INTEL_COMPILER @@ -91,14 +91,14 @@ static CURL_INLINE void curl_simple_lock_unlock(curl_simple_lock *lock) #include -#define curl_simple_lock pthread_mutex_t -#define CURL_SIMPLE_LOCK_INIT PTHREAD_MUTEX_INITIALIZER -#define curl_simple_lock_lock(m) pthread_mutex_lock(m) +#define curl_simple_lock pthread_mutex_t +#define CURL_SIMPLE_LOCK_INIT PTHREAD_MUTEX_INITIALIZER +#define curl_simple_lock_lock(m) pthread_mutex_lock(m) #define curl_simple_lock_unlock(m) pthread_mutex_unlock(m) #else -#undef GLOBAL_INIT_IS_THREADSAFE +#undef GLOBAL_INIT_IS_THREADSAFE #endif diff --git a/lib/easyoptions.c b/lib/easyoptions.c index 03d676df0e..4bd8457f75 100644 --- a/lib/easyoptions.c +++ b/lib/easyoptions.c @@ -29,348 +29,352 @@ /* all easy setopt options listed in alphabetical order */ const struct curl_easyoption Curl_easyopts[] = { - {"ABSTRACT_UNIX_SOCKET", CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOT_STRING, 0}, - {"ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS, CURLOT_LONG, 0}, - {"ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, 0}, - {"ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE, CURLOT_LONG, 0}, - {"ALTSVC", CURLOPT_ALTSVC, CURLOT_STRING, 0}, - {"ALTSVC_CTRL", CURLOPT_ALTSVC_CTRL, CURLOT_LONG, 0}, - {"APPEND", CURLOPT_APPEND, CURLOT_LONG, 0}, - {"AUTOREFERER", CURLOPT_AUTOREFERER, CURLOT_LONG, 0}, - {"AWS_SIGV4", CURLOPT_AWS_SIGV4, CURLOT_STRING, 0}, - {"BUFFERSIZE", CURLOPT_BUFFERSIZE, CURLOT_LONG, 0}, - {"CAINFO", CURLOPT_CAINFO, CURLOT_STRING, 0}, - {"CAINFO_BLOB", CURLOPT_CAINFO_BLOB, CURLOT_BLOB, 0}, - {"CAPATH", CURLOPT_CAPATH, CURLOT_STRING, 0}, - {"CA_CACHE_TIMEOUT", CURLOPT_CA_CACHE_TIMEOUT, CURLOT_LONG, 0}, - {"CERTINFO", CURLOPT_CERTINFO, CURLOT_LONG, 0}, - {"CHUNK_BGN_FUNCTION", CURLOPT_CHUNK_BGN_FUNCTION, CURLOT_FUNCTION, 0}, - {"CHUNK_DATA", CURLOPT_CHUNK_DATA, CURLOT_CBPTR, 0}, - {"CHUNK_END_FUNCTION", CURLOPT_CHUNK_END_FUNCTION, CURLOT_FUNCTION, 0}, - {"CLOSESOCKETDATA", CURLOPT_CLOSESOCKETDATA, CURLOT_CBPTR, 0}, - {"CLOSESOCKETFUNCTION", CURLOPT_CLOSESOCKETFUNCTION, CURLOT_FUNCTION, 0}, - {"CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT, CURLOT_LONG, 0}, - {"CONNECTTIMEOUT_MS", CURLOPT_CONNECTTIMEOUT_MS, CURLOT_LONG, 0}, - {"CONNECT_ONLY", CURLOPT_CONNECT_ONLY, CURLOT_LONG, 0}, - {"CONNECT_TO", CURLOPT_CONNECT_TO, CURLOT_SLIST, 0}, - {"CONV_FROM_NETWORK_FUNCTION", CURLOPT_CONV_FROM_NETWORK_FUNCTION, - CURLOT_FUNCTION, 0}, - {"CONV_FROM_UTF8_FUNCTION", CURLOPT_CONV_FROM_UTF8_FUNCTION, - CURLOT_FUNCTION, 0}, - {"CONV_TO_NETWORK_FUNCTION", CURLOPT_CONV_TO_NETWORK_FUNCTION, - CURLOT_FUNCTION, 0}, - {"COOKIE", CURLOPT_COOKIE, CURLOT_STRING, 0}, - {"COOKIEFILE", CURLOPT_COOKIEFILE, CURLOT_STRING, 0}, - {"COOKIEJAR", CURLOPT_COOKIEJAR, CURLOT_STRING, 0}, - {"COOKIELIST", CURLOPT_COOKIELIST, CURLOT_STRING, 0}, - {"COOKIESESSION", CURLOPT_COOKIESESSION, CURLOT_LONG, 0}, - {"COPYPOSTFIELDS", CURLOPT_COPYPOSTFIELDS, CURLOT_OBJECT, 0}, - {"CRLF", CURLOPT_CRLF, CURLOT_LONG, 0}, - {"CRLFILE", CURLOPT_CRLFILE, CURLOT_STRING, 0}, - {"CURLU", CURLOPT_CURLU, CURLOT_OBJECT, 0}, - {"CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST, CURLOT_STRING, 0}, - {"DEBUGDATA", CURLOPT_DEBUGDATA, CURLOT_CBPTR, 0}, - {"DEBUGFUNCTION", CURLOPT_DEBUGFUNCTION, CURLOT_FUNCTION, 0}, - {"DEFAULT_PROTOCOL", CURLOPT_DEFAULT_PROTOCOL, CURLOT_STRING, 0}, - {"DIRLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, 0}, - {"DISALLOW_USERNAME_IN_URL", CURLOPT_DISALLOW_USERNAME_IN_URL, - CURLOT_LONG, 0}, - {"DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT, CURLOT_LONG, 0}, - {"DNS_INTERFACE", CURLOPT_DNS_INTERFACE, CURLOT_STRING, 0}, - {"DNS_LOCAL_IP4", CURLOPT_DNS_LOCAL_IP4, CURLOT_STRING, 0}, - {"DNS_LOCAL_IP6", CURLOPT_DNS_LOCAL_IP6, CURLOT_STRING, 0}, - {"DNS_SERVERS", CURLOPT_DNS_SERVERS, CURLOT_STRING, 0}, - {"DNS_SHUFFLE_ADDRESSES", CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOT_LONG, 0}, - {"DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOT_LONG, 0}, - {"DOH_SSL_VERIFYHOST", CURLOPT_DOH_SSL_VERIFYHOST, CURLOT_LONG, 0}, - {"DOH_SSL_VERIFYPEER", CURLOPT_DOH_SSL_VERIFYPEER, CURLOT_LONG, 0}, - {"DOH_SSL_VERIFYSTATUS", CURLOPT_DOH_SSL_VERIFYSTATUS, CURLOT_LONG, 0}, - {"DOH_URL", CURLOPT_DOH_URL, CURLOT_STRING, 0}, - {"ECH", CURLOPT_ECH, CURLOT_STRING, 0}, - {"EGDSOCKET", CURLOPT_EGDSOCKET, CURLOT_STRING, 0}, - {"ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, CURLOT_FLAG_ALIAS}, - {"ERRORBUFFER", CURLOPT_ERRORBUFFER, CURLOT_OBJECT, 0}, - {"EXPECT_100_TIMEOUT_MS", CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOT_LONG, 0}, - {"FAILONERROR", CURLOPT_FAILONERROR, CURLOT_LONG, 0}, - {"FILE", CURLOPT_WRITEDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS}, - {"FILETIME", CURLOPT_FILETIME, CURLOT_LONG, 0}, - {"FNMATCH_DATA", CURLOPT_FNMATCH_DATA, CURLOT_CBPTR, 0}, - {"FNMATCH_FUNCTION", CURLOPT_FNMATCH_FUNCTION, CURLOT_FUNCTION, 0}, - {"FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION, CURLOT_LONG, 0}, - {"FORBID_REUSE", CURLOPT_FORBID_REUSE, CURLOT_LONG, 0}, - {"FRESH_CONNECT", CURLOPT_FRESH_CONNECT, CURLOT_LONG, 0}, - {"FTPAPPEND", CURLOPT_APPEND, CURLOT_LONG, CURLOT_FLAG_ALIAS}, - {"FTPLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, CURLOT_FLAG_ALIAS}, - {"FTPPORT", CURLOPT_FTPPORT, CURLOT_STRING, 0}, - {"FTPSSLAUTH", CURLOPT_FTPSSLAUTH, CURLOT_VALUES, 0}, - {"FTP_ACCOUNT", CURLOPT_FTP_ACCOUNT, CURLOT_STRING, 0}, - {"FTP_ALTERNATIVE_TO_USER", CURLOPT_FTP_ALTERNATIVE_TO_USER, - CURLOT_STRING, 0}, - {"FTP_CREATE_MISSING_DIRS", CURLOPT_FTP_CREATE_MISSING_DIRS, - CURLOT_LONG, 0}, - {"FTP_FILEMETHOD", CURLOPT_FTP_FILEMETHOD, CURLOT_VALUES, 0}, - {"FTP_RESPONSE_TIMEOUT", CURLOPT_SERVER_RESPONSE_TIMEOUT, - CURLOT_LONG, CURLOT_FLAG_ALIAS}, - {"FTP_SKIP_PASV_IP", CURLOPT_FTP_SKIP_PASV_IP, CURLOT_LONG, 0}, - {"FTP_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, CURLOT_FLAG_ALIAS}, - {"FTP_SSL_CCC", CURLOPT_FTP_SSL_CCC, CURLOT_LONG, 0}, - {"FTP_USE_EPRT", CURLOPT_FTP_USE_EPRT, CURLOT_LONG, 0}, - {"FTP_USE_EPSV", CURLOPT_FTP_USE_EPSV, CURLOT_LONG, 0}, - {"FTP_USE_PRET", CURLOPT_FTP_USE_PRET, CURLOT_LONG, 0}, - {"GSSAPI_DELEGATION", CURLOPT_GSSAPI_DELEGATION, CURLOT_VALUES, 0}, - {"HAPPY_EYEBALLS_TIMEOUT_MS", CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, - CURLOT_LONG, 0}, - {"HAPROXYPROTOCOL", CURLOPT_HAPROXYPROTOCOL, CURLOT_LONG, 0}, - {"HAPROXY_CLIENT_IP", CURLOPT_HAPROXY_CLIENT_IP, CURLOT_STRING, 0}, - {"HEADER", CURLOPT_HEADER, CURLOT_LONG, 0}, - {"HEADERDATA", CURLOPT_HEADERDATA, CURLOT_CBPTR, 0}, - {"HEADERFUNCTION", CURLOPT_HEADERFUNCTION, CURLOT_FUNCTION, 0}, - {"HEADEROPT", CURLOPT_HEADEROPT, CURLOT_VALUES, 0}, - {"HSTS", CURLOPT_HSTS, CURLOT_STRING, 0}, - {"HSTSREADDATA", CURLOPT_HSTSREADDATA, CURLOT_CBPTR, 0}, - {"HSTSREADFUNCTION", CURLOPT_HSTSREADFUNCTION, CURLOT_FUNCTION, 0}, - {"HSTSWRITEDATA", CURLOPT_HSTSWRITEDATA, CURLOT_CBPTR, 0}, - {"HSTSWRITEFUNCTION", CURLOPT_HSTSWRITEFUNCTION, CURLOT_FUNCTION, 0}, - {"HSTS_CTRL", CURLOPT_HSTS_CTRL, CURLOT_LONG, 0}, - {"HTTP09_ALLOWED", CURLOPT_HTTP09_ALLOWED, CURLOT_LONG, 0}, - {"HTTP200ALIASES", CURLOPT_HTTP200ALIASES, CURLOT_SLIST, 0}, - {"HTTPAUTH", CURLOPT_HTTPAUTH, CURLOT_VALUES, 0}, - {"HTTPGET", CURLOPT_HTTPGET, CURLOT_LONG, 0}, - {"HTTPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, 0}, - {"HTTPPOST", CURLOPT_HTTPPOST, CURLOT_OBJECT, 0}, - {"HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL, CURLOT_LONG, 0}, - {"HTTP_CONTENT_DECODING", CURLOPT_HTTP_CONTENT_DECODING, CURLOT_LONG, 0}, - {"HTTP_TRANSFER_DECODING", CURLOPT_HTTP_TRANSFER_DECODING, CURLOT_LONG, 0}, - {"HTTP_VERSION", CURLOPT_HTTP_VERSION, CURLOT_VALUES, 0}, - {"IGNORE_CONTENT_LENGTH", CURLOPT_IGNORE_CONTENT_LENGTH, CURLOT_LONG, 0}, - {"INFILE", CURLOPT_READDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS}, - {"INFILESIZE", CURLOPT_INFILESIZE, CURLOT_LONG, 0}, - {"INFILESIZE_LARGE", CURLOPT_INFILESIZE_LARGE, CURLOT_OFF_T, 0}, - {"INTERFACE", CURLOPT_INTERFACE, CURLOT_STRING, 0}, - {"INTERLEAVEDATA", CURLOPT_INTERLEAVEDATA, CURLOT_CBPTR, 0}, - {"INTERLEAVEFUNCTION", CURLOPT_INTERLEAVEFUNCTION, CURLOT_FUNCTION, 0}, - {"IOCTLDATA", CURLOPT_IOCTLDATA, CURLOT_CBPTR, 0}, - {"IOCTLFUNCTION", CURLOPT_IOCTLFUNCTION, CURLOT_FUNCTION, 0}, - {"IPRESOLVE", CURLOPT_IPRESOLVE, CURLOT_VALUES, 0}, - {"ISSUERCERT", CURLOPT_ISSUERCERT, CURLOT_STRING, 0}, - {"ISSUERCERT_BLOB", CURLOPT_ISSUERCERT_BLOB, CURLOT_BLOB, 0}, - {"KEEP_SENDING_ON_ERROR", CURLOPT_KEEP_SENDING_ON_ERROR, CURLOT_LONG, 0}, - {"KEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, 0}, - {"KRB4LEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, CURLOT_FLAG_ALIAS}, - {"KRBLEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, 0}, - {"LOCALPORT", CURLOPT_LOCALPORT, CURLOT_LONG, 0}, - {"LOCALPORTRANGE", CURLOPT_LOCALPORTRANGE, CURLOT_LONG, 0}, - {"LOGIN_OPTIONS", CURLOPT_LOGIN_OPTIONS, CURLOT_STRING, 0}, - {"LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT, CURLOT_LONG, 0}, - {"LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME, CURLOT_LONG, 0}, - {"MAIL_AUTH", CURLOPT_MAIL_AUTH, CURLOT_STRING, 0}, - {"MAIL_FROM", CURLOPT_MAIL_FROM, CURLOT_STRING, 0}, - {"MAIL_RCPT", CURLOPT_MAIL_RCPT, CURLOT_SLIST, 0}, - {"MAIL_RCPT_ALLLOWFAILS", CURLOPT_MAIL_RCPT_ALLOWFAILS, - CURLOT_LONG, CURLOT_FLAG_ALIAS}, - {"MAIL_RCPT_ALLOWFAILS", CURLOPT_MAIL_RCPT_ALLOWFAILS, CURLOT_LONG, 0}, - {"MAXAGE_CONN", CURLOPT_MAXAGE_CONN, CURLOT_LONG, 0}, - {"MAXCONNECTS", CURLOPT_MAXCONNECTS, CURLOT_LONG, 0}, - {"MAXFILESIZE", CURLOPT_MAXFILESIZE, CURLOT_LONG, 0}, - {"MAXFILESIZE_LARGE", CURLOPT_MAXFILESIZE_LARGE, CURLOT_OFF_T, 0}, - {"MAXLIFETIME_CONN", CURLOPT_MAXLIFETIME_CONN, CURLOT_LONG, 0}, - {"MAXREDIRS", CURLOPT_MAXREDIRS, CURLOT_LONG, 0}, - {"MAX_RECV_SPEED_LARGE", CURLOPT_MAX_RECV_SPEED_LARGE, CURLOT_OFF_T, 0}, - {"MAX_SEND_SPEED_LARGE", CURLOPT_MAX_SEND_SPEED_LARGE, CURLOT_OFF_T, 0}, - {"MIMEPOST", CURLOPT_MIMEPOST, CURLOT_OBJECT, 0}, - {"MIME_OPTIONS", CURLOPT_MIME_OPTIONS, CURLOT_LONG, 0}, - {"NETRC", CURLOPT_NETRC, CURLOT_VALUES, 0}, - {"NETRC_FILE", CURLOPT_NETRC_FILE, CURLOT_STRING, 0}, - {"NEW_DIRECTORY_PERMS", CURLOPT_NEW_DIRECTORY_PERMS, CURLOT_LONG, 0}, - {"NEW_FILE_PERMS", CURLOPT_NEW_FILE_PERMS, CURLOT_LONG, 0}, - {"NOBODY", CURLOPT_NOBODY, CURLOT_LONG, 0}, - {"NOPROGRESS", CURLOPT_NOPROGRESS, CURLOT_LONG, 0}, - {"NOPROXY", CURLOPT_NOPROXY, CURLOT_STRING, 0}, - {"NOSIGNAL", CURLOPT_NOSIGNAL, CURLOT_LONG, 0}, - {"OPENSOCKETDATA", CURLOPT_OPENSOCKETDATA, CURLOT_CBPTR, 0}, - {"OPENSOCKETFUNCTION", CURLOPT_OPENSOCKETFUNCTION, CURLOT_FUNCTION, 0}, - {"PASSWORD", CURLOPT_PASSWORD, CURLOT_STRING, 0}, - {"PATH_AS_IS", CURLOPT_PATH_AS_IS, CURLOT_LONG, 0}, - {"PINNEDPUBLICKEY", CURLOPT_PINNEDPUBLICKEY, CURLOT_STRING, 0}, - {"PIPEWAIT", CURLOPT_PIPEWAIT, CURLOT_LONG, 0}, - {"PORT", CURLOPT_PORT, CURLOT_LONG, 0}, - {"POST", CURLOPT_POST, CURLOT_LONG, 0}, - {"POST301", CURLOPT_POSTREDIR, CURLOT_VALUES, CURLOT_FLAG_ALIAS}, - {"POSTFIELDS", CURLOPT_POSTFIELDS, CURLOT_OBJECT, 0}, - {"POSTFIELDSIZE", CURLOPT_POSTFIELDSIZE, CURLOT_LONG, 0}, - {"POSTFIELDSIZE_LARGE", CURLOPT_POSTFIELDSIZE_LARGE, CURLOT_OFF_T, 0}, - {"POSTQUOTE", CURLOPT_POSTQUOTE, CURLOT_SLIST, 0}, - {"POSTREDIR", CURLOPT_POSTREDIR, CURLOT_VALUES, 0}, - {"PREQUOTE", CURLOPT_PREQUOTE, CURLOT_SLIST, 0}, - {"PREREQDATA", CURLOPT_PREREQDATA, CURLOT_CBPTR, 0}, - {"PREREQFUNCTION", CURLOPT_PREREQFUNCTION, CURLOT_FUNCTION, 0}, - {"PRE_PROXY", CURLOPT_PRE_PROXY, CURLOT_STRING, 0}, - {"PRIVATE", CURLOPT_PRIVATE, CURLOT_OBJECT, 0}, - {"PROGRESSDATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS}, - {"PROGRESSFUNCTION", CURLOPT_PROGRESSFUNCTION, CURLOT_FUNCTION, 0}, - {"PROTOCOLS", CURLOPT_PROTOCOLS, CURLOT_LONG, 0}, - {"PROTOCOLS_STR", CURLOPT_PROTOCOLS_STR, CURLOT_STRING, 0}, - {"PROXY", CURLOPT_PROXY, CURLOT_STRING, 0}, - {"PROXYAUTH", CURLOPT_PROXYAUTH, CURLOT_VALUES, 0}, - {"PROXYHEADER", CURLOPT_PROXYHEADER, CURLOT_SLIST, 0}, - {"PROXYPASSWORD", CURLOPT_PROXYPASSWORD, CURLOT_STRING, 0}, - {"PROXYPORT", CURLOPT_PROXYPORT, CURLOT_LONG, 0}, - {"PROXYTYPE", CURLOPT_PROXYTYPE, CURLOT_VALUES, 0}, - {"PROXYUSERNAME", CURLOPT_PROXYUSERNAME, CURLOT_STRING, 0}, - {"PROXYUSERPWD", CURLOPT_PROXYUSERPWD, CURLOT_STRING, 0}, - {"PROXY_CAINFO", CURLOPT_PROXY_CAINFO, CURLOT_STRING, 0}, - {"PROXY_CAINFO_BLOB", CURLOPT_PROXY_CAINFO_BLOB, CURLOT_BLOB, 0}, - {"PROXY_CAPATH", CURLOPT_PROXY_CAPATH, CURLOT_STRING, 0}, - {"PROXY_CRLFILE", CURLOPT_PROXY_CRLFILE, CURLOT_STRING, 0}, - {"PROXY_ISSUERCERT", CURLOPT_PROXY_ISSUERCERT, CURLOT_STRING, 0}, - {"PROXY_ISSUERCERT_BLOB", CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOT_BLOB, 0}, - {"PROXY_KEYPASSWD", CURLOPT_PROXY_KEYPASSWD, CURLOT_STRING, 0}, - {"PROXY_PINNEDPUBLICKEY", CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOT_STRING, 0}, - {"PROXY_SERVICE_NAME", CURLOPT_PROXY_SERVICE_NAME, CURLOT_STRING, 0}, - {"PROXY_SSLCERT", CURLOPT_PROXY_SSLCERT, CURLOT_STRING, 0}, - {"PROXY_SSLCERTTYPE", CURLOPT_PROXY_SSLCERTTYPE, CURLOT_STRING, 0}, - {"PROXY_SSLCERT_BLOB", CURLOPT_PROXY_SSLCERT_BLOB, CURLOT_BLOB, 0}, - {"PROXY_SSLKEY", CURLOPT_PROXY_SSLKEY, CURLOT_STRING, 0}, - {"PROXY_SSLKEYTYPE", CURLOPT_PROXY_SSLKEYTYPE, CURLOT_STRING, 0}, - {"PROXY_SSLKEY_BLOB", CURLOPT_PROXY_SSLKEY_BLOB, CURLOT_BLOB, 0}, - {"PROXY_SSLVERSION", CURLOPT_PROXY_SSLVERSION, CURLOT_VALUES, 0}, - {"PROXY_SSL_CIPHER_LIST", CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOT_STRING, 0}, - {"PROXY_SSL_OPTIONS", CURLOPT_PROXY_SSL_OPTIONS, CURLOT_LONG, 0}, - {"PROXY_SSL_VERIFYHOST", CURLOPT_PROXY_SSL_VERIFYHOST, CURLOT_LONG, 0}, - {"PROXY_SSL_VERIFYPEER", CURLOPT_PROXY_SSL_VERIFYPEER, CURLOT_LONG, 0}, - {"PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS, CURLOT_STRING, 0}, - {"PROXY_TLSAUTH_PASSWORD", CURLOPT_PROXY_TLSAUTH_PASSWORD, - CURLOT_STRING, 0}, - {"PROXY_TLSAUTH_TYPE", CURLOPT_PROXY_TLSAUTH_TYPE, CURLOT_STRING, 0}, - {"PROXY_TLSAUTH_USERNAME", CURLOPT_PROXY_TLSAUTH_USERNAME, - CURLOT_STRING, 0}, - {"PROXY_TRANSFER_MODE", CURLOPT_PROXY_TRANSFER_MODE, CURLOT_LONG, 0}, - {"PUT", CURLOPT_PUT, CURLOT_LONG, 0}, - {"QUICK_EXIT", CURLOPT_QUICK_EXIT, CURLOT_LONG, 0}, - {"QUOTE", CURLOPT_QUOTE, CURLOT_SLIST, 0}, - {"RANDOM_FILE", CURLOPT_RANDOM_FILE, CURLOT_STRING, 0}, - {"RANGE", CURLOPT_RANGE, CURLOT_STRING, 0}, - {"READDATA", CURLOPT_READDATA, CURLOT_CBPTR, 0}, - {"READFUNCTION", CURLOPT_READFUNCTION, CURLOT_FUNCTION, 0}, - {"REDIR_PROTOCOLS", CURLOPT_REDIR_PROTOCOLS, CURLOT_LONG, 0}, - {"REDIR_PROTOCOLS_STR", CURLOPT_REDIR_PROTOCOLS_STR, CURLOT_STRING, 0}, - {"REFERER", CURLOPT_REFERER, CURLOT_STRING, 0}, - {"REQUEST_TARGET", CURLOPT_REQUEST_TARGET, CURLOT_STRING, 0}, - {"RESOLVE", CURLOPT_RESOLVE, CURLOT_SLIST, 0}, - {"RESOLVER_START_DATA", CURLOPT_RESOLVER_START_DATA, CURLOT_CBPTR, 0}, - {"RESOLVER_START_FUNCTION", CURLOPT_RESOLVER_START_FUNCTION, - CURLOT_FUNCTION, 0}, - {"RESUME_FROM", CURLOPT_RESUME_FROM, CURLOT_LONG, 0}, - {"RESUME_FROM_LARGE", CURLOPT_RESUME_FROM_LARGE, CURLOT_OFF_T, 0}, - {"RTSPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, CURLOT_FLAG_ALIAS}, - {"RTSP_CLIENT_CSEQ", CURLOPT_RTSP_CLIENT_CSEQ, CURLOT_LONG, 0}, - {"RTSP_REQUEST", CURLOPT_RTSP_REQUEST, CURLOT_VALUES, 0}, - {"RTSP_SERVER_CSEQ", CURLOPT_RTSP_SERVER_CSEQ, CURLOT_LONG, 0}, - {"RTSP_SESSION_ID", CURLOPT_RTSP_SESSION_ID, CURLOT_STRING, 0}, - {"RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI, CURLOT_STRING, 0}, - {"RTSP_TRANSPORT", CURLOPT_RTSP_TRANSPORT, CURLOT_STRING, 0}, - {"SASL_AUTHZID", CURLOPT_SASL_AUTHZID, CURLOT_STRING, 0}, - {"SASL_IR", CURLOPT_SASL_IR, CURLOT_LONG, 0}, - {"SEEKDATA", CURLOPT_SEEKDATA, CURLOT_CBPTR, 0}, - {"SEEKFUNCTION", CURLOPT_SEEKFUNCTION, CURLOT_FUNCTION, 0}, - {"SERVER_RESPONSE_TIMEOUT", CURLOPT_SERVER_RESPONSE_TIMEOUT, - CURLOT_LONG, 0}, - {"SERVER_RESPONSE_TIMEOUT_MS", CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, - CURLOT_LONG, 0}, - {"SERVICE_NAME", CURLOPT_SERVICE_NAME, CURLOT_STRING, 0}, - {"SHARE", CURLOPT_SHARE, CURLOT_OBJECT, 0}, - {"SOCKOPTDATA", CURLOPT_SOCKOPTDATA, CURLOT_CBPTR, 0}, - {"SOCKOPTFUNCTION", CURLOPT_SOCKOPTFUNCTION, CURLOT_FUNCTION, 0}, - {"SOCKS5_AUTH", CURLOPT_SOCKS5_AUTH, CURLOT_LONG, 0}, - {"SOCKS5_GSSAPI_NEC", CURLOPT_SOCKS5_GSSAPI_NEC, CURLOT_LONG, 0}, - {"SOCKS5_GSSAPI_SERVICE", CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOT_STRING, 0}, - {"SSH_AUTH_TYPES", CURLOPT_SSH_AUTH_TYPES, CURLOT_VALUES, 0}, - {"SSH_COMPRESSION", CURLOPT_SSH_COMPRESSION, CURLOT_LONG, 0}, - {"SSH_HOSTKEYDATA", CURLOPT_SSH_HOSTKEYDATA, CURLOT_CBPTR, 0}, - {"SSH_HOSTKEYFUNCTION", CURLOPT_SSH_HOSTKEYFUNCTION, CURLOT_FUNCTION, 0}, - {"SSH_HOST_PUBLIC_KEY_MD5", CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, - CURLOT_STRING, 0}, - {"SSH_HOST_PUBLIC_KEY_SHA256", CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, - CURLOT_STRING, 0}, - {"SSH_KEYDATA", CURLOPT_SSH_KEYDATA, CURLOT_CBPTR, 0}, - {"SSH_KEYFUNCTION", CURLOPT_SSH_KEYFUNCTION, CURLOT_FUNCTION, 0}, - {"SSH_KNOWNHOSTS", CURLOPT_SSH_KNOWNHOSTS, CURLOT_STRING, 0}, - {"SSH_PRIVATE_KEYFILE", CURLOPT_SSH_PRIVATE_KEYFILE, CURLOT_STRING, 0}, - {"SSH_PUBLIC_KEYFILE", CURLOPT_SSH_PUBLIC_KEYFILE, CURLOT_STRING, 0}, - {"SSLCERT", CURLOPT_SSLCERT, CURLOT_STRING, 0}, - {"SSLCERTPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS}, - {"SSLCERTTYPE", CURLOPT_SSLCERTTYPE, CURLOT_STRING, 0}, - {"SSLCERT_BLOB", CURLOPT_SSLCERT_BLOB, CURLOT_BLOB, 0}, - {"SSLENGINE", CURLOPT_SSLENGINE, CURLOT_STRING, 0}, - {"SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT, CURLOT_LONG, 0}, - {"SSLKEY", CURLOPT_SSLKEY, CURLOT_STRING, 0}, - {"SSLKEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS}, - {"SSLKEYTYPE", CURLOPT_SSLKEYTYPE, CURLOT_STRING, 0}, - {"SSLKEY_BLOB", CURLOPT_SSLKEY_BLOB, CURLOT_BLOB, 0}, - {"SSLVERSION", CURLOPT_SSLVERSION, CURLOT_VALUES, 0}, - {"SSL_CIPHER_LIST", CURLOPT_SSL_CIPHER_LIST, CURLOT_STRING, 0}, - {"SSL_CTX_DATA", CURLOPT_SSL_CTX_DATA, CURLOT_CBPTR, 0}, - {"SSL_CTX_FUNCTION", CURLOPT_SSL_CTX_FUNCTION, CURLOT_FUNCTION, 0}, - {"SSL_EC_CURVES", CURLOPT_SSL_EC_CURVES, CURLOT_STRING, 0}, - {"SSL_ENABLE_ALPN", CURLOPT_SSL_ENABLE_ALPN, CURLOT_LONG, 0}, - {"SSL_ENABLE_NPN", CURLOPT_SSL_ENABLE_NPN, CURLOT_LONG, 0}, - {"SSL_FALSESTART", CURLOPT_SSL_FALSESTART, CURLOT_LONG, 0}, - {"SSL_OPTIONS", CURLOPT_SSL_OPTIONS, CURLOT_VALUES, 0}, - {"SSL_SESSIONID_CACHE", CURLOPT_SSL_SESSIONID_CACHE, CURLOT_LONG, 0}, - {"SSL_SIGNATURE_ALGORITHMS", CURLOPT_SSL_SIGNATURE_ALGORITHMS, - CURLOT_STRING, 0}, - {"SSL_VERIFYHOST", CURLOPT_SSL_VERIFYHOST, CURLOT_LONG, 0}, - {"SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER, CURLOT_LONG, 0}, - {"SSL_VERIFYSTATUS", CURLOPT_SSL_VERIFYSTATUS, CURLOT_LONG, 0}, - {"STDERR", CURLOPT_STDERR, CURLOT_OBJECT, 0}, - {"STREAM_DEPENDS", CURLOPT_STREAM_DEPENDS, CURLOT_OBJECT, 0}, - {"STREAM_DEPENDS_E", CURLOPT_STREAM_DEPENDS_E, CURLOT_OBJECT, 0}, - {"STREAM_WEIGHT", CURLOPT_STREAM_WEIGHT, CURLOT_LONG, 0}, - {"SUPPRESS_CONNECT_HEADERS", CURLOPT_SUPPRESS_CONNECT_HEADERS, - CURLOT_LONG, 0}, - {"TCP_FASTOPEN", CURLOPT_TCP_FASTOPEN, CURLOT_LONG, 0}, - {"TCP_KEEPALIVE", CURLOPT_TCP_KEEPALIVE, CURLOT_LONG, 0}, - {"TCP_KEEPCNT", CURLOPT_TCP_KEEPCNT, CURLOT_LONG, 0}, - {"TCP_KEEPIDLE", CURLOPT_TCP_KEEPIDLE, CURLOT_LONG, 0}, - {"TCP_KEEPINTVL", CURLOPT_TCP_KEEPINTVL, CURLOT_LONG, 0}, - {"TCP_NODELAY", CURLOPT_TCP_NODELAY, CURLOT_LONG, 0}, - {"TELNETOPTIONS", CURLOPT_TELNETOPTIONS, CURLOT_SLIST, 0}, - {"TFTP_BLKSIZE", CURLOPT_TFTP_BLKSIZE, CURLOT_LONG, 0}, - {"TFTP_NO_OPTIONS", CURLOPT_TFTP_NO_OPTIONS, CURLOT_LONG, 0}, - {"TIMECONDITION", CURLOPT_TIMECONDITION, CURLOT_VALUES, 0}, - {"TIMEOUT", CURLOPT_TIMEOUT, CURLOT_LONG, 0}, - {"TIMEOUT_MS", CURLOPT_TIMEOUT_MS, CURLOT_LONG, 0}, - {"TIMEVALUE", CURLOPT_TIMEVALUE, CURLOT_LONG, 0}, - {"TIMEVALUE_LARGE", CURLOPT_TIMEVALUE_LARGE, CURLOT_OFF_T, 0}, - {"TLS13_CIPHERS", CURLOPT_TLS13_CIPHERS, CURLOT_STRING, 0}, - {"TLSAUTH_PASSWORD", CURLOPT_TLSAUTH_PASSWORD, CURLOT_STRING, 0}, - {"TLSAUTH_TYPE", CURLOPT_TLSAUTH_TYPE, CURLOT_STRING, 0}, - {"TLSAUTH_USERNAME", CURLOPT_TLSAUTH_USERNAME, CURLOT_STRING, 0}, - {"TRAILERDATA", CURLOPT_TRAILERDATA, CURLOT_CBPTR, 0}, - {"TRAILERFUNCTION", CURLOPT_TRAILERFUNCTION, CURLOT_FUNCTION, 0}, - {"TRANSFERTEXT", CURLOPT_TRANSFERTEXT, CURLOT_LONG, 0}, - {"TRANSFER_ENCODING", CURLOPT_TRANSFER_ENCODING, CURLOT_LONG, 0}, - {"UNIX_SOCKET_PATH", CURLOPT_UNIX_SOCKET_PATH, CURLOT_STRING, 0}, - {"UNRESTRICTED_AUTH", CURLOPT_UNRESTRICTED_AUTH, CURLOT_LONG, 0}, - {"UPKEEP_INTERVAL_MS", CURLOPT_UPKEEP_INTERVAL_MS, CURLOT_LONG, 0}, - {"UPLOAD", CURLOPT_UPLOAD, CURLOT_LONG, 0}, - {"UPLOAD_BUFFERSIZE", CURLOPT_UPLOAD_BUFFERSIZE, CURLOT_LONG, 0}, - {"UPLOAD_FLAGS", CURLOPT_UPLOAD_FLAGS, CURLOT_LONG, 0}, - {"URL", CURLOPT_URL, CURLOT_STRING, 0}, - {"USERAGENT", CURLOPT_USERAGENT, CURLOT_STRING, 0}, - {"USERNAME", CURLOPT_USERNAME, CURLOT_STRING, 0}, - {"USERPWD", CURLOPT_USERPWD, CURLOT_STRING, 0}, - {"USE_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, 0}, - {"VERBOSE", CURLOPT_VERBOSE, CURLOT_LONG, 0}, - {"WILDCARDMATCH", CURLOPT_WILDCARDMATCH, CURLOT_LONG, 0}, - {"WRITEDATA", CURLOPT_WRITEDATA, CURLOT_CBPTR, 0}, - {"WRITEFUNCTION", CURLOPT_WRITEFUNCTION, CURLOT_FUNCTION, 0}, - {"WRITEHEADER", CURLOPT_HEADERDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS}, - {"WS_OPTIONS", CURLOPT_WS_OPTIONS, CURLOT_LONG, 0}, - {"XFERINFODATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, 0}, - {"XFERINFOFUNCTION", CURLOPT_XFERINFOFUNCTION, CURLOT_FUNCTION, 0}, - {"XOAUTH2_BEARER", CURLOPT_XOAUTH2_BEARER, CURLOT_STRING, 0}, - {NULL, CURLOPT_LASTENTRY, CURLOT_LONG, 0} /* end of table */ + { "ABSTRACT_UNIX_SOCKET", CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOT_STRING, 0 }, + { "ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS, CURLOT_LONG, 0 }, + { "ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, 0 }, + { "ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE, CURLOT_LONG, 0 }, + { "ALTSVC", CURLOPT_ALTSVC, CURLOT_STRING, 0 }, + { "ALTSVC_CTRL", CURLOPT_ALTSVC_CTRL, CURLOT_LONG, 0 }, + { "APPEND", CURLOPT_APPEND, CURLOT_LONG, 0 }, + { "AUTOREFERER", CURLOPT_AUTOREFERER, CURLOT_LONG, 0 }, + { "AWS_SIGV4", CURLOPT_AWS_SIGV4, CURLOT_STRING, 0 }, + { "BUFFERSIZE", CURLOPT_BUFFERSIZE, CURLOT_LONG, 0 }, + { "CAINFO", CURLOPT_CAINFO, CURLOT_STRING, 0 }, + { "CAINFO_BLOB", CURLOPT_CAINFO_BLOB, CURLOT_BLOB, 0 }, + { "CAPATH", CURLOPT_CAPATH, CURLOT_STRING, 0 }, + { "CA_CACHE_TIMEOUT", CURLOPT_CA_CACHE_TIMEOUT, CURLOT_LONG, 0 }, + { "CERTINFO", CURLOPT_CERTINFO, CURLOT_LONG, 0 }, + { "CHUNK_BGN_FUNCTION", CURLOPT_CHUNK_BGN_FUNCTION, CURLOT_FUNCTION, 0 }, + { "CHUNK_DATA", CURLOPT_CHUNK_DATA, CURLOT_CBPTR, 0 }, + { "CHUNK_END_FUNCTION", CURLOPT_CHUNK_END_FUNCTION, CURLOT_FUNCTION, 0 }, + { "CLOSESOCKETDATA", CURLOPT_CLOSESOCKETDATA, CURLOT_CBPTR, 0 }, + { "CLOSESOCKETFUNCTION", CURLOPT_CLOSESOCKETFUNCTION, CURLOT_FUNCTION, 0 }, + { "CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT, CURLOT_LONG, 0 }, + { "CONNECTTIMEOUT_MS", CURLOPT_CONNECTTIMEOUT_MS, CURLOT_LONG, 0 }, + { "CONNECT_ONLY", CURLOPT_CONNECT_ONLY, CURLOT_LONG, 0 }, + { "CONNECT_TO", CURLOPT_CONNECT_TO, CURLOT_SLIST, 0 }, + { "CONV_FROM_NETWORK_FUNCTION", CURLOPT_CONV_FROM_NETWORK_FUNCTION, + CURLOT_FUNCTION, 0 }, + { "CONV_FROM_UTF8_FUNCTION", CURLOPT_CONV_FROM_UTF8_FUNCTION, + CURLOT_FUNCTION, 0 }, + { "CONV_TO_NETWORK_FUNCTION", CURLOPT_CONV_TO_NETWORK_FUNCTION, + CURLOT_FUNCTION, 0 }, + { "COOKIE", CURLOPT_COOKIE, CURLOT_STRING, 0 }, + { "COOKIEFILE", CURLOPT_COOKIEFILE, CURLOT_STRING, 0 }, + { "COOKIEJAR", CURLOPT_COOKIEJAR, CURLOT_STRING, 0 }, + { "COOKIELIST", CURLOPT_COOKIELIST, CURLOT_STRING, 0 }, + { "COOKIESESSION", CURLOPT_COOKIESESSION, CURLOT_LONG, 0 }, + { "COPYPOSTFIELDS", CURLOPT_COPYPOSTFIELDS, CURLOT_OBJECT, 0 }, + { "CRLF", CURLOPT_CRLF, CURLOT_LONG, 0 }, + { "CRLFILE", CURLOPT_CRLFILE, CURLOT_STRING, 0 }, + { "CURLU", CURLOPT_CURLU, CURLOT_OBJECT, 0 }, + { "CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST, CURLOT_STRING, 0 }, + { "DEBUGDATA", CURLOPT_DEBUGDATA, CURLOT_CBPTR, 0 }, + { "DEBUGFUNCTION", CURLOPT_DEBUGFUNCTION, CURLOT_FUNCTION, 0 }, + { "DEFAULT_PROTOCOL", CURLOPT_DEFAULT_PROTOCOL, CURLOT_STRING, 0 }, + { "DIRLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, 0 }, + { "DISALLOW_USERNAME_IN_URL", CURLOPT_DISALLOW_USERNAME_IN_URL, + CURLOT_LONG, 0 }, + { "DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT, CURLOT_LONG, 0 }, + { "DNS_INTERFACE", CURLOPT_DNS_INTERFACE, CURLOT_STRING, 0 }, + { "DNS_LOCAL_IP4", CURLOPT_DNS_LOCAL_IP4, CURLOT_STRING, 0 }, + { "DNS_LOCAL_IP6", CURLOPT_DNS_LOCAL_IP6, CURLOT_STRING, 0 }, + { "DNS_SERVERS", CURLOPT_DNS_SERVERS, CURLOT_STRING, 0 }, + { "DNS_SHUFFLE_ADDRESSES", CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOT_LONG, 0 }, + { "DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOT_LONG, 0 }, + { "DOH_SSL_VERIFYHOST", CURLOPT_DOH_SSL_VERIFYHOST, CURLOT_LONG, 0 }, + { "DOH_SSL_VERIFYPEER", CURLOPT_DOH_SSL_VERIFYPEER, CURLOT_LONG, 0 }, + { "DOH_SSL_VERIFYSTATUS", CURLOPT_DOH_SSL_VERIFYSTATUS, CURLOT_LONG, 0 }, + { "DOH_URL", CURLOPT_DOH_URL, CURLOT_STRING, 0 }, + { "ECH", CURLOPT_ECH, CURLOT_STRING, 0 }, + { "EGDSOCKET", CURLOPT_EGDSOCKET, CURLOT_STRING, 0 }, + { "ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, CURLOT_FLAG_ALIAS }, + { "ERRORBUFFER", CURLOPT_ERRORBUFFER, CURLOT_OBJECT, 0 }, + { "EXPECT_100_TIMEOUT_MS", CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOT_LONG, 0 }, + { "FAILONERROR", CURLOPT_FAILONERROR, CURLOT_LONG, 0 }, + { "FILE", CURLOPT_WRITEDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS }, + { "FILETIME", CURLOPT_FILETIME, CURLOT_LONG, 0 }, + { "FNMATCH_DATA", CURLOPT_FNMATCH_DATA, CURLOT_CBPTR, 0 }, + { "FNMATCH_FUNCTION", CURLOPT_FNMATCH_FUNCTION, CURLOT_FUNCTION, 0 }, + { "FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION, CURLOT_LONG, 0 }, + { "FORBID_REUSE", CURLOPT_FORBID_REUSE, CURLOT_LONG, 0 }, + { "FRESH_CONNECT", CURLOPT_FRESH_CONNECT, CURLOT_LONG, 0 }, + { "FTPAPPEND", CURLOPT_APPEND, CURLOT_LONG, CURLOT_FLAG_ALIAS }, + { "FTPLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, CURLOT_FLAG_ALIAS }, + { "FTPPORT", CURLOPT_FTPPORT, CURLOT_STRING, 0 }, + { "FTPSSLAUTH", CURLOPT_FTPSSLAUTH, CURLOT_VALUES, 0 }, + { "FTP_ACCOUNT", CURLOPT_FTP_ACCOUNT, CURLOT_STRING, 0 }, + { "FTP_ALTERNATIVE_TO_USER", CURLOPT_FTP_ALTERNATIVE_TO_USER, + CURLOT_STRING, 0 }, + { "FTP_CREATE_MISSING_DIRS", CURLOPT_FTP_CREATE_MISSING_DIRS, + CURLOT_LONG, 0 }, + { "FTP_FILEMETHOD", CURLOPT_FTP_FILEMETHOD, CURLOT_VALUES, 0 }, + { "FTP_RESPONSE_TIMEOUT", CURLOPT_SERVER_RESPONSE_TIMEOUT, + CURLOT_LONG, CURLOT_FLAG_ALIAS }, + { "FTP_SKIP_PASV_IP", CURLOPT_FTP_SKIP_PASV_IP, CURLOT_LONG, 0 }, + { "FTP_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, CURLOT_FLAG_ALIAS }, + { "FTP_SSL_CCC", CURLOPT_FTP_SSL_CCC, CURLOT_LONG, 0 }, + { "FTP_USE_EPRT", CURLOPT_FTP_USE_EPRT, CURLOT_LONG, 0 }, + { "FTP_USE_EPSV", CURLOPT_FTP_USE_EPSV, CURLOT_LONG, 0 }, + { "FTP_USE_PRET", CURLOPT_FTP_USE_PRET, CURLOT_LONG, 0 }, + { "GSSAPI_DELEGATION", CURLOPT_GSSAPI_DELEGATION, CURLOT_VALUES, 0 }, + { "HAPPY_EYEBALLS_TIMEOUT_MS", CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, + CURLOT_LONG, 0 }, + { "HAPROXYPROTOCOL", CURLOPT_HAPROXYPROTOCOL, CURLOT_LONG, 0 }, + { "HAPROXY_CLIENT_IP", CURLOPT_HAPROXY_CLIENT_IP, CURLOT_STRING, 0 }, + { "HEADER", CURLOPT_HEADER, CURLOT_LONG, 0 }, + { "HEADERDATA", CURLOPT_HEADERDATA, CURLOT_CBPTR, 0 }, + { "HEADERFUNCTION", CURLOPT_HEADERFUNCTION, CURLOT_FUNCTION, 0 }, + { "HEADEROPT", CURLOPT_HEADEROPT, CURLOT_VALUES, 0 }, + { "HSTS", CURLOPT_HSTS, CURLOT_STRING, 0 }, + { "HSTSREADDATA", CURLOPT_HSTSREADDATA, CURLOT_CBPTR, 0 }, + { "HSTSREADFUNCTION", CURLOPT_HSTSREADFUNCTION, CURLOT_FUNCTION, 0 }, + { "HSTSWRITEDATA", CURLOPT_HSTSWRITEDATA, CURLOT_CBPTR, 0 }, + { "HSTSWRITEFUNCTION", CURLOPT_HSTSWRITEFUNCTION, CURLOT_FUNCTION, 0 }, + { "HSTS_CTRL", CURLOPT_HSTS_CTRL, CURLOT_LONG, 0 }, + { "HTTP09_ALLOWED", CURLOPT_HTTP09_ALLOWED, CURLOT_LONG, 0 }, + { "HTTP200ALIASES", CURLOPT_HTTP200ALIASES, CURLOT_SLIST, 0 }, + { "HTTPAUTH", CURLOPT_HTTPAUTH, CURLOT_VALUES, 0 }, + { "HTTPGET", CURLOPT_HTTPGET, CURLOT_LONG, 0 }, + { "HTTPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, 0 }, + { "HTTPPOST", CURLOPT_HTTPPOST, CURLOT_OBJECT, 0 }, + { "HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL, CURLOT_LONG, 0 }, + { "HTTP_CONTENT_DECODING", CURLOPT_HTTP_CONTENT_DECODING, CURLOT_LONG, 0 }, + { "HTTP_TRANSFER_DECODING", CURLOPT_HTTP_TRANSFER_DECODING, + CURLOT_LONG, 0 }, + { "HTTP_VERSION", CURLOPT_HTTP_VERSION, CURLOT_VALUES, 0 }, + { "IGNORE_CONTENT_LENGTH", CURLOPT_IGNORE_CONTENT_LENGTH, CURLOT_LONG, 0 }, + { "INFILE", CURLOPT_READDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS }, + { "INFILESIZE", CURLOPT_INFILESIZE, CURLOT_LONG, 0 }, + { "INFILESIZE_LARGE", CURLOPT_INFILESIZE_LARGE, CURLOT_OFF_T, 0 }, + { "INTERFACE", CURLOPT_INTERFACE, CURLOT_STRING, 0 }, + { "INTERLEAVEDATA", CURLOPT_INTERLEAVEDATA, CURLOT_CBPTR, 0 }, + { "INTERLEAVEFUNCTION", CURLOPT_INTERLEAVEFUNCTION, CURLOT_FUNCTION, 0 }, + { "IOCTLDATA", CURLOPT_IOCTLDATA, CURLOT_CBPTR, 0 }, + { "IOCTLFUNCTION", CURLOPT_IOCTLFUNCTION, CURLOT_FUNCTION, 0 }, + { "IPRESOLVE", CURLOPT_IPRESOLVE, CURLOT_VALUES, 0 }, + { "ISSUERCERT", CURLOPT_ISSUERCERT, CURLOT_STRING, 0 }, + { "ISSUERCERT_BLOB", CURLOPT_ISSUERCERT_BLOB, CURLOT_BLOB, 0 }, + { "KEEP_SENDING_ON_ERROR", CURLOPT_KEEP_SENDING_ON_ERROR, CURLOT_LONG, 0 }, + { "KEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, 0 }, + { "KRB4LEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, CURLOT_FLAG_ALIAS }, + { "KRBLEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, 0 }, + { "LOCALPORT", CURLOPT_LOCALPORT, CURLOT_LONG, 0 }, + { "LOCALPORTRANGE", CURLOPT_LOCALPORTRANGE, CURLOT_LONG, 0 }, + { "LOGIN_OPTIONS", CURLOPT_LOGIN_OPTIONS, CURLOT_STRING, 0 }, + { "LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT, CURLOT_LONG, 0 }, + { "LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME, CURLOT_LONG, 0 }, + { "MAIL_AUTH", CURLOPT_MAIL_AUTH, CURLOT_STRING, 0 }, + { "MAIL_FROM", CURLOPT_MAIL_FROM, CURLOT_STRING, 0 }, + { "MAIL_RCPT", CURLOPT_MAIL_RCPT, CURLOT_SLIST, 0 }, + { "MAIL_RCPT_ALLLOWFAILS", CURLOPT_MAIL_RCPT_ALLOWFAILS, + CURLOT_LONG, CURLOT_FLAG_ALIAS }, + { "MAIL_RCPT_ALLOWFAILS", CURLOPT_MAIL_RCPT_ALLOWFAILS, CURLOT_LONG, 0 }, + { "MAXAGE_CONN", CURLOPT_MAXAGE_CONN, CURLOT_LONG, 0 }, + { "MAXCONNECTS", CURLOPT_MAXCONNECTS, CURLOT_LONG, 0 }, + { "MAXFILESIZE", CURLOPT_MAXFILESIZE, CURLOT_LONG, 0 }, + { "MAXFILESIZE_LARGE", CURLOPT_MAXFILESIZE_LARGE, CURLOT_OFF_T, 0 }, + { "MAXLIFETIME_CONN", CURLOPT_MAXLIFETIME_CONN, CURLOT_LONG, 0 }, + { "MAXREDIRS", CURLOPT_MAXREDIRS, CURLOT_LONG, 0 }, + { "MAX_RECV_SPEED_LARGE", CURLOPT_MAX_RECV_SPEED_LARGE, CURLOT_OFF_T, 0 }, + { "MAX_SEND_SPEED_LARGE", CURLOPT_MAX_SEND_SPEED_LARGE, CURLOT_OFF_T, 0 }, + { "MIMEPOST", CURLOPT_MIMEPOST, CURLOT_OBJECT, 0 }, + { "MIME_OPTIONS", CURLOPT_MIME_OPTIONS, CURLOT_LONG, 0 }, + { "NETRC", CURLOPT_NETRC, CURLOT_VALUES, 0 }, + { "NETRC_FILE", CURLOPT_NETRC_FILE, CURLOT_STRING, 0 }, + { "NEW_DIRECTORY_PERMS", CURLOPT_NEW_DIRECTORY_PERMS, CURLOT_LONG, 0 }, + { "NEW_FILE_PERMS", CURLOPT_NEW_FILE_PERMS, CURLOT_LONG, 0 }, + { "NOBODY", CURLOPT_NOBODY, CURLOT_LONG, 0 }, + { "NOPROGRESS", CURLOPT_NOPROGRESS, CURLOT_LONG, 0 }, + { "NOPROXY", CURLOPT_NOPROXY, CURLOT_STRING, 0 }, + { "NOSIGNAL", CURLOPT_NOSIGNAL, CURLOT_LONG, 0 }, + { "OPENSOCKETDATA", CURLOPT_OPENSOCKETDATA, CURLOT_CBPTR, 0 }, + { "OPENSOCKETFUNCTION", CURLOPT_OPENSOCKETFUNCTION, CURLOT_FUNCTION, 0 }, + { "PASSWORD", CURLOPT_PASSWORD, CURLOT_STRING, 0 }, + { "PATH_AS_IS", CURLOPT_PATH_AS_IS, CURLOT_LONG, 0 }, + { "PINNEDPUBLICKEY", CURLOPT_PINNEDPUBLICKEY, CURLOT_STRING, 0 }, + { "PIPEWAIT", CURLOPT_PIPEWAIT, CURLOT_LONG, 0 }, + { "PORT", CURLOPT_PORT, CURLOT_LONG, 0 }, + { "POST", CURLOPT_POST, CURLOT_LONG, 0 }, + { "POST301", CURLOPT_POSTREDIR, CURLOT_VALUES, CURLOT_FLAG_ALIAS }, + { "POSTFIELDS", CURLOPT_POSTFIELDS, CURLOT_OBJECT, 0 }, + { "POSTFIELDSIZE", CURLOPT_POSTFIELDSIZE, CURLOT_LONG, 0 }, + { "POSTFIELDSIZE_LARGE", CURLOPT_POSTFIELDSIZE_LARGE, CURLOT_OFF_T, 0 }, + { "POSTQUOTE", CURLOPT_POSTQUOTE, CURLOT_SLIST, 0 }, + { "POSTREDIR", CURLOPT_POSTREDIR, CURLOT_VALUES, 0 }, + { "PREQUOTE", CURLOPT_PREQUOTE, CURLOT_SLIST, 0 }, + { "PREREQDATA", CURLOPT_PREREQDATA, CURLOT_CBPTR, 0 }, + { "PREREQFUNCTION", CURLOPT_PREREQFUNCTION, CURLOT_FUNCTION, 0 }, + { "PRE_PROXY", CURLOPT_PRE_PROXY, CURLOT_STRING, 0 }, + { "PRIVATE", CURLOPT_PRIVATE, CURLOT_OBJECT, 0 }, + { "PROGRESSDATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS }, + { "PROGRESSFUNCTION", CURLOPT_PROGRESSFUNCTION, CURLOT_FUNCTION, 0 }, + { "PROTOCOLS", CURLOPT_PROTOCOLS, CURLOT_LONG, 0 }, + { "PROTOCOLS_STR", CURLOPT_PROTOCOLS_STR, CURLOT_STRING, 0 }, + { "PROXY", CURLOPT_PROXY, CURLOT_STRING, 0 }, + { "PROXYAUTH", CURLOPT_PROXYAUTH, CURLOT_VALUES, 0 }, + { "PROXYHEADER", CURLOPT_PROXYHEADER, CURLOT_SLIST, 0 }, + { "PROXYPASSWORD", CURLOPT_PROXYPASSWORD, CURLOT_STRING, 0 }, + { "PROXYPORT", CURLOPT_PROXYPORT, CURLOT_LONG, 0 }, + { "PROXYTYPE", CURLOPT_PROXYTYPE, CURLOT_VALUES, 0 }, + { "PROXYUSERNAME", CURLOPT_PROXYUSERNAME, CURLOT_STRING, 0 }, + { "PROXYUSERPWD", CURLOPT_PROXYUSERPWD, CURLOT_STRING, 0 }, + { "PROXY_CAINFO", CURLOPT_PROXY_CAINFO, CURLOT_STRING, 0 }, + { "PROXY_CAINFO_BLOB", CURLOPT_PROXY_CAINFO_BLOB, CURLOT_BLOB, 0 }, + { "PROXY_CAPATH", CURLOPT_PROXY_CAPATH, CURLOT_STRING, 0 }, + { "PROXY_CRLFILE", CURLOPT_PROXY_CRLFILE, CURLOT_STRING, 0 }, + { "PROXY_ISSUERCERT", CURLOPT_PROXY_ISSUERCERT, CURLOT_STRING, 0 }, + { "PROXY_ISSUERCERT_BLOB", CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOT_BLOB, 0 }, + { "PROXY_KEYPASSWD", CURLOPT_PROXY_KEYPASSWD, CURLOT_STRING, 0 }, + { "PROXY_PINNEDPUBLICKEY", CURLOPT_PROXY_PINNEDPUBLICKEY, + CURLOT_STRING, 0 }, + { "PROXY_SERVICE_NAME", CURLOPT_PROXY_SERVICE_NAME, CURLOT_STRING, 0 }, + { "PROXY_SSLCERT", CURLOPT_PROXY_SSLCERT, CURLOT_STRING, 0 }, + { "PROXY_SSLCERTTYPE", CURLOPT_PROXY_SSLCERTTYPE, CURLOT_STRING, 0 }, + { "PROXY_SSLCERT_BLOB", CURLOPT_PROXY_SSLCERT_BLOB, CURLOT_BLOB, 0 }, + { "PROXY_SSLKEY", CURLOPT_PROXY_SSLKEY, CURLOT_STRING, 0 }, + { "PROXY_SSLKEYTYPE", CURLOPT_PROXY_SSLKEYTYPE, CURLOT_STRING, 0 }, + { "PROXY_SSLKEY_BLOB", CURLOPT_PROXY_SSLKEY_BLOB, CURLOT_BLOB, 0 }, + { "PROXY_SSLVERSION", CURLOPT_PROXY_SSLVERSION, CURLOT_VALUES, 0 }, + { "PROXY_SSL_CIPHER_LIST", CURLOPT_PROXY_SSL_CIPHER_LIST, + CURLOT_STRING, 0 }, + { "PROXY_SSL_OPTIONS", CURLOPT_PROXY_SSL_OPTIONS, CURLOT_LONG, 0 }, + { "PROXY_SSL_VERIFYHOST", CURLOPT_PROXY_SSL_VERIFYHOST, CURLOT_LONG, 0 }, + { "PROXY_SSL_VERIFYPEER", CURLOPT_PROXY_SSL_VERIFYPEER, CURLOT_LONG, 0 }, + { "PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS, CURLOT_STRING, 0 }, + { "PROXY_TLSAUTH_PASSWORD", CURLOPT_PROXY_TLSAUTH_PASSWORD, + CURLOT_STRING, 0 }, + { "PROXY_TLSAUTH_TYPE", CURLOPT_PROXY_TLSAUTH_TYPE, CURLOT_STRING, 0 }, + { "PROXY_TLSAUTH_USERNAME", CURLOPT_PROXY_TLSAUTH_USERNAME, + CURLOT_STRING, 0 }, + { "PROXY_TRANSFER_MODE", CURLOPT_PROXY_TRANSFER_MODE, CURLOT_LONG, 0 }, + { "PUT", CURLOPT_PUT, CURLOT_LONG, 0 }, + { "QUICK_EXIT", CURLOPT_QUICK_EXIT, CURLOT_LONG, 0 }, + { "QUOTE", CURLOPT_QUOTE, CURLOT_SLIST, 0 }, + { "RANDOM_FILE", CURLOPT_RANDOM_FILE, CURLOT_STRING, 0 }, + { "RANGE", CURLOPT_RANGE, CURLOT_STRING, 0 }, + { "READDATA", CURLOPT_READDATA, CURLOT_CBPTR, 0 }, + { "READFUNCTION", CURLOPT_READFUNCTION, CURLOT_FUNCTION, 0 }, + { "REDIR_PROTOCOLS", CURLOPT_REDIR_PROTOCOLS, CURLOT_LONG, 0 }, + { "REDIR_PROTOCOLS_STR", CURLOPT_REDIR_PROTOCOLS_STR, CURLOT_STRING, 0 }, + { "REFERER", CURLOPT_REFERER, CURLOT_STRING, 0 }, + { "REQUEST_TARGET", CURLOPT_REQUEST_TARGET, CURLOT_STRING, 0 }, + { "RESOLVE", CURLOPT_RESOLVE, CURLOT_SLIST, 0 }, + { "RESOLVER_START_DATA", CURLOPT_RESOLVER_START_DATA, CURLOT_CBPTR, 0 }, + { "RESOLVER_START_FUNCTION", CURLOPT_RESOLVER_START_FUNCTION, + CURLOT_FUNCTION, 0 }, + { "RESUME_FROM", CURLOPT_RESUME_FROM, CURLOT_LONG, 0 }, + { "RESUME_FROM_LARGE", CURLOPT_RESUME_FROM_LARGE, CURLOT_OFF_T, 0 }, + { "RTSPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, CURLOT_FLAG_ALIAS }, + { "RTSP_CLIENT_CSEQ", CURLOPT_RTSP_CLIENT_CSEQ, CURLOT_LONG, 0 }, + { "RTSP_REQUEST", CURLOPT_RTSP_REQUEST, CURLOT_VALUES, 0 }, + { "RTSP_SERVER_CSEQ", CURLOPT_RTSP_SERVER_CSEQ, CURLOT_LONG, 0 }, + { "RTSP_SESSION_ID", CURLOPT_RTSP_SESSION_ID, CURLOT_STRING, 0 }, + { "RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI, CURLOT_STRING, 0 }, + { "RTSP_TRANSPORT", CURLOPT_RTSP_TRANSPORT, CURLOT_STRING, 0 }, + { "SASL_AUTHZID", CURLOPT_SASL_AUTHZID, CURLOT_STRING, 0 }, + { "SASL_IR", CURLOPT_SASL_IR, CURLOT_LONG, 0 }, + { "SEEKDATA", CURLOPT_SEEKDATA, CURLOT_CBPTR, 0 }, + { "SEEKFUNCTION", CURLOPT_SEEKFUNCTION, CURLOT_FUNCTION, 0 }, + { "SERVER_RESPONSE_TIMEOUT", CURLOPT_SERVER_RESPONSE_TIMEOUT, + CURLOT_LONG, 0 }, + { "SERVER_RESPONSE_TIMEOUT_MS", CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, + CURLOT_LONG, 0 }, + { "SERVICE_NAME", CURLOPT_SERVICE_NAME, CURLOT_STRING, 0 }, + { "SHARE", CURLOPT_SHARE, CURLOT_OBJECT, 0 }, + { "SOCKOPTDATA", CURLOPT_SOCKOPTDATA, CURLOT_CBPTR, 0 }, + { "SOCKOPTFUNCTION", CURLOPT_SOCKOPTFUNCTION, CURLOT_FUNCTION, 0 }, + { "SOCKS5_AUTH", CURLOPT_SOCKS5_AUTH, CURLOT_LONG, 0 }, + { "SOCKS5_GSSAPI_NEC", CURLOPT_SOCKS5_GSSAPI_NEC, CURLOT_LONG, 0 }, + { "SOCKS5_GSSAPI_SERVICE", CURLOPT_SOCKS5_GSSAPI_SERVICE, + CURLOT_STRING, 0 }, + { "SSH_AUTH_TYPES", CURLOPT_SSH_AUTH_TYPES, CURLOT_VALUES, 0 }, + { "SSH_COMPRESSION", CURLOPT_SSH_COMPRESSION, CURLOT_LONG, 0 }, + { "SSH_HOSTKEYDATA", CURLOPT_SSH_HOSTKEYDATA, CURLOT_CBPTR, 0 }, + { "SSH_HOSTKEYFUNCTION", CURLOPT_SSH_HOSTKEYFUNCTION, CURLOT_FUNCTION, 0 }, + { "SSH_HOST_PUBLIC_KEY_MD5", CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, + CURLOT_STRING, 0 }, + { "SSH_HOST_PUBLIC_KEY_SHA256", CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, + CURLOT_STRING, 0 }, + { "SSH_KEYDATA", CURLOPT_SSH_KEYDATA, CURLOT_CBPTR, 0 }, + { "SSH_KEYFUNCTION", CURLOPT_SSH_KEYFUNCTION, CURLOT_FUNCTION, 0 }, + { "SSH_KNOWNHOSTS", CURLOPT_SSH_KNOWNHOSTS, CURLOT_STRING, 0 }, + { "SSH_PRIVATE_KEYFILE", CURLOPT_SSH_PRIVATE_KEYFILE, CURLOT_STRING, 0 }, + { "SSH_PUBLIC_KEYFILE", CURLOPT_SSH_PUBLIC_KEYFILE, CURLOT_STRING, 0 }, + { "SSLCERT", CURLOPT_SSLCERT, CURLOT_STRING, 0 }, + { "SSLCERTPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS }, + { "SSLCERTTYPE", CURLOPT_SSLCERTTYPE, CURLOT_STRING, 0 }, + { "SSLCERT_BLOB", CURLOPT_SSLCERT_BLOB, CURLOT_BLOB, 0 }, + { "SSLENGINE", CURLOPT_SSLENGINE, CURLOT_STRING, 0 }, + { "SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT, CURLOT_LONG, 0 }, + { "SSLKEY", CURLOPT_SSLKEY, CURLOT_STRING, 0 }, + { "SSLKEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS }, + { "SSLKEYTYPE", CURLOPT_SSLKEYTYPE, CURLOT_STRING, 0 }, + { "SSLKEY_BLOB", CURLOPT_SSLKEY_BLOB, CURLOT_BLOB, 0 }, + { "SSLVERSION", CURLOPT_SSLVERSION, CURLOT_VALUES, 0 }, + { "SSL_CIPHER_LIST", CURLOPT_SSL_CIPHER_LIST, CURLOT_STRING, 0 }, + { "SSL_CTX_DATA", CURLOPT_SSL_CTX_DATA, CURLOT_CBPTR, 0 }, + { "SSL_CTX_FUNCTION", CURLOPT_SSL_CTX_FUNCTION, CURLOT_FUNCTION, 0 }, + { "SSL_EC_CURVES", CURLOPT_SSL_EC_CURVES, CURLOT_STRING, 0 }, + { "SSL_ENABLE_ALPN", CURLOPT_SSL_ENABLE_ALPN, CURLOT_LONG, 0 }, + { "SSL_ENABLE_NPN", CURLOPT_SSL_ENABLE_NPN, CURLOT_LONG, 0 }, + { "SSL_FALSESTART", CURLOPT_SSL_FALSESTART, CURLOT_LONG, 0 }, + { "SSL_OPTIONS", CURLOPT_SSL_OPTIONS, CURLOT_VALUES, 0 }, + { "SSL_SESSIONID_CACHE", CURLOPT_SSL_SESSIONID_CACHE, CURLOT_LONG, 0 }, + { "SSL_SIGNATURE_ALGORITHMS", CURLOPT_SSL_SIGNATURE_ALGORITHMS, + CURLOT_STRING, 0 }, + { "SSL_VERIFYHOST", CURLOPT_SSL_VERIFYHOST, CURLOT_LONG, 0 }, + { "SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER, CURLOT_LONG, 0 }, + { "SSL_VERIFYSTATUS", CURLOPT_SSL_VERIFYSTATUS, CURLOT_LONG, 0 }, + { "STDERR", CURLOPT_STDERR, CURLOT_OBJECT, 0 }, + { "STREAM_DEPENDS", CURLOPT_STREAM_DEPENDS, CURLOT_OBJECT, 0 }, + { "STREAM_DEPENDS_E", CURLOPT_STREAM_DEPENDS_E, CURLOT_OBJECT, 0 }, + { "STREAM_WEIGHT", CURLOPT_STREAM_WEIGHT, CURLOT_LONG, 0 }, + { "SUPPRESS_CONNECT_HEADERS", CURLOPT_SUPPRESS_CONNECT_HEADERS, + CURLOT_LONG, 0 }, + { "TCP_FASTOPEN", CURLOPT_TCP_FASTOPEN, CURLOT_LONG, 0 }, + { "TCP_KEEPALIVE", CURLOPT_TCP_KEEPALIVE, CURLOT_LONG, 0 }, + { "TCP_KEEPCNT", CURLOPT_TCP_KEEPCNT, CURLOT_LONG, 0 }, + { "TCP_KEEPIDLE", CURLOPT_TCP_KEEPIDLE, CURLOT_LONG, 0 }, + { "TCP_KEEPINTVL", CURLOPT_TCP_KEEPINTVL, CURLOT_LONG, 0 }, + { "TCP_NODELAY", CURLOPT_TCP_NODELAY, CURLOT_LONG, 0 }, + { "TELNETOPTIONS", CURLOPT_TELNETOPTIONS, CURLOT_SLIST, 0 }, + { "TFTP_BLKSIZE", CURLOPT_TFTP_BLKSIZE, CURLOT_LONG, 0 }, + { "TFTP_NO_OPTIONS", CURLOPT_TFTP_NO_OPTIONS, CURLOT_LONG, 0 }, + { "TIMECONDITION", CURLOPT_TIMECONDITION, CURLOT_VALUES, 0 }, + { "TIMEOUT", CURLOPT_TIMEOUT, CURLOT_LONG, 0 }, + { "TIMEOUT_MS", CURLOPT_TIMEOUT_MS, CURLOT_LONG, 0 }, + { "TIMEVALUE", CURLOPT_TIMEVALUE, CURLOT_LONG, 0 }, + { "TIMEVALUE_LARGE", CURLOPT_TIMEVALUE_LARGE, CURLOT_OFF_T, 0 }, + { "TLS13_CIPHERS", CURLOPT_TLS13_CIPHERS, CURLOT_STRING, 0 }, + { "TLSAUTH_PASSWORD", CURLOPT_TLSAUTH_PASSWORD, CURLOT_STRING, 0 }, + { "TLSAUTH_TYPE", CURLOPT_TLSAUTH_TYPE, CURLOT_STRING, 0 }, + { "TLSAUTH_USERNAME", CURLOPT_TLSAUTH_USERNAME, CURLOT_STRING, 0 }, + { "TRAILERDATA", CURLOPT_TRAILERDATA, CURLOT_CBPTR, 0 }, + { "TRAILERFUNCTION", CURLOPT_TRAILERFUNCTION, CURLOT_FUNCTION, 0 }, + { "TRANSFERTEXT", CURLOPT_TRANSFERTEXT, CURLOT_LONG, 0 }, + { "TRANSFER_ENCODING", CURLOPT_TRANSFER_ENCODING, CURLOT_LONG, 0 }, + { "UNIX_SOCKET_PATH", CURLOPT_UNIX_SOCKET_PATH, CURLOT_STRING, 0 }, + { "UNRESTRICTED_AUTH", CURLOPT_UNRESTRICTED_AUTH, CURLOT_LONG, 0 }, + { "UPKEEP_INTERVAL_MS", CURLOPT_UPKEEP_INTERVAL_MS, CURLOT_LONG, 0 }, + { "UPLOAD", CURLOPT_UPLOAD, CURLOT_LONG, 0 }, + { "UPLOAD_BUFFERSIZE", CURLOPT_UPLOAD_BUFFERSIZE, CURLOT_LONG, 0 }, + { "UPLOAD_FLAGS", CURLOPT_UPLOAD_FLAGS, CURLOT_LONG, 0 }, + { "URL", CURLOPT_URL, CURLOT_STRING, 0 }, + { "USERAGENT", CURLOPT_USERAGENT, CURLOT_STRING, 0 }, + { "USERNAME", CURLOPT_USERNAME, CURLOT_STRING, 0 }, + { "USERPWD", CURLOPT_USERPWD, CURLOT_STRING, 0 }, + { "USE_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, 0 }, + { "VERBOSE", CURLOPT_VERBOSE, CURLOT_LONG, 0 }, + { "WILDCARDMATCH", CURLOPT_WILDCARDMATCH, CURLOT_LONG, 0 }, + { "WRITEDATA", CURLOPT_WRITEDATA, CURLOT_CBPTR, 0 }, + { "WRITEFUNCTION", CURLOPT_WRITEFUNCTION, CURLOT_FUNCTION, 0 }, + { "WRITEHEADER", CURLOPT_HEADERDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS }, + { "WS_OPTIONS", CURLOPT_WS_OPTIONS, CURLOT_LONG, 0 }, + { "XFERINFODATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, 0 }, + { "XFERINFOFUNCTION", CURLOPT_XFERINFOFUNCTION, CURLOT_FUNCTION, 0 }, + { "XOAUTH2_BEARER", CURLOPT_XOAUTH2_BEARER, CURLOT_STRING, 0 }, + { NULL, CURLOPT_LASTENTRY, CURLOT_LONG, 0 } /* end of table */ }; #ifdef DEBUGBUILD diff --git a/lib/escape.c b/lib/escape.c index 04b46f7a9e..3e49701bcb 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -52,8 +52,7 @@ char *curl_unescape(const char *string, int length) /* Escapes for URL the given unescaped string of given length. * 'data' is ignored since 7.82.0. */ -char *curl_easy_escape(CURL *data, const char *string, - int inlength) +char *curl_easy_escape(CURL *data, const char *string, int inlength) { size_t length; struct dynbuf d; @@ -79,7 +78,7 @@ char *curl_easy_escape(CURL *data, const char *string, } else { /* encode it */ - unsigned char out[3]={'%'}; + unsigned char out[3] = { '%' }; Curl_hexbyte(&out[1], in); if(curlx_dyn_addn(&d, out, 3)) return NULL; @@ -163,8 +162,7 @@ CURLcode Curl_urldecode(const char *string, size_t length, * If olen == NULL, no output length is stored. * 'data' is ignored since 7.82.0. */ -char *curl_easy_unescape(CURL *data, const char *string, - int length, int *olen) +char *curl_easy_unescape(CURL *data, const char *string, int length, int *olen) { char *str = NULL; (void)data; @@ -177,7 +175,7 @@ char *curl_easy_unescape(CURL *data, const char *string, return NULL; if(olen) { - if(outputlen <= (size_t) INT_MAX) + if(outputlen <= (size_t)INT_MAX) *olen = curlx_uztosi(outputlen); else /* too large to return in an int, fail! */ diff --git a/lib/fake_addrinfo.c b/lib/fake_addrinfo.c index 7d5da09ead..f771c29009 100644 --- a/lib/fake_addrinfo.c +++ b/lib/fake_addrinfo.c @@ -181,8 +181,7 @@ int r_getaddrinfo(const char *node, } } - ares_getaddrinfo(channel, node, service, &ahints, - async_addrinfo_cb, &ctx); + ares_getaddrinfo(channel, node, service, &ahints, async_addrinfo_cb, &ctx); /* Wait until no more requests are left to be processed */ ares_queue_wait_empty(channel, -1); diff --git a/lib/file.c b/lib/file.c index 2f30a0297c..0f96957126 100644 --- a/lib/file.c +++ b/lib/file.c @@ -127,7 +127,6 @@ const struct Curl_handler Curl_handler_file = { PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */ }; - static void file_cleanup(struct FILEPROTO *file) { Curl_safefree(file->freepath); @@ -332,7 +331,7 @@ static CURLcode file_upload(struct Curl_easy *data, if(!dir[1]) return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ - mode = O_WRONLY|O_CREAT|CURL_O_BINARY; + mode = O_WRONLY | O_CREAT | CURL_O_BINARY; if(data->state.resume_from) mode |= O_APPEND; else @@ -478,7 +477,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done) const struct tm *tm = &buffer; char header[80]; int headerlen; - static const char accept_ranges[]= { "Accept-ranges: bytes\r\n" }; + static const char accept_ranges[] = { "Accept-ranges: bytes\r\n" }; if(expected_size >= 0) { headerlen = curl_msnprintf(header, sizeof(header), @@ -502,7 +501,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done) headerlen = curl_msnprintf(header, sizeof(header), "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", - Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6], + Curl_wkday[tm->tm_wday ? tm->tm_wday - 1 : 6], tm->tm_mday, Curl_month[tm->tm_mon], tm->tm_year + 1900, @@ -568,10 +567,10 @@ static CURLcode file_do(struct Curl_easy *data, bool *done) if(!S_ISDIR(statbuf.st_mode)) { #ifdef __AMIGA__ if(data->state.resume_from != - lseek(fd, (off_t)data->state.resume_from, SEEK_SET)) + lseek(fd, (off_t)data->state.resume_from, SEEK_SET)) #else if(data->state.resume_from != - lseek(fd, data->state.resume_from, SEEK_SET)) + lseek(fd, data->state.resume_from, SEEK_SET)) #endif return CURLE_BAD_DOWNLOAD_RESUME; } @@ -591,11 +590,11 @@ static CURLcode file_do(struct Curl_easy *data, bool *done) size_t bytestoread; if(size_known) { - bytestoread = (expected_size < (curl_off_t)(xfer_blen-1)) ? - curlx_sotouz(expected_size) : (xfer_blen-1); + bytestoread = (expected_size < (curl_off_t)(xfer_blen - 1)) ? + curlx_sotouz(expected_size) : (xfer_blen - 1); } else - bytestoread = xfer_blen-1; + bytestoread = xfer_blen - 1; nread = read(fd, xfer_buf, bytestoread); diff --git a/lib/formdata.c b/lib/formdata.c index d4bfed89be..e51bf14b63 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -41,13 +41,13 @@ struct Curl_easy; #include "curlx/warnless.h" -#define HTTPPOST_PTRNAME CURL_HTTPPOST_PTRNAME -#define HTTPPOST_FILENAME CURL_HTTPPOST_FILENAME +#define HTTPPOST_PTRNAME CURL_HTTPPOST_PTRNAME +#define HTTPPOST_FILENAME CURL_HTTPPOST_FILENAME #define HTTPPOST_PTRCONTENTS CURL_HTTPPOST_PTRCONTENTS -#define HTTPPOST_READFILE CURL_HTTPPOST_READFILE -#define HTTPPOST_PTRBUFFER CURL_HTTPPOST_PTRBUFFER -#define HTTPPOST_CALLBACK CURL_HTTPPOST_CALLBACK -#define HTTPPOST_BUFFER CURL_HTTPPOST_BUFFER +#define HTTPPOST_READFILE CURL_HTTPPOST_READFILE +#define HTTPPOST_PTRBUFFER CURL_HTTPPOST_PTRBUFFER +#define HTTPPOST_CALLBACK CURL_HTTPPOST_CALLBACK +#define HTTPPOST_BUFFER CURL_HTTPPOST_BUFFER /*************************************************************************** * @@ -59,11 +59,10 @@ struct Curl_easy; * Returns newly allocated HttpPost on success and NULL if malloc failed. * ***************************************************************************/ -static struct curl_httppost * -AddHttpPost(struct FormInfo *src, - struct curl_httppost *parent_post, - struct curl_httppost **httppost, - struct curl_httppost **last_post) +static struct curl_httppost *AddHttpPost(struct FormInfo *src, + struct curl_httppost *parent_post, + struct curl_httppost **httppost, + struct curl_httppost **last_post) { struct curl_httppost *post; size_t namelength = src->namelength; @@ -227,21 +226,19 @@ static CURLFORMcode FormAddCheck(struct FormInfo *first_form, /* go through the list, check for completeness and if everything is * alright add the HttpPost item otherwise set retval accordingly */ - for(form = first_form; - form != NULL; - form = form->more) { + for(form = first_form; form != NULL; form = form->more) { if(((!form->name || !form->value) && !post) || - ( (form->contentslength) && - (form->flags & HTTPPOST_FILENAME) ) || - ( (form->flags & HTTPPOST_FILENAME) && - (form->flags & HTTPPOST_PTRCONTENTS) ) || + (form->contentslength && + (form->flags & HTTPPOST_FILENAME)) || + ((form->flags & HTTPPOST_FILENAME) && + (form->flags & HTTPPOST_PTRCONTENTS)) || - ( (!form->buffer) && - (form->flags & HTTPPOST_BUFFER) && - (form->flags & HTTPPOST_PTRBUFFER) ) || + (!form->buffer && + (form->flags & HTTPPOST_BUFFER) && + (form->flags & HTTPPOST_PTRBUFFER)) || - ( (form->flags & HTTPPOST_READFILE) && - (form->flags & HTTPPOST_PTRCONTENTS) ) + ((form->flags & HTTPPOST_READFILE) && + (form->flags & HTTPPOST_PTRCONTENTS)) ) { return CURL_FORMADD_INCOMPLETE; } @@ -285,7 +282,7 @@ static CURLFORMcode FormAddCheck(struct FormInfo *first_form, HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER | HTTPPOST_CALLBACK)) && form->value) { /* copy value (without strdup; possibly contains null characters) */ - size_t clen = (size_t) form->contentslength; + size_t clen = (size_t)form->contentslength; if(!clen) clen = strlen(form->value) + 1; @@ -321,10 +318,8 @@ static void free_chain(struct curl_httppost *c) } } -static -CURLFORMcode FormAdd(struct curl_httppost **httppost, - struct curl_httppost **last_post, - va_list params) +static CURLFORMcode FormAdd(struct curl_httppost **httppost, + struct curl_httppost **last_post, va_list params) { struct FormInfo *first_form, *curr, *form = NULL; CURLFORMcode retval = CURL_FORMADD_OK; @@ -442,13 +437,12 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, case CURLFORM_CONTENTLEN: curr->flags |= CURL_HTTPPOST_LARGE; curr->contentslength = - array_state ? (curl_off_t)(size_t)avalue : - va_arg(params, curl_off_t); + array_state ? (curl_off_t)(size_t)avalue : va_arg(params, curl_off_t); break; /* Get contents from a given filename */ case CURLFORM_FILECONTENT: - if(curr->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_READFILE)) + if(curr->flags & (HTTPPOST_PTRCONTENTS | HTTPPOST_READFILE)) retval = CURL_FORMADD_OPTION_TWICE; else { if(!array_state) @@ -513,7 +507,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, break; case CURLFORM_BUFFERPTR: - curr->flags |= HTTPPOST_PTRBUFFER|HTTPPOST_BUFFER; + curr->flags |= HTTPPOST_PTRBUFFER | HTTPPOST_BUFFER; if(curr->buffer) retval = CURL_FORMADD_OPTION_TWICE; else { @@ -597,21 +591,20 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, } break; - case CURLFORM_CONTENTHEADER: - { - /* this "cast increases required alignment of target type" but - we consider it OK anyway */ - struct curl_slist *list = array_state ? - (struct curl_slist *)(void *)avalue : - va_arg(params, struct curl_slist *); + case CURLFORM_CONTENTHEADER: { + /* this "cast increases required alignment of target type" but + we consider it OK anyway */ + struct curl_slist *list = array_state ? + (struct curl_slist *)(void *)avalue : + va_arg(params, struct curl_slist *); - if(curr->contentheader) - retval = CURL_FORMADD_OPTION_TWICE; - else - curr->contentheader = list; + if(curr->contentheader) + retval = CURL_FORMADD_OPTION_TWICE; + else + curr->contentheader = list; - break; - } + break; + } case CURLFORM_FILENAME: case CURLFORM_BUFFER: if(!array_state) @@ -672,8 +665,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, */ CURLFORMcode curl_formadd(struct curl_httppost **httppost, - struct curl_httppost **last_post, - ...) + struct curl_httppost **last_post, ...) { va_list arg; CURLFORMcode result; @@ -717,7 +709,7 @@ int curl_formget(struct curl_httppost *form, void *arg, } Curl_mime_cleanpart(&toppart); - return (int) result; + return (int)result; } /* @@ -741,8 +733,7 @@ void curl_formfree(struct curl_httppost *form) if(!(form->flags & HTTPPOST_PTRNAME)) curlx_free(form->name); /* free the name */ if(!(form->flags & - (HTTPPOST_PTRCONTENTS|HTTPPOST_BUFFER|HTTPPOST_CALLBACK)) - ) + (HTTPPOST_PTRCONTENTS | HTTPPOST_BUFFER | HTTPPOST_CALLBACK))) curlx_free(form->contents); /* free the contents */ curlx_free(form->contenttype); /* free the content type */ curlx_free(form->showfilename); /* free the faked filename */ @@ -751,7 +742,6 @@ void curl_formfree(struct curl_httppost *form) } while(form); /* continue */ } - /* Set mime part name, taking care of non null-terminated name string. */ static CURLcode setname(curl_mimepart *part, const char *name, size_t len) { @@ -893,7 +883,7 @@ CURLcode Curl_getformdata(CURL *data, /* Set fake filename. */ if(!result && post->showfilename) if(post->more || (post->flags & (HTTPPOST_FILENAME | HTTPPOST_BUFFER | - HTTPPOST_CALLBACK))) + HTTPPOST_CALLBACK))) result = curl_mime_filename(part, post->showfilename); } } @@ -907,8 +897,7 @@ CURLcode Curl_getformdata(CURL *data, #else /* if disabled */ CURLFORMcode curl_formadd(struct curl_httppost **httppost, - struct curl_httppost **last_post, - ...) + struct curl_httppost **last_post, ...) { (void)httppost; (void)last_post; @@ -930,4 +919,4 @@ void curl_formfree(struct curl_httppost *form) /* Nothing to do. */ } -#endif /* if disabled */ +#endif /* if disabled */ diff --git a/lib/formdata.h b/lib/formdata.h index 74f00bf4fc..e80b83bbf4 100644 --- a/lib/formdata.h +++ b/lib/formdata.h @@ -55,5 +55,4 @@ CURLcode Curl_getformdata(CURL *data, curl_read_callback fread_func); #endif /* CURL_DISABLE_FORM_API */ - #endif /* HEADER_CURL_FORMDATA_H */ diff --git a/lib/ftp.c b/lib/ftp.c index b2b15a89dc..49f042c7c4 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -88,11 +88,11 @@ #define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3])) #ifdef CURL_DISABLE_VERBOSE_STRINGS -#define ftp_pasv_verbose(a,b,c,d) Curl_nop_stmt -#define FTP_CSTATE(c) ((void)(c), "") +#define ftp_pasv_verbose(a, b, c, d) Curl_nop_stmt +#define FTP_CSTATE(c) ((void)(c), "") #else /* CURL_DISABLE_VERBOSE_STRINGS */ /* for tracing purposes */ -static const char * const ftp_state_names[]={ +static const char * const ftp_state_names[] = { "STOP", "WAIT220", "AUTH", @@ -131,7 +131,7 @@ static const char * const ftp_state_names[]={ "STOR", "QUIT" }; -#define FTP_CSTATE(ftpc) ((ftpc)? ftp_state_names[(ftpc)->state] : "???") +#define FTP_CSTATE(ftpc) ((ftpc) ? ftp_state_names[(ftpc)->state] : "???") #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ @@ -163,12 +163,11 @@ static void ftp_state_low(struct Curl_easy *data, ftpc->state = newstate; } - /* Local API functions */ #ifndef DEBUGBUILD -#define ftp_state(x,y,z) ftp_state_low(x,y,z) +#define ftp_state(x, y, z) ftp_state_low(x, y, z) #else /* !DEBUGBUILD */ -#define ftp_state(x,y,z) ftp_state_low(x,y,z,__LINE__) +#define ftp_state(x, y, z) ftp_state_low(x, y, z, __LINE__) #endif /* DEBUGBUILD */ static CURLcode ftp_sendquote(struct Curl_easy *data, @@ -270,7 +269,6 @@ const struct Curl_handler Curl_handler_ftp = { PROTOPT_CONN_REUSE /* flags */ }; - #ifdef USE_SSL /* * FTPS protocol handler. @@ -490,7 +488,7 @@ static CURLcode ftp_check_ctrl_on_data_wait(struct Curl_easy *data, infof(data, "FTP code: %03d", ftpcode); - if(ftpcode/100 > 3) + if(ftpcode / 100 > 3) return CURLE_FTP_ACCEPT_FAILED; return CURLE_WEIRD_SERVER_REPLY; @@ -762,8 +760,8 @@ static CURLcode ftp_domore_pollset(struct Curl_easy *data, /* if stopped and still in this state, then we are also waiting for a connect on the secondary connection */ DEBUGASSERT(data->conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD || - (data->conn->cfilter[SECONDARYSOCKET] && - !Curl_conn_is_connected(data->conn, SECONDARYSOCKET))); + (data->conn->cfilter[SECONDARYSOCKET] && + !Curl_conn_is_connected(data->conn, SECONDARYSOCKET))); /* An unconnected SECONDARY will add its socket by itself * via its adjust_pollset() */ return Curl_pollset_add_in(data, ps, data->conn->sock[FIRSTSOCKET]); @@ -782,7 +780,7 @@ static const char *pathpiece(struct ftp_conn *ftpc, int num) { DEBUGASSERT(ftpc->dirs); DEBUGASSERT(ftpc->dirdepth > num); - return &ftpc->rawpath[ ftpc->dirs[num].start ]; + return &ftpc->rawpath[ftpc->dirs[num].start]; } /* This is called after the FTP_QUOTE state is passed. @@ -953,7 +951,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, if(addrlen) { const struct Curl_sockaddr_ex *remote_addr = - Curl_conn_get_remote_addr(data, FIRSTSOCKET); + Curl_conn_get_remote_addr(data, FIRSTSOCKET); DEBUGASSERT(remote_addr); if(!remote_addr) @@ -971,15 +969,15 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, conn->scope_id, #endif ipstr, hbuf, sizeof(hbuf))) { - case IF2IP_NOT_FOUND: - /* not an interface, use the given string as hostname instead */ - host = ipstr; - break; - case IF2IP_AF_NOT_SUPPORTED: - goto out; - case IF2IP_FOUND: - host = hbuf; /* use the hbuf for hostname */ - break; + case IF2IP_NOT_FOUND: + /* not an interface, use the given string as hostname instead */ + host = ipstr; + break; + case IF2IP_AF_NOT_SUPPORTED: + goto out; + case IF2IP_FOUND: + host = hbuf; /* use the hbuf for hostname */ + break; } } else @@ -1060,7 +1058,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, sa6->sin6_port = htons(port); #endif /* Try binding the given address. */ - if(bind(portsock, sa, sslen) ) { + if(bind(portsock, sa, sslen)) { /* It failed. */ error = SOCKERRNO; if(possibly_non_local && (error == SOCKEADDRNOTAVAIL)) { @@ -1501,7 +1499,6 @@ static CURLcode ftp_state_mdtm(struct Curl_easy *data, return result; } - /* This is called after the TYPE and possible quote commands have been sent */ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, struct ftp_conn *ftpc, @@ -1554,7 +1551,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, } /* seekerr == CURL_SEEKFUNC_CANTSEEK (cannot seek to offset) */ do { - char scratch[4*1024]; + char scratch[4 * 1024]; size_t readthisamountnow = (data->state.resume_from - passed > (curl_off_t)sizeof(scratch)) ? sizeof(scratch) : @@ -1752,7 +1749,6 @@ static CURLcode ftp_epsv_disable(struct Curl_easy *data, return result; } - static CURLcode ftp_control_addr_dup(struct Curl_easy *data, char **newhostp) { @@ -1810,8 +1806,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, struct pingpong *pp = &ftpc->pp; char *newhost = NULL; unsigned short newport = 0; - char *str = - curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first letter */ + char *str = curlx_dyn_ptr(&pp->recvbuf) + 4; /* start on the first letter */ if((ftpc->count1 == 0) && (ftpcode == 229)) { @@ -1872,8 +1867,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, /* told to ignore the remotely given IP but instead use the host we used for the control connection */ infof(data, "Skip %u.%u.%u.%u for data connection, reuse %s instead", - ip[0], ip[1], ip[2], ip[3], - conn->host.name); + ip[0], ip[1], ip[2], ip[3], conn->host.name); result = ftp_control_addr_dup(data, &newhost); if(result) return result; @@ -2024,7 +2018,7 @@ static CURLcode ftp_state_port_resp(struct Curl_easy *data, static int twodigit(const char *p) { - return (p[0]-'0') * 10 + (p[1]-'0'); + return (p[0] - '0') * 10 + (p[1] - '0'); } static bool ftp_213_date(const char *p, int *year, int *month, int *day, @@ -2079,27 +2073,26 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data, CURLcode result = CURLE_OK; switch(ftpcode) { - case 213: - { - /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the - last .sss part is optional and means fractions of a second */ - int year, month, day, hour, minute, second; - struct pingpong *pp = &ftpc->pp; - char *resp = curlx_dyn_ptr(&pp->recvbuf) + 4; - bool showtime = FALSE; - if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) { - /* we have a time, reformat it */ - char timebuf[24]; - curl_msnprintf(timebuf, sizeof(timebuf), - "%04d%02d%02d %02d:%02d:%02d GMT", - year, month, day, hour, minute, second); - /* now, convert this into a time() value: */ - if(!Curl_getdate_capped(timebuf, &data->info.filetime)) - showtime = TRUE; - } + case 213: { + /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the + last .sss part is optional and means fractions of a second */ + int year, month, day, hour, minute, second; + struct pingpong *pp = &ftpc->pp; + char *resp = curlx_dyn_ptr(&pp->recvbuf) + 4; + bool showtime = FALSE; + if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) { + /* we have a time, reformat it */ + char timebuf[24]; + curl_msnprintf(timebuf, sizeof(timebuf), + "%04d%02d%02d %02d:%02d:%02d GMT", + year, month, day, hour, minute, second); + /* now, convert this into a time() value: */ + if(!Curl_getdate_capped(timebuf, &data->info.filetime)) + showtime = TRUE; + } - /* If we asked for a time of the file and we actually got one as well, - we "emulate" an HTTP-style header in our output. */ + /* If we asked for a time of the file and we actually got one as well, + we "emulate" an HTTP-style header in our output. */ #if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__)) #pragma GCC diagnostic push @@ -2107,38 +2100,38 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data, warning: comparison of unsigned expression in '>= 0' is always true */ #pragma GCC diagnostic ignored "-Wtype-limits" #endif - if(data->req.no_body && ftpc->file && - data->set.get_filetime && showtime) { + if(data->req.no_body && ftpc->file && + data->set.get_filetime && showtime) { #if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__)) #pragma GCC diagnostic pop #endif - char headerbuf[128]; - int headerbuflen; - time_t filetime = data->info.filetime; - struct tm buffer; - const struct tm *tm = &buffer; + char headerbuf[128]; + int headerbuflen; + time_t filetime = data->info.filetime; + struct tm buffer; + const struct tm *tm = &buffer; - result = Curl_gmtime(filetime, &buffer); - if(result) - return result; + result = Curl_gmtime(filetime, &buffer); + if(result) + return result; - /* format: "Tue, 15 Nov 1994 12:45:26" */ - headerbuflen = - curl_msnprintf(headerbuf, sizeof(headerbuf), - "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d " - "GMT\r\n", - Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6], - tm->tm_mday, - Curl_month[tm->tm_mon], - tm->tm_year + 1900, - tm->tm_hour, - tm->tm_min, - tm->tm_sec); - result = client_write_header(data, headerbuf, headerbuflen); - if(result) - return result; - } /* end of a ridiculous amount of conditionals */ - } + /* format: "Tue, 15 Nov 1994 12:45:26" */ + headerbuflen = + curl_msnprintf(headerbuf, sizeof(headerbuf), + "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d " + "GMT\r\n", + Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + result = client_write_header(data, headerbuf, headerbuflen); + if(result) + return result; + } /* end of a ridiculous amount of conditionals */ + } break; default: infof(data, "unsupported MDTM reply format"); @@ -2194,7 +2187,7 @@ static CURLcode ftp_state_type_resp(struct Curl_easy *data, { CURLcode result = CURLE_OK; - if(ftpcode/100 != 2) { + if(ftpcode / 100 != 2) { /* "sasserftpd" and "(u)r(x)bot ftpd" both responds with 226 after a successful 'TYPE I'. While that is not as RFC959 says, it is still a positive response code and we allow that. */ @@ -2267,7 +2260,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data, return CURLE_BAD_DOWNLOAD_RESUME; } /* Now store the number of bytes we are expected to download */ - ftp->downloadsize = filesize-data->state.resume_from; + ftp->downloadsize = filesize - data->state.resume_from; } } @@ -2378,7 +2371,7 @@ static CURLcode ftp_state_rest_resp(struct Curl_easy *data, case FTP_REST: default: if(ftpcode == 350) { - char buffer[24]= { "Accept-ranges: bytes\r\n" }; + char buffer[24] = { "Accept-ranges: bytes\r\n" }; result = client_write_header(data, buffer, strlen(buffer)); if(result) return result; @@ -2590,12 +2583,11 @@ static CURLcode ftp_state_user_resp(struct Curl_easy *data, if((ftpcode == 331) && (ftpc->state == FTP_USER)) { /* 331 Password required for ... (the server requires to send the user's password too) */ - result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s", - data->conn->passwd); + result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s", data->conn->passwd); if(!result) ftp_state(data, ftpc, FTP_PASS); } - else if(ftpcode/100 == 2) { + else if(ftpcode / 100 == 2) { /* 230 User ... logged in. (the user logged in with or without password) */ result = ftp_state_loggedin(data, ftpc); @@ -2621,9 +2613,8 @@ static CURLcode ftp_state_user_resp(struct Curl_easy *data, if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] && !ftpc->ftp_trying_alternative) { /* Ok, USER failed. Let's try the supplied command. */ - result = - Curl_pp_sendf(data, &ftpc->pp, "%s", - data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); + result = Curl_pp_sendf(data, &ftpc->pp, "%s", + data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); if(!result) { ftpc->ftp_trying_alternative = TRUE; ftp_state(data, ftpc, FTP_USER); @@ -2789,8 +2780,7 @@ static CURLcode ftp_wait_resp(struct Curl_easy *data, (int)data->set.ftpsslauth); return CURLE_UNKNOWN_OPTION; /* we do not know what to do */ } - result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", - ftpauth[ftpc->count1]); + result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); if(!result) ftp_state(data, ftpc, FTP_AUTH); } @@ -2890,10 +2880,9 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, break; case FTP_PROT: - if(ftpcode/100 == 2) + if(ftpcode / 100 == 2) /* We have enabled SSL for the data connection! */ - conn->bits.ftp_use_data_ssl = - (data->set.use_ssl != CURLUSESSL_CONTROL); + conn->bits.ftp_use_data_ssl = (data->set.use_ssl != CURLUSESSL_CONTROL); /* FTP servers typically responds with 500 if they decide to reject our 'P' request */ else if(data->set.use_ssl > CURLUSESSL_CONTROL) @@ -3005,7 +2994,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, break; case FTP_CWD: - if(ftpcode/100 != 2) { + if(ftpcode / 100 != 2) { /* failure to CWD there */ if(data->set.ftp_create_missing_dirs && ftpc->cwdcount && !ftpc->count2) { @@ -3047,7 +3036,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, break; case FTP_MKD: - if((ftpcode/100 != 2) && !ftpc->count3--) { + if((ftpcode / 100 != 2) && !ftpc->count3--) { /* failure to MKD the directory */ failf(data, "Failed to MKD dir: %03d", ftpcode); result = CURLE_REMOTE_ACCESS_DENIED; @@ -3120,7 +3109,6 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, return result; } - /* called repeatedly until done from multi.c */ static CURLcode ftp_statemach(struct Curl_easy *data, struct ftp_conn *ftpc, @@ -3419,10 +3407,9 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, * * BLOCKING */ -static -CURLcode ftp_sendquote(struct Curl_easy *data, - struct ftp_conn *ftpc, - struct curl_slist *quote) +static CURLcode ftp_sendquote(struct Curl_easy *data, + struct ftp_conn *ftpc, + struct curl_slist *quote) { struct curl_slist *item; struct pingpong *pp = &ftpc->pp; @@ -3913,8 +3900,7 @@ static CURLcode wc_statemach(struct Curl_easy *data, Curl_set_in_callback(data, FALSE); switch(userresponse) { case CURL_CHUNK_BGN_FUNC_SKIP: - infof(data, "Wildcard - \"%s\" skipped by user", - finfo->filename); + infof(data, "Wildcard - \"%s\" skipped by user", finfo->filename); wildcard->state = CURLWC_SKIP; continue; case CURL_CHUNK_BGN_FUNC_FAIL: @@ -4130,10 +4116,9 @@ static size_t numof_slashes(const char *str) * Parse the URL path into separate path components. * */ -static -CURLcode ftp_parse_url_path(struct Curl_easy *data, - struct ftp_conn *ftpc, - struct FTP *ftp) +static CURLcode ftp_parse_url_path(struct Curl_easy *data, + struct ftp_conn *ftpc, + struct FTP *ftp) { const char *slashPos = NULL; const char *fileName = NULL; @@ -4155,78 +4140,78 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data, rawPath = ftpc->rawpath; switch(data->set.ftp_filemethod) { - case FTPFILE_NOCWD: /* fastest, but less standard-compliant */ + case FTPFILE_NOCWD: /* fastest, but less standard-compliant */ - if((pathLen > 0) && (rawPath[pathLen - 1] != '/')) - fileName = rawPath; /* this is a full file path */ - /* - else: ftpc->file is not used anywhere other than for operations on - a file. In other words, never for directory operations. - So we can safely leave filename as NULL here and use it as a - argument in dir/file decisions. - */ - break; + if((pathLen > 0) && (rawPath[pathLen - 1] != '/')) + fileName = rawPath; /* this is a full file path */ + /* + else: ftpc->file is not used anywhere other than for operations on + a file. In other words, never for directory operations. + So we can safely leave filename as NULL here and use it as a + argument in dir/file decisions. + */ + break; - case FTPFILE_SINGLECWD: - slashPos = strrchr(rawPath, '/'); - if(slashPos) { - /* get path before last slash, except for / */ - size_t dirlen = slashPos - rawPath; - if(dirlen == 0) - dirlen = 1; - - ftpc->dirs = curlx_calloc(1, sizeof(ftpc->dirs[0])); - if(!ftpc->dirs) - return CURLE_OUT_OF_MEMORY; - - ftpc->dirs[0].start = 0; - ftpc->dirs[0].len = (int)dirlen; - ftpc->dirdepth = 1; /* we consider it to be a single directory */ - fileName = slashPos + 1; /* rest is filename */ - } - else - fileName = rawPath; /* filename only (or empty) */ - break; + case FTPFILE_SINGLECWD: + slashPos = strrchr(rawPath, '/'); + if(slashPos) { + /* get path before last slash, except for / */ + size_t dirlen = slashPos - rawPath; + if(dirlen == 0) + dirlen = 1; - default: /* allow pretty much anything */ - case FTPFILE_MULTICWD: { - /* current position: begin of next path component */ - const char *curPos = rawPath; - - /* number of entries to allocate for the 'dirs' array */ - size_t dirAlloc = numof_slashes(rawPath); - - if(dirAlloc >= FTP_MAX_DIR_DEPTH) - /* suspiciously deep directory hierarchy */ - return CURLE_URL_MALFORMAT; - - if(dirAlloc) { - ftpc->dirs = curlx_calloc(dirAlloc, sizeof(ftpc->dirs[0])); - if(!ftpc->dirs) - return CURLE_OUT_OF_MEMORY; - - /* parse the URL path into separate path components */ - while(dirAlloc--) { - const char *spos = strchr(curPos, '/'); - size_t clen = spos - curPos; - - /* path starts with a slash: add that as a directory */ - if(!clen && (ftpc->dirdepth == 0)) - ++clen; - - /* we skip empty path components, like "x//y" since the FTP command - CWD requires a parameter and a non-existent parameter a) does not - work on many servers and b) has no effect on the others. */ - if(clen) { - ftpc->dirs[ftpc->dirdepth].start = (int)(curPos - rawPath); - ftpc->dirs[ftpc->dirdepth].len = (int)clen; - ftpc->dirdepth++; - } - curPos = spos + 1; + ftpc->dirs = curlx_calloc(1, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) + return CURLE_OUT_OF_MEMORY; + + ftpc->dirs[0].start = 0; + ftpc->dirs[0].len = (int)dirlen; + ftpc->dirdepth = 1; /* we consider it to be a single directory */ + fileName = slashPos + 1; /* rest is filename */ + } + else + fileName = rawPath; /* filename only (or empty) */ + break; + + default: /* allow pretty much anything */ + case FTPFILE_MULTICWD: { + /* current position: begin of next path component */ + const char *curPos = rawPath; + + /* number of entries to allocate for the 'dirs' array */ + size_t dirAlloc = numof_slashes(rawPath); + + if(dirAlloc >= FTP_MAX_DIR_DEPTH) + /* suspiciously deep directory hierarchy */ + return CURLE_URL_MALFORMAT; + + if(dirAlloc) { + ftpc->dirs = curlx_calloc(dirAlloc, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) + return CURLE_OUT_OF_MEMORY; + + /* parse the URL path into separate path components */ + while(dirAlloc--) { + const char *spos = strchr(curPos, '/'); + size_t clen = spos - curPos; + + /* path starts with a slash: add that as a directory */ + if(!clen && (ftpc->dirdepth == 0)) + ++clen; + + /* we skip empty path components, like "x//y" since the FTP command + CWD requires a parameter and a non-existent parameter a) does not + work on many servers and b) has no effect on the others. */ + if(clen) { + ftpc->dirs[ftpc->dirdepth].start = (int)(curPos - rawPath); + ftpc->dirs[ftpc->dirdepth].len = (int)clen; + ftpc->dirdepth++; } + curPos = spos + 1; } - fileName = curPos; /* the rest is the filename (or empty) */ } + fileName = curPos; /* the rest is the filename (or empty) */ + } break; } /* switch */ @@ -4327,11 +4312,10 @@ static CURLcode ftp_doing(struct Curl_easy *data, * ftp->ctl_valid starts out as FALSE, and gets set to TRUE if we reach the * ftp_done() function without finding any major problem. */ -static -CURLcode ftp_regular_transfer(struct Curl_easy *data, - struct ftp_conn *ftpc, - struct FTP *ftp, - bool *dophase_done) +static CURLcode ftp_regular_transfer(struct Curl_easy *data, + struct ftp_conn *ftpc, + struct FTP *ftp, + bool *dophase_done) { CURLcode result = CURLE_OK; bool connected = FALSE; diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index b62fa47f65..5a11946137 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -215,7 +215,6 @@ struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void) return curlx_calloc(1, sizeof(struct ftp_parselist_data)); } - void Curl_ftp_parselist_data_free(struct ftp_parselist_data **parserp) { struct ftp_parselist_data *parser = *parserp; @@ -225,13 +224,11 @@ void Curl_ftp_parselist_data_free(struct ftp_parselist_data **parserp) *parserp = NULL; } - CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data) { return pl_data->error; } - #define FTP_LP_MALFORMATED_PERM 0x01000000 static unsigned int ftp_pl_get_permission(const char *str) @@ -284,7 +281,7 @@ static unsigned int ftp_pl_get_permission(const char *str) if(str[7] == 'w') permissions |= 1 << 1; else if(str[7] != '-') - permissions |= FTP_LP_MALFORMATED_PERM; + permissions |= FTP_LP_MALFORMATED_PERM; if(str[8] == 'x') permissions |= 1; else if(str[8] == 't') { @@ -430,7 +427,6 @@ static CURLcode parse_unix_totalsize(struct ftp_parselist_data *parser, } else return CURLE_FTP_BAD_FILE_LIST; - } break; } @@ -487,7 +483,7 @@ static CURLcode parse_unix_hlinks(struct ftp_parselist_data *parser, } break; case PL_UNIX_HLINKS_NUMBER: - parser->item_length ++; + parser->item_length++; if(c == ' ') { const char *p = &mem[parser->item_offset]; curl_off_t hlinks; @@ -623,7 +619,7 @@ static CURLcode parse_unix_time(struct ftp_parselist_data *parser, case PL_UNIX_TIME_PREPART1: if(c != ' ') { if(ISALNUM(c) && len) { - parser->item_offset = len -1; + parser->item_offset = len - 1; parser->item_length = 1; parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; } @@ -668,7 +664,7 @@ static CURLcode parse_unix_time(struct ftp_parselist_data *parser, case PL_UNIX_TIME_PART3: parser->item_length++; if(c == ' ') { - mem[parser->item_offset + parser->item_length -1] = 0; + mem[parser->item_offset + parser->item_length - 1] = 0; parser->offsets.time = parser->item_offset; if(finfo->filetype == CURLFILETYPE_SYMLINK) { parser->state.UNIX.main = PL_UNIX_SYMLINK; @@ -924,7 +920,7 @@ static CURLcode parse_winnt(struct Curl_easy *data, case PL_WINNT_TIME_TIME: if(c == ' ') { parser->offsets.time = parser->item_offset; - mem[parser->item_offset + parser->item_length -1] = 0; + mem[parser->item_offset + parser->item_length - 1] = 0; parser->state.NT.main = PL_WINNT_DIRORSIZE; parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; parser->item_length = 0; @@ -944,7 +940,7 @@ static CURLcode parse_winnt(struct Curl_easy *data, } break; case PL_WINNT_DIRORSIZE_CONTENT: - parser->item_length ++; + parser->item_length++; if(c == ' ') { mem[parser->item_offset + parser->item_length - 1] = 0; if(strcmp("", mem + parser->item_offset) == 0) { @@ -972,7 +968,7 @@ static CURLcode parse_winnt(struct Curl_easy *data, switch(parser->state.NT.sub.filename) { case PL_WINNT_FILENAME_PRESPACE: if(c != ' ' && len) { - parser->item_offset = len -1; + parser->item_offset = len - 1; parser->item_length = 1; parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; } @@ -1020,7 +1016,7 @@ static CURLcode parse_winnt(struct Curl_easy *data, size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, void *connptr) { - size_t bufflen = size*nmemb; + size_t bufflen = size * nmemb; struct Curl_easy *data = (struct Curl_easy *)connptr; struct ftp_wc *ftpwc = data->wildcard->ftpwc; struct ftp_parselist_data *parser = ftpwc->parser; diff --git a/lib/getinfo.c b/lib/getinfo.c index 14244d087b..13e9622d33 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -128,7 +128,7 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info, *param_charp = data->info.contenttype; break; case CURLINFO_PRIVATE: - *param_charp = (char *) data->set.private_data; + *param_charp = (char *)data->set.private_data; break; case CURLINFO_FTP_ENTRY_PATH: /* Return the entrypath string from the most recent connection. @@ -375,7 +375,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info, return CURLE_OK; } -#define DOUBLE_SECS(x) (double)(x)/1000000 +#define DOUBLE_SECS(x) (double)(x) / 1000000 static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info, curl_off_t *param_offt) @@ -577,20 +577,19 @@ static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info, *param_slistp = ptr.to_slist; break; case CURLINFO_TLS_SESSION: - case CURLINFO_TLS_SSL_PTR: - { - struct curl_tlssessioninfo **tsip = (struct curl_tlssessioninfo **) - param_slistp; - struct curl_tlssessioninfo *tsi = &data->tsi; - - /* we are exposing a pointer to internal memory with unknown - * lifetime here. */ - *tsip = tsi; - if(!Curl_conn_get_ssl_info(data, data->conn, FIRSTSOCKET, tsi)) { - tsi->backend = Curl_ssl_backend(); - tsi->internals = NULL; - } + case CURLINFO_TLS_SSL_PTR: { + struct curl_tlssessioninfo **tsip = (struct curl_tlssessioninfo **) + param_slistp; + struct curl_tlssessioninfo *tsi = &data->tsi; + + /* we are exposing a pointer to internal memory with unknown + * lifetime here. */ + *tsip = tsi; + if(!Curl_conn_get_ssl_info(data, data->conn, FIRSTSOCKET, tsi)) { + tsi->backend = Curl_ssl_backend(); + tsi->internals = NULL; } + } break; default: return CURLE_UNKNOWN_OPTION; diff --git a/lib/optiontable.pl b/lib/optiontable.pl index 43fbd39d3b..54b86d72e1 100755 --- a/lib/optiontable.pl +++ b/lib/optiontable.pl @@ -131,19 +131,19 @@ for my $name (sort @names) { $name = $alias{$name}; $flag = "CURLOT_FLAG_ALIAS"; } - my $o = sprintf(" {\"%s\", %s, %s, %s},\n", + my $o = sprintf(" { \"%s\", %s, %s, %s },\n", $oname, $opt{$name}, $type{$name}, $flag); if(length($o) < 80) { print $o; } else { - printf(" {\"%s\", %s,\n %s, %s},\n", - $oname, $opt{$name}, $type{$name}, $flag); + printf(" { \"%s\", %s,\n %s, %s },\n", + $oname, $opt{$name}, $type{$name}, $flag); } } print <