diff options
301 files changed, 1033 insertions, 1252 deletions
diff --git a/.github/scripts/spacecheck.pl b/.github/scripts/spacecheck.pl index b395ee35e..e61d30b5b 100755 --- a/.github/scripts/spacecheck.pl +++ b/.github/scripts/spacecheck.pl @@ -151,6 +151,11 @@ while(my $filename = <$git_ls_files>) { push @err, "content: has multiple EOL at EOF"; } + if($content =~ /\n\n\n\n/ || + $content =~ /\r\n\r\n\r\n\r\n/) { + push @err, "content: has 3 or more consecutive empty lines"; + } + if($content =~ /([\x00-\x08\x0b\x0c\x0e-\x1f\x7f])/) { push @err, "content: has binary contents"; } diff --git a/.github/workflows/http3-linux.yml b/.github/workflows/http3-linux.yml index f7b1dcf58..a317f9978 100644 --- a/.github/workflows/http3-linux.yml +++ b/.github/workflows/http3-linux.yml @@ -48,7 +48,7 @@ env: # renovate: datasource=github-tags depName=libressl/portable versioning=semver registryUrl=https://github.com LIBRESSL_VERSION: 4.1.0 # renovate: datasource=github-tags depName=awslabs/aws-lc versioning=semver registryUrl=https://github.com - AWSLC_VERSION: 1.58.0 + AWSLC_VERSION: 1.60.0 # renovate: datasource=github-tags depName=google/boringssl versioning=semver registryUrl=https://github.com BORINGSSL_VERSION: 0.20250818.0 # renovate: datasource=github-tags depName=gnutls/gnutls versioning=semver registryUrl=https://github.com @@ -60,9 +60,9 @@ env: # renovate: datasource=github-tags depName=ngtcp2/ngtcp2 versioning=semver registryUrl=https://github.com NGTCP2_VERSION: 1.15.1 # renovate: datasource=github-tags depName=nghttp2/nghttp2 versioning=semver registryUrl=https://github.com - NGHTTP2_VERSION: 1.66.0 + NGHTTP2_VERSION: 1.67.0 # renovate: datasource=github-tags depName=cloudflare/quiche versioning=semver registryUrl=https://github.com - QUICHE_VERSION: 0.24.5 + QUICHE_VERSION: 0.24.6 jobs: build-cache: diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 53880ae3c..b84702a8a 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -23,6 +23,6 @@ jobs: pull-requests: write steps: - - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5 + - uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c2f119099..1b5290af2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -50,7 +50,7 @@ env: # renovate: datasource=github-tags depName=Mbed-TLS/mbedtls versioning=semver registryUrl=https://github.com MBEDTLS_VERSION: 3.6.4 # renovate: datasource=github-tags depName=awslabs/aws-lc versioning=semver registryUrl=https://github.com - AWSLC_VERSION: 1.58.0 + AWSLC_VERSION: 1.60.0 # renovate: datasource=github-tags depName=google/boringssl versioning=semver registryUrl=https://github.com BORINGSSL_VERSION: 0.20250818.0 # handled in renovate.json diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c index 410a0f70c..40fa50fe8 100644 --- a/CMake/CurlTests.c +++ b/CMake/CurlTests.c @@ -87,7 +87,7 @@ int main(void) #elif defined(HAVE_GETHOSTBYNAME_R_5) || \ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) rc = gethostbyname_r(address, &h, buffer, 8192, &h_errnop); - (void)hp; /* not used for test */ + (void)hp; (void)h_errnop; #elif defined(HAVE_GETHOSTBYNAME_R_6) || \ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c586be6d8..6c8d5d581 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,10 +1,10 @@ -curl and libcurl 8.15.1 +curl and libcurl 8.16.0 Public curl releases: 270 Command line options: 272 curl_easy_setopt() options: 308 Public functions in libcurl: 98 - Contributors: 3498 + Contributors: 3502 This release includes the following changes: @@ -37,6 +37,8 @@ This release includes the following bugfixes: o asyn-thrdd: fix Curl_async_pollset without socketpair [205] o asyn-thrdd: fix no `HAVE_GETADDRINFO` builds [214] o asyn-thrdd: manage DEFERRED and locks better [228] + o autotools: make curl-config executable [253] + o aws-lc: do not use large buffer [250] o BINDINGS.md: add LibQurl [156] o bufq: add integer overflow checks before chunk allocations [108] o bufq: removed "Useless Assignment" [188] @@ -53,6 +55,7 @@ This release includes the following bugfixes: o build: support LibreSSL native crypto lib with ngtcp2 1.15.0+ [209] o build: tidy up compiler definition for tests [37] o cf-https-connect: delete unused declaration [15] + o clang-tidy: disable `clang-analyzer-security.ArrayBound` [265] o cmake: `CURL_CA_FALLBACK` only works with OpenSSL [215] o cmake: capitalize 'Rustls' in the config summary o cmake: defer building `unitprotos.h` till a test target needs it [75] @@ -60,6 +63,7 @@ This release includes the following bugfixes: o cmake: drop redundant unity mode for `curlinfo` [155] o cmake: enable `-Wall` for MSVC 1944 [128] o cmake: fix `ENABLE_UNIX_SOCKETS=OFF` with pre-fill enabled on unix + o cmake: fix setting LTO properties on the wrong targets [258] o cmake: fix to disable Schannel and SSPI for non-Windows targets o cmake: fix to restrict `SystemConfiguration` to macOS [139] o cmake: honor `CMAKE_C_FLAGS` in test 1119 and 1167 [206] @@ -88,8 +92,10 @@ This release includes the following bugfixes: o curl_fnmatch, servers: drop local macros in favour of `sizeof()` [21] o curl_mime_data_cb.md: mention what datasize is for [107] o curl_ossl: extend callback table for nghttp3 1.11.0 [46] + o curl_setup.h: include `stdint.h` earlier [260] o curl_setup.h: move UWP detection after `config-win32.h` (revert) [51] o curl_setup.h: move UWP detection after `config-win32.h` [23] + o CURLINFO_FILETIME*.md: correct the examples [242] o CURLOPT: bump `CURL_REDIR_*` macros to `long` [110] o CURLOPT: bump `CURL_SSLVERSION_*` macros to `long` [149] o CURLOPT: bump `CURLALTSVC_*` macros to `long` [96] @@ -104,6 +110,7 @@ This release includes the following bugfixes: o CURLOPT_HTTP_VERSION: mention new default value [179] o CURLOPT_SSL_CTX_*: replace the base64 with XXXX [171] o delta: fix warnings, fix for non-GNU `date` tool [99] + o DEPRECATE.md: drop old OpenSSL versions [266] o DEPRECATE.md: drop support for c-ares versions before 1.16.0 [191] o DEPRECATE.md: drop support for Windows XP/2003 [31] o DEPRECATE.md: remove leftover "nothing" [57] @@ -112,6 +119,7 @@ This release includes the following bugfixes: o docs: add CURLOPT type change history, drop casts where present [143] o docs: fix link CONTRIBUTE.md link [192] o docs: fix name in curl_easy_ssls_export man page [12] + o docs: fix typo (staring -> starting) [211] o docs: point two broken links to archive.org [134] o doh: rename symbols to avoid collision with mingw-w64 headers [66] o easy handle: check validity on external calls [28] @@ -127,12 +135,15 @@ This release includes the following bugfixes: o hostip: do DNS cache pruning in milliseconds [132] o HTTP3.md: avoid `configure` issue for ngtcp2 1.14.0+ compatibility [182] o http: const up readonly H2_NON_FIELD [10] + o http: do the cookie list access under lock [270] o http: silence `-Warray-bounds` with gcc 13+ [44] + o idn: reject conversions that end up as a zero length hostname [273] o inet_pton, inet_ntop: drop declarations when unused [59] o lib1560: fix memory leak when run without UTF-8 support [17] o lib1560: replace an `int` with `bool` [97] o lib2700: use `testnum` [151] o lib517: use `LL` 64-bit literals & re-enable a test case (`time_t`) [100] + o lib: drop `UNUSED_PARAM` macro [259] o libcurl: reset rewind flag in curl_easy_reset() [184] o libssh: Use sftp_aio instead of sftp_async for sftp_recv [92] o libtests: update format strings to avoid casts, drop some macros [109] @@ -150,6 +161,7 @@ This release includes the following bugfixes: o multi: replace remaining EXPIRE_RUN_NOW [67] o multissl: initialize when requesting a random number [30] o ngtcp2: extend callback tables for nghttp3 1.11.0 and ngtcp2 1.14.0 [47] + o ngtcp2: handshake timeout should be equal to --connect-timeout [262] o ngtcp2: use custom mem funcs [204] o openssl: add and use `HAVE_BORINGSSL_LIKE` internal macro [222] o openssl: add and use `HAVE_OPENSSL3` internal macro [223] @@ -171,9 +183,11 @@ This release includes the following bugfixes: o openssl: sync an AWS-LC guard with BoringSSL [199] o openssl: use `RSA_flags()` again with BoringSSL [219] o parallel-max: bump the max value to 65535 [86] + o parsedate: make Curl_getdate_capped able to return epoch [229] o processhelp.pm: fix to use the correct null device on Windows [164] o processhelp.pm: use `Win32::Process*` perl modules if available [200] o projects: drop unused logic from `generate.bat` [157] + o projects: fix Windows project 'clean' function [203] o pytest: add SOCKS tests and scoring [9] o pytest: fix test_17_09_ssl_min_max for BoringSSL [197] o pytest: increase server KeepAliveTimeout [26] @@ -202,6 +216,7 @@ This release includes the following bugfixes: o socks: do_SOCKS5: Fix invalid buffer content on short send [43] o socks_sspi: simplify, clean up Curl_SOCKS5_gssapi_negotiate [237] o spacecheck.pl: when detecting unicode, mention line number [85] + o spacecheck: warn for 3+ empty lines in a row, fix fallouts [240] o spelling: file system [232] o test1148: drop redundant `LC_NUMBER=` env setting [13] o test1557: pass `long` type to `multi_setopt()` [234] @@ -231,7 +246,9 @@ This release includes the following bugfixes: o TODO: remove session export item [194] o TODO: remove the expand ~ idea [216] o tool_cb_wrt: stop alloc/free for every chunk windows console output [140] + o tool_filetime: accept setting negative filetime [256] o tool_getparam: let --trace-config override -v [238] + o tool_getparam: warn on more unicode prefixes [275] o tool_operate: avoid superfluous strdup'ing output [1] o tool_operate: use stricter curl_multi_setopt() arguments [225] o tool_operate: use the correct config pointer [115] @@ -245,10 +262,14 @@ This release includes the following bugfixes: o URL-SYNTAX.md: drop link to codepoints.net to pass linkcheck [190] o urlapi: allow more path characters "raw" when asked to URL encode [146] o urldata: reduce two long struct fields to unsigned short [174] + o urlglob: only accept 255 globs o vquic-tls: fix SSL backend type for QUIC connections using gnutls [29] o vquic: use curl_getenv [168] o vtls: set seen http version on successful ALPN [160] o websocket example: cast print values to unsigned int [251] + o websocket: handling of PONG frames [213] + o websocket: improve handling of 0-len frames [269] + o websocket: reset upload_done when sending data [245] o windows: assume `ADDRESS_FAMILY`, drop feature checks [88] o windows: document toolchain support for `CERT_NAME_SEARCH_ALL_NAMES_FLAG` o windows: document toolchain support for some macros (cont.) [111] @@ -274,6 +295,7 @@ For all changes ever done in curl: Planned upcoming removals include: o Builds using VS2008 + o OpenSSL 1.x support o Support for c-ares versions before 1.16.0 o Support for Windows XP/2003 o The winbuild build system @@ -284,23 +306,25 @@ Planned upcoming removals include: This release would not have looked like this without help, code, reports and advice from friends like these: - adamse on github, Ahmad Gani, Alice Lee Poetics, Ammar Faizi, Anthony Hu, - Berthin Torres Callañaupa, BobodevMm on github, Caolán McNamara, - Cole Leavitt, d1r3ct0r, Dan Fandrich, Daniel Böhmer, Daniel Engberg, - Daniel Stenberg, David Zhuang, devgs on github, Dominik Tomecki, - Dustin L. Howett, Eshan Kelkar, Gabriel Marin, Gisle Vanem, Google Big Sleep, + adamse on github, Ahmad Gani, Alice Lee Poetics, Ammar Faizi, Andriy Druk, + Anthony Hu, Berthin Torres Callañaupa, BobodevMm on github, Calvin Ruocco, + Caolán McNamara, Cole Leavitt, d1r3ct0r, Dan Fandrich, Daniel Böhmer, + Daniel Engberg, Daniel McCarney, Daniel Stenberg, David Zhuang, + devgs on github, Dominik Tomecki, Dustin L. Howett, Eshan Kelkar, + Florian Friedrich, Gabriel Marin, Gisle Vanem, Google Big Sleep, Harry Sintonen, IoannisGS on github, Jelle Raaijmakers, Jeroen Ooms, Kai Pastor, Karthik Das, kkmuffme on github, kupavcevdenis on github, letshack9707 on hackerone, lf- on github, LoRd_MuldeR, Marcel Raad, Michael Osipov, Michał Petryka, Natris on github, nevakrien on github, Oxan van Leeuwen, Paul Gilmartin, Pavel Kropachev, Petar Popovic, Philippe Antoine, Pino Toscano, Qriist, Qriist on github, Ray Satiro, - renovate[bot], rm-rmonaghan on github, Roberto Hidalgo, Samuel Henrique, - Schrijvers Luc, Sebastian Carlos, Sergio Durigan Junior, Simon Dalvai, - Stanislav Osipov, Stefan Eissing, stephannn on github, sunriseL, Tal Regev, - Todd Gamblin, Viktor Szakats, Waldemar Kornewald, xfangfang, yaoy6 on github, - ウさん - (66 contributors) + renovate[bot], RepoRascal on hackerone, rm-rmonaghan on github, + Roberto Hidalgo, Samuel Henrique, Schrijvers Luc, Sebastian Carlos, + Sergio Durigan Junior, Simon Dalvai, Stanislav Osipov, Stefan Eissing, + stephannn on github, sunriseL, Tal Regev, Terence Eden, Todd Gamblin, + Viktor Szakats, Waldemar Kornewald, XCas13, xfangfang, yaoy6 on github, + Yedaya Katsman, ウさん + (74 contributors) References to bug reports and discussions on issues: @@ -506,6 +530,7 @@ References to bug reports and discussions on issues: [200] = https://curl.se/bug/?i=18308 [201] = https://curl.se/bug/?i=18383 [202] = https://curl.se/bug/?i=18029 + [203] = https://curl.se/bug/?i=18412 [204] = https://curl.se/bug/?i=18196 [205] = https://curl.se/bug/?i=18306 [206] = https://curl.se/bug/?i=18307 @@ -513,7 +538,9 @@ References to bug reports and discussions on issues: [208] = https://curl.se/bug/?i=18304 [209] = https://curl.se/bug/?i=18377 [210] = https://curl.se/bug/?i=18405 + [211] = https://curl.se/bug/?i=18450 [212] = https://curl.se/bug/?i=18378 + [213] = https://curl.se/bug/?i=16706 [214] = https://curl.se/bug/?i=18371 [215] = https://curl.se/bug/?i=18365 [216] = https://curl.se/bug/?i=18363 @@ -529,6 +556,7 @@ References to bug reports and discussions on issues: [226] = https://curl.se/bug/?i=18357 [227] = https://curl.se/bug/?i=18349 [228] = https://curl.se/bug/?i=18350 + [229] = https://curl.se/bug/?i=18445 [230] = https://curl.se/bug/?i=18404 [231] = https://curl.se/bug/?i=18351 [232] = https://curl.se/bug/?i=18348 @@ -539,12 +567,28 @@ References to bug reports and discussions on issues: [237] = https://curl.se/bug/?i=18315 [238] = https://curl.se/bug/?i=18346 [239] = https://curl.se/bug/?i=18323 + [240] = https://curl.se/bug/?i=18478 [241] = https://curl.se/bug/?i=18335 + [242] = https://curl.se/bug/?i=18447 [243] = https://curl.se/bug/?i=18390 [244] = https://curl.se/bug/?i=18398 + [245] = https://curl.se/bug/?i=18476 [246] = https://curl.se/bug/?i=18333 [247] = https://curl.se/bug/?i=18329 [248] = https://curl.se/bug/?i=18328 [249] = https://curl.se/bug/?i=18327 + [250] = https://curl.se/bug/?i=18434 [251] = https://curl.se/bug/?i=18326 [252] = https://curl.se/bug/?i=18263 + [253] = https://curl.se/bug/?i=18433 + [256] = https://curl.se/bug/?i=18424 + [258] = https://curl.se/bug/?i=18469 + [259] = https://curl.se/bug/?i=18455 + [260] = https://curl.se/bug/?i=18430 + [262] = https://curl.se/bug/?i=18431 + [265] = https://curl.se/bug/?i=18422 + [266] = https://curl.se/bug/?i=18413 + [269] = https://curl.se/bug/?i=18286 + [270] = https://curl.se/bug/?i=18457 + [273] = https://curl.se/bug/?i=18462 + [275] = https://curl.se/bug/?i=18459 diff --git a/docs/VULN-DISCLOSURE-POLICY.md b/docs/VULN-DISCLOSURE-POLICY.md index 00cdf86ec..b32b3d3f4 100644 --- a/docs/VULN-DISCLOSURE-POLICY.md +++ b/docs/VULN-DISCLOSURE-POLICY.md @@ -353,3 +353,90 @@ using the protocols or options that require the use of those algorithms. When servers upgrade to use secure alternatives, curl users should use those options/protocols. + +# curl major incident response + +Vulnerability disclosure manages the full life cycle of a vulnerability +affecting curl - where the **curl-security** team privately engages with +reporters coordinating on embargo and eventual release of security fixes. + +For most vulnerabilities (even critical vulnerabilities) this is the +normal _'mode'_ of incident response. + +A **major incident** is defined as something that has much larger scope and +impact on users and developers of curl. + +A major incident usually encompasses one or more of the following: +* broad and deep impact on developers, distros and users +* high visibility +* remote code execution +* exploit readily available +* critical curl infrastructure compromised +* time sensitive +* premature disclosure (e.g. embargo broken) + +A major incident is declared only when it is deemed that the normal +vulnerability disclosure process is not sufficient. + +The curl **major incident** process is as follows: + +## Major incident begins + +Only a member of the **curl-security** team can declare a **major incident** +via any or all of the following communication channels: + +* **irc**: channel #curl on the network [Libera.Chat](https://libera.chat) +* **mailing-lists**: + * curl-announce + * curl-users + * curl-distros +* **website**: [curl.se](https://curl.se) + +This declaration may also be transmitted via other channels, though the +above are considered official channels. + +The veracity of such a communication can be verified by consulting two +or more **curl-security** team members. + +This announcement nominates, from **curl-security** team, the following +roles: + +* **incident lead** - Coordinates technical efforts +* **communication lead** - Single point of public contact + +It is likely that our [BDFL](https://en.wikipedia.org/wiki/Benevolent_dictator_for_life) occupies +one of these roles, though this plan does not depend on it. + +A declaration may also contain more detailed information but as we honor embargoes +and vulnerability disclosure throughout this process, it may also just contain +brief notification that a **major incident** is occurring. + +## Major incident ongoing + +During the incident - all press, media, legal or commercial entities should contact +communication leader (security@curl.se). + +Existing **curl-security** team internal communication channels are used +for all internal communication. + +Existing vulnerability disclosure process are followed for any embargoes +and fixes. + +Where possible, public communication are provided: +* regular communication from communication leader (ex. daily update) +* asynchronous communication from incident leader + +* Delivered to the aforementioned curl communication channels. + +A log is kept of all external and internal communication. + +Once fixes have been released we may provide a more detailed postmortem and +overall timeline of events. + +## Major incident ends + +Both the incident and communication leads declare when a **major incident** +has finished. + +Any notices are removed and a return to normal vulnerability disclosure +process. diff --git a/docs/examples/cacertinmem.c b/docs/examples/cacertinmem.c index 9b39667af..ec12df58b 100644 --- a/docs/examples/cacertinmem.c +++ b/docs/examples/cacertinmem.c @@ -72,8 +72,8 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *pointer) int i; STACK_OF(X509_INFO) *inf; - (void)curl; /* avoid warnings */ - (void)pointer; /* avoid warnings */ + (void)curl; + (void)pointer; if(!cts || !cbio) { return rv; diff --git a/docs/examples/chkspeed.c b/docs/examples/chkspeed.c index fc4081469..264c514ba 100644 --- a/docs/examples/chkspeed.c +++ b/docs/examples/chkspeed.c @@ -56,8 +56,8 @@ static size_t WriteCallback(void *ptr, size_t size, size_t nmemb, void *data) { /* we are not interested in the downloaded bytes itself, so we only return the size we would have saved ... */ - (void)ptr; /* unused */ - (void)data; /* unused */ + (void)ptr; + (void)data; return (size_t)(size * nmemb); } diff --git a/docs/examples/debug.c b/docs/examples/debug.c index 2bd8b971a..5303c833f 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -90,7 +90,7 @@ int my_trace(CURL *handle, curl_infotype type, { struct data *config = (struct data *)userp; const char *text; - (void)handle; /* prevent compiler warning */ + (void)handle; switch(type) { case CURLINFO_TEXT: diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c index f411d2ea6..d30b944bb 100644 --- a/docs/examples/ephiperfifo.c +++ b/docs/examples/ephiperfifo.c @@ -245,7 +245,6 @@ static void timer_cb(struct GlobalInfo *g, int revents) } - /* Clean up the SockInfo structure */ static void remsock(struct SockInfo *f, struct GlobalInfo *g) { @@ -260,7 +259,6 @@ static void remsock(struct SockInfo *f, struct GlobalInfo *g) } - /* Assign information to a SockInfo structure */ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, struct GlobalInfo *g) @@ -287,7 +285,6 @@ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, } - /* Initialize a new SockInfo structure */ static void addsock(curl_socket_t s, CURL *easy, int action, struct GlobalInfo *g) @@ -328,7 +325,6 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) } - /* CURLOPT_WRITEFUNCTION */ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) { diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c index 96937fc62..b28f057c8 100644 --- a/docs/examples/evhiperfifo.c +++ b/docs/examples/evhiperfifo.c @@ -165,7 +165,6 @@ static void mcode_or_die(const char *where, CURLMcode code) } - /* Check for completed transfers, and remove their easy handles */ static void check_multi_info(struct GlobalInfo *g) { @@ -193,7 +192,6 @@ static void check_multi_info(struct GlobalInfo *g) } - /* Called by libevent when we get action on a multi socket */ static void event_cb(EV_P_ struct ev_io *w, int revents) { @@ -243,7 +241,6 @@ static void remsock(struct SockInfo *f, struct GlobalInfo *g) } - /* Assign information to a SockInfo structure */ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, struct GlobalInfo *g) @@ -265,7 +262,6 @@ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, } - /* Initialize a new SockInfo structure */ static void addsock(curl_socket_t s, CURL *easy, int action, struct GlobalInfo *g) diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c index d1e534ffb..35a519b63 100644 --- a/docs/examples/hiperfifo.c +++ b/docs/examples/hiperfifo.c @@ -188,7 +188,6 @@ static void check_multi_info(struct GlobalInfo *g) } - /* Called by libevent when we get action on a multi socket */ static void event_cb(int fd, short kind, void *userp) { @@ -212,7 +211,6 @@ static void event_cb(int fd, short kind, void *userp) } - /* Called by libevent when our timeout expires */ static void timer_cb(int fd, short kind, void *userp) { @@ -228,7 +226,6 @@ static void timer_cb(int fd, short kind, void *userp) } - /* Clean up the SockInfo structure */ static void remsock(struct SockInfo *f) { @@ -241,7 +238,6 @@ static void remsock(struct SockInfo *f) } - /* Assign information to a SockInfo structure */ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, struct GlobalInfo *g) @@ -261,7 +257,6 @@ static void setsock(struct SockInfo *f, curl_socket_t s, CURL *e, int act, } - /* Initialize a new SockInfo structure */ static void addsock(curl_socket_t s, CURL *easy, int action, struct GlobalInfo *g) @@ -302,7 +297,6 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) } - /* CURLOPT_WRITEFUNCTION */ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) { diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c index ac9b9a082..954cdcbc6 100644 --- a/docs/examples/http2-download.c +++ b/docs/examples/http2-download.c @@ -110,7 +110,7 @@ int my_trace(CURL *handle, curl_infotype type, const char *text; struct transfer *t = (struct transfer *)userp; unsigned int num = t->num; - (void)handle; /* prevent compiler warning */ + (void)handle; switch(type) { case CURLINFO_TEXT: diff --git a/docs/examples/http2-pushinmemory.c b/docs/examples/http2-pushinmemory.c index 53c368e01..873883ca5 100644 --- a/docs/examples/http2-pushinmemory.c +++ b/docs/examples/http2-pushinmemory.c @@ -97,8 +97,8 @@ static int server_push_callback(CURL *parent, { char *headp; int *transfers = (int *)userp; - (void)parent; /* we have no use for this */ - (void)num_headers; /* unused */ + (void)parent; + (void)num_headers; if(pushindex == MAX_FILES) /* cannot fit anymore */ diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c index e259e1497..df4e49ea5 100644 --- a/docs/examples/http2-serverpush.c +++ b/docs/examples/http2-serverpush.c @@ -92,7 +92,7 @@ int my_trace(CURL *handle, curl_infotype type, void *userp) { const char *text; - (void)handle; /* prevent compiler warning */ + (void)handle; (void)userp; switch(type) { case CURLINFO_TEXT: @@ -171,7 +171,7 @@ static int server_push_callback(CURL *parent, FILE *out; static unsigned int count = 0; - (void)parent; /* we have no use for this */ + (void)parent; curl_msnprintf(filename, 128, "push%u", count++); diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c index c033b0b68..482889ea1 100644 --- a/docs/examples/http2-upload.c +++ b/docs/examples/http2-upload.c @@ -150,7 +150,7 @@ int my_trace(CURL *handle, curl_infotype type, struct timeval tv; time_t secs; struct tm *now; - (void)handle; /* prevent compiler warning */ + (void)handle; gettimeofday(&tv, NULL); if(!known_offset) { diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index 79123ca22..738732279 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -91,7 +91,7 @@ int my_trace(CURL *handle, curl_infotype type, const char *text; (void)userp; - (void)handle; /* prevent compiler warning */ + (void)handle; switch(type) { case CURLINFO_TEXT: diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c index 966812905..161182eec 100644 --- a/docs/examples/threaded-ssl.c +++ b/docs/examples/threaded-ssl.c @@ -72,7 +72,7 @@ int main(int argc, char **argv) { pthread_t tid[NUMT]; int i; - (void)argc; /* we do not use any arguments in this example */ + (void)argc; (void)argv; /* Must initialize libcurl before any threads are started */ diff --git a/docs/examples/usercertinmem.c b/docs/examples/usercertinmem.c index 536b65b49..670ae4dc7 100644 --- a/docs/examples/usercertinmem.c +++ b/docs/examples/usercertinmem.c @@ -93,8 +93,8 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *pointer) "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" "-----END RSA PRIVATE KEY-----\n"; - (void)curl; /* avoid warnings */ - (void)pointer; /* avoid warnings */ + (void)curl; + (void)pointer; /* get a BIO */ bio = BIO_new_mem_buf((char *)mypem, -1); diff --git a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md index 9e7aa8ad7..4ecfb5327 100644 --- a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md +++ b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md @@ -149,7 +149,7 @@ int my_trace(CURL *handle, curl_infotype type, void *clientp) { const char *text; - (void)handle; /* prevent compiler warning */ + (void)handle; (void)clientp; switch(type) { diff --git a/docs/tests/FILEFORMAT.md b/docs/tests/FILEFORMAT.md index 3bb1acb25..b28e819eb 100644 --- a/docs/tests/FILEFORMAT.md +++ b/docs/tests/FILEFORMAT.md @@ -416,7 +416,6 @@ What server(s) this test case requires/uses. Available servers: - `http-unix` - `imap` - `mqtt` -- `none` - `pop3` - `rtsp` - `rtsp-ipv6` diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5d49cfa53..3476d55b0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -155,11 +155,11 @@ if(BUILD_STATIC_LIBS) endif() if(CURL_HAS_LTO) if(CMAKE_CONFIGURATION_TYPES) - set_target_properties(${LIB_OBJECT} PROPERTIES + set_target_properties(${LIB_STATIC} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) else() - set_target_properties(${LIB_OBJECT} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) + set_target_properties(${LIB_STATIC} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() endif() @@ -191,11 +191,11 @@ if(BUILD_SHARED_LIBS) endif() if(CURL_HAS_LTO) if(CMAKE_CONFIGURATION_TYPES) - set_target_properties(${LIB_OBJECT} PROPERTIES + set_target_properties(${LIB_SHARED} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) else() - set_target_properties(${LIB_OBJECT} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) + set_target_properties(${LIB_SHARED} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() endif() diff --git a/lib/bufq.c b/lib/bufq.c index 40d1af0c1..5cfd7520f 100644 --- a/lib/bufq.c +++ b/lib/bufq.c @@ -149,7 +149,6 @@ static void chunk_list_free(struct buf_chunk **anchor) } - void Curl_bufcp_init(struct bufc_pool *pool, size_t chunk_size, size_t spare_max) { diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index 59b34ae46..5e4c20444 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -767,6 +767,7 @@ static CURLcode cf_ip_happy_connect(struct Curl_cfilter *cf, cf->next = ctx->ballers.winner->cf; ctx->ballers.winner->cf = NULL; cf_ip_happy_ctx_clear(cf, data); + Curl_expire_done(data, EXPIRE_HAPPY_EYEBALLS); if(cf->conn->handler->protocol & PROTO_FAMILY_SSH) Curl_pgrsTime(data, TIMER_APPCONNECT); /* we are connected already */ diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 426caf82d..7cf1ed2a5 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -1444,7 +1444,7 @@ static CURLcode cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data, size_t orig_len = len; CURLcode result = CURLE_OK; - (void)eos; /* unused */ + (void)eos; *pnwritten = 0; fdsave = cf->conn->sock[cf->sockindex]; cf->conn->sock[cf->sockindex] = ctx->sock; diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c index b178dff84..baee79fbe 100644 --- a/lib/curl_rtmp.c +++ b/lib/curl_rtmp.c @@ -307,9 +307,9 @@ static CURLcode rtmp_do(struct Curl_easy *data, bool *done) static CURLcode rtmp_done(struct Curl_easy *data, CURLcode status, bool premature) { - (void)data; /* unused */ - (void)status; /* unused */ - (void)premature; /* unused */ + (void)data; + (void)status; + (void)premature; return CURLE_OK; } @@ -334,7 +334,7 @@ static CURLcode rtmp_recv(struct Curl_easy *data, int sockindex, char *buf, CURLcode result = CURLE_OK; ssize_t nread; - (void)sockindex; /* unused */ + (void)sockindex; *pnread = 0; if(!r) return CURLE_FAILED_INIT; @@ -362,8 +362,8 @@ static CURLcode rtmp_send(struct Curl_easy *data, int sockindex, RTMP *r = Curl_conn_meta_get(conn, CURL_META_RTMP_CONN); ssize_t nwritten; - (void)sockindex; /* unused */ - (void)eos; /* unused */ + (void)sockindex; + (void)eos; *pnwritten = 0; if(!r) return CURLE_FAILED_INIT; diff --git a/lib/curl_setup.h b/lib/curl_setup.h index bc3fbf28d..e0fbce92e 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -783,20 +783,12 @@ * Parameters should of course normally not be unused, but for example when * we have multiple implementations of the same interface it may happen. */ - #if defined(__GNUC__) && ((__GNUC__ >= 3) || \ ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7))) -# define UNUSED_PARAM __attribute__((__unused__)) # define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#elif defined(__IAR_SYSTEMS_ICC__) -# define UNUSED_PARAM __attribute__((__unused__)) -# if (__VER__ >= 9040001) -# define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -# else -# define WARN_UNUSED_RESULT -# endif +#elif defined(__IAR_SYSTEMS_ICC__) && (__VER__ >= 9040001) +# define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else -# define UNUSED_PARAM /* NOTHING */ # define WARN_UNUSED_RESULT #endif diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index e11b2d6a9..7e9b22338 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -665,7 +665,6 @@ static CURLcode Curl_sha512_256_update(void *context, } - /** * Size of "length" insertion in bits. * See FIPS PUB 180-4 section 5.1.2. diff --git a/lib/curl_trc.c b/lib/curl_trc.c index 8c01eff14..52671f4ea 100644 --- a/lib/curl_trc.c +++ b/lib/curl_trc.c @@ -273,6 +273,45 @@ struct curl_trc_feat Curl_trc_feat_dns = { CURL_LOG_LVL_NONE, }; +static const char * const Curl_trc_timer_names[]={ + "100_TIMEOUT", + "ASYNC_NAME", + "CONNECTTIMEOUT", + "DNS_PER_NAME", + "DNS_PER_NAME2", + "HAPPY_EYEBALLS_DNS", + "HAPPY_EYEBALLS", + "MULTI_PENDING", + "SPEEDCHECK", + "TIMEOUT", + "TOOFAST", + "QUIC", + "FTP_ACCEPT", + "ALPN_EYEBALLS", + "SHUTDOWN", +}; + +const char *Curl_trc_timer_name(int tid) +{ + if((tid >= 0) && ((size_t)tid < CURL_ARRAYSIZE(Curl_trc_timer_names))) + return Curl_trc_timer_names[(size_t)tid]; + return "UNKNOWN?"; +} + +void Curl_trc_multi_timeouts(struct Curl_easy *data) +{ + struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); + if(e) { + struct curltime now = curlx_now(); + while(e) { + struct time_node *n = Curl_node_elem(e); + e = Curl_node_next(e); + CURL_TRC_M(data, "[TIMEOUT] %s expires in %" FMT_TIMEDIFF_T "ns", + CURL_TIMER_NAME(n->eid), + curlx_timediff_us(n->time, now)); + } + } +} static const char * const Curl_trc_mstate_names[]={ "INIT", diff --git a/lib/curl_trc.h b/lib/curl_trc.h index 6db1496c7..fa0999250 100644 --- a/lib/curl_trc.h +++ b/lib/curl_trc.h @@ -85,6 +85,9 @@ void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf, void Curl_trc_multi(struct Curl_easy *data, const char *fmt, ...) CURL_PRINTF(2, 3); const char *Curl_trc_mstate_name(int state); +const char *Curl_trc_timer_name(int tid); +void Curl_trc_multi_timeouts(struct Curl_easy *data); + void Curl_trc_write(struct Curl_easy *data, const char *fmt, ...) CURL_PRINTF(2, 3); void Curl_trc_read(struct Curl_easy *data, @@ -113,12 +116,15 @@ void Curl_trc_ws(struct Curl_easy *data, const char *fmt, ...) CURL_PRINTF(2, 3); #endif +#define CURL_TRC_M_is_verbose(data) \ + Curl_trc_ft_is_verbose(data, &Curl_trc_feat_multi) + #if defined(CURL_HAVE_C99) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #define infof(data, ...) \ do { if(Curl_trc_is_verbose(data)) \ Curl_infof(data, __VA_ARGS__); } while(0) #define CURL_TRC_M(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_multi)) \ + do { if(CURL_TRC_M_is_verbose(data)) \ Curl_trc_multi(data, __VA_ARGS__); } while(0) #define CURL_TRC_CF(data, cf, ...) \ do { if(Curl_trc_cf_is_verbose(cf, data)) \ @@ -202,6 +208,10 @@ extern struct curl_trc_feat Curl_trc_feat_dns; (Curl_trc_is_verbose(data) && \ (ft)->log_level >= CURL_LOG_LVL_INFO) #define CURL_MSTATE_NAME(s) Curl_trc_mstate_name((int)(s)) +#define CURL_TIMER_NAME(t) Curl_trc_timer_name((int)(t)) +#define CURL_TRC_M_TIMEOUTS(data) \ + do { if(CURL_TRC_M_is_verbose(data)) \ + Curl_trc_multi_timeouts(data); } while(0) #else /* CURL_DISABLE_VERBOSE_STRINGS */ /* All informational messages are not compiled in for size savings */ @@ -210,6 +220,8 @@ extern struct curl_trc_feat Curl_trc_feat_dns; #define Curl_trc_cf_is_verbose(x,y) (FALSE) #define Curl_trc_ft_is_verbose(x,y) (FALSE) #define CURL_MSTATE_NAME(x) ((void)(x), "-") +#define CURL_TIMER_NAME(x) ((void)(x), "-") +#define CURL_TRC_M_TIMEOUTS(x) Curl_nop_stmt #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ diff --git a/lib/file.c b/lib/file.c index 0b44d2257..749759653 100644 --- a/lib/file.c +++ b/lib/file.c @@ -292,8 +292,8 @@ static CURLcode file_done(struct Curl_easy *data, CURLcode status, bool premature) { struct FILEPROTO *file = Curl_meta_get(data, CURL_META_FILE_EASY); - (void)status; /* not used */ - (void)premature; /* not used */ + (void)status; + (void)premature; if(file) file_cleanup(file); @@ -305,7 +305,7 @@ static CURLcode file_disconnect(struct Curl_easy *data, struct connectdata *conn, bool dead_connection) { - (void)dead_connection; /* not used */ + (void)dead_connection; (void)conn; return file_done(data, CURLE_OK, FALSE); } @@ -3774,7 +3774,6 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) } - /*********************************************************************** * * ftp_perform() diff --git a/lib/hostip.c b/lib/hostip.c index dfff9d61d..2d122fb99 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -1136,14 +1136,14 @@ CURLcode Curl_resolv_timeout(struct Curl_easy *data, Curl_resolve_test_delay(); #endif -#else /* USE_ALARM_TIMEOUT */ +#else /* !USE_ALARM_TIMEOUT */ #ifndef CURLRES_ASYNCH if(timeoutms) infof(data, "timeout on name lookup is not supported"); #else - (void)timeoutms; /* timeoutms not used with an async resolver */ + (void)timeoutms; #endif -#endif /* else USE_ALARM_TIMEOUT */ +#endif /* USE_ALARM_TIMEOUT */ /* Perform the actual name resolution. This might be interrupted by an * alarm if it takes too long. diff --git a/lib/http.c b/lib/http.c index bcbe6e9e7..e01de6f47 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2410,45 +2410,43 @@ static CURLcode http_cookies(struct Curl_easy *data, if(data->cookies || addcookies) { struct Curl_llist list; int count = 0; - int rc = 1; if(data->cookies && data->state.cookie_engine) { const char *host = data->state.aptr.cookiehost ? data->state.aptr.cookiehost : data->conn->host.name; Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); - rc = Curl_cookie_getlist(data, data->conn, host, &list); - Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); - } - if(!rc) { - struct Curl_llist_node *n; - size_t clen = 8; /* hold the size of the generated Cookie: header */ - - /* loop through all cookies that matched */ - for(n = Curl_llist_head(&list); n; n = Curl_node_next(n)) { - struct Cookie *co = Curl_node_elem(n); - if(co->value) { - size_t add; - if(!count) { - result = curlx_dyn_addn(r, STRCONST("Cookie: ")); + if(!Curl_cookie_getlist(data, data->conn, host, &list)) { + struct Curl_llist_node *n; + size_t clen = 8; /* hold the size of the generated Cookie: header */ + + /* loop through all cookies that matched */ + for(n = Curl_llist_head(&list); n; n = Curl_node_next(n)) { + struct Cookie *co = Curl_node_elem(n); + if(co->value) { + size_t add; + if(!count) { + result = curlx_dyn_addn(r, STRCONST("Cookie: ")); + if(result) + break; + } + add = strlen(co->name) + strlen(co->value) + 1; + if(clen + add >= MAX_COOKIE_HEADER_LEN) { + infof(data, "Restricted outgoing cookies due to header size, " + "'%s' not sent", co->name); + linecap = TRUE; + break; + } + result = curlx_dyn_addf(r, "%s%s=%s", count ? "; " : "", + co->name, co->value); if(result) break; + clen += add + (count ? 2 : 0); + count++; } - add = strlen(co->name) + strlen(co->value) + 1; - if(clen + add >= MAX_COOKIE_HEADER_LEN) { - infof(data, "Restricted outgoing cookies due to header size, " - "'%s' not sent", co->name); - linecap = TRUE; - break; - } - result = curlx_dyn_addf(r, "%s%s=%s", count ? "; " : "", - co->name, co->value); - if(result) - break; - clen += add + (count ? 2 : 0); - count++; } + Curl_llist_destroy(&list, NULL); } - Curl_llist_destroy(&list, NULL); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); } if(addcookies && !result && !linecap) { if(!count) @@ -2659,7 +2657,7 @@ static CURLcode http_add_connection_hd(struct Curl_easy *data, if(!result && data->state.http_hd_h2_settings) { result = curlx_dyn_addf(req, "%s%s", sep, "HTTP2-Settings"); } - if(rlen < curlx_dyn_len(req)) + if(!result && (rlen < curlx_dyn_len(req))) result = curlx_dyn_addn(req, STRCONST("\r\n")); free(custom_val); @@ -2995,7 +2993,7 @@ checkrtspprefix(struct Curl_easy *data, { statusline result = STATUS_BAD; statusline onmatch = len >= 5 ? STATUS_DONE : STATUS_UNKNOWN; - (void)data; /* unused */ + (void)data; if(checkprefixmax("RTSP/", s, len)) result = onmatch; @@ -323,8 +323,14 @@ CURLcode Curl_idn_decode(const char *input, char **output) result = CURLE_OUT_OF_MEMORY; } #endif - if(!result) - *output = d; + if(!result) { + if(!d[0]) { /* ended up zero length, not acceptable */ + result = CURLE_URL_MALFORMAT; + free(d); + } + else + *output = d; + } return result; } diff --git a/lib/imap.c b/lib/imap.c index 7e6b132ba..41aec8ffa 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1005,7 +1005,7 @@ static CURLcode imap_state_servergreet_resp(struct Curl_easy *data, int imapcode, imapstate instate) { - (void)instate; /* no use for this yet */ + (void)instate; if(imapcode == IMAP_RESP_PREAUTH) { /* PREAUTH */ @@ -1030,7 +1030,7 @@ static CURLcode imap_state_capability_resp(struct Curl_easy *data, struct connectdata *conn = data->conn; const char *line = curlx_dyn_ptr(&imapc->pp.recvbuf); - (void)instate; /* no use for this yet */ + (void)instate; /* Do we have an untagged response? */ if(imapcode == '*') { @@ -1111,7 +1111,7 @@ static CURLcode imap_state_starttls_resp(struct Curl_easy *data, { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; /* Pipelining in response is forbidden. */ if(imapc->pp.overflow) @@ -1140,7 +1140,7 @@ static CURLcode imap_state_auth_resp(struct Curl_easy *data, CURLcode result = CURLE_OK; saslprogress progress; - (void)instate; /* no use for this yet */ + (void)instate; result = Curl_sasl_continue(&imapc->sasl, data, imapcode, &progress); if(!result) @@ -1171,7 +1171,7 @@ static CURLcode imap_state_login_resp(struct Curl_easy *data, imapstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(imapcode != IMAP_RESP_OK) { failf(data, "Access denied. %c", imapcode); @@ -1194,7 +1194,7 @@ static CURLcode imap_state_listsearch_resp(struct Curl_easy *data, char *line = curlx_dyn_ptr(&imapc->pp.recvbuf); size_t len = imapc->pp.nfinal; - (void)instate; /* No use for this yet */ + (void)instate; if(imapcode == '*') result = Curl_client_write(data, CLIENTWRITE_BODY, line, len); @@ -1217,7 +1217,7 @@ static CURLcode imap_state_select_resp(struct Curl_easy *data, CURLcode result = CURLE_OK; const char *line = curlx_dyn_ptr(&imapc->pp.recvbuf); - (void)instate; /* no use for this yet */ + (void)instate; if(imapcode == '*') { /* See if this is an UIDVALIDITY response */ @@ -1279,7 +1279,7 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data, bool parsed = FALSE; curl_off_t size = 0; - (void)instate; /* no use for this yet */ + (void)instate; if(imapcode != '*') { Curl_pgrsSetDownloadSize(data, -1); @@ -1370,7 +1370,7 @@ static CURLcode imap_state_fetch_final_resp(struct Curl_easy *data, { CURLcode result = CURLE_OK; - (void)instate; /* No use for this yet */ + (void)instate; if(imapcode != IMAP_RESP_OK) result = CURLE_WEIRD_SERVER_REPLY; @@ -1388,7 +1388,7 @@ static CURLcode imap_state_append_resp(struct Curl_easy *data, imapstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* No use for this yet */ + (void)instate; if(imapcode != '+') { result = CURLE_UPLOAD_FAILED; @@ -1415,7 +1415,7 @@ static CURLcode imap_state_append_final_resp(struct Curl_easy *data, { CURLcode result = CURLE_OK; - (void)instate; /* No use for this yet */ + (void)instate; if(imapcode != IMAP_RESP_OK) result = CURLE_UPLOAD_FAILED; diff --git a/lib/krb5.c b/lib/krb5.c index 40243bddb..563d724bb 100644 --- a/lib/krb5.c +++ b/lib/krb5.c @@ -130,7 +130,7 @@ krb5_init(void *app_data) static int krb5_check_prot(void *app_data, int level) { - (void)app_data; /* unused */ + (void)app_data; if(level == PROT_CONFIDENTIAL) return -1; return 0; @@ -138,8 +138,7 @@ krb5_check_prot(void *app_data, int level) static int krb5_decode(void *app_data, void *buf, int len, - int level UNUSED_PARAM, - struct connectdata *conn UNUSED_PARAM) + int level, struct connectdata *conn) { gss_ctx_id_t *context = app_data; OM_uint32 maj, min; @@ -470,7 +469,7 @@ static int ftp_send_command(struct Curl_easy *data, const char *message, ...) ftp_code = -1; } - (void)nread; /* Unused */ + (void)nread; return ftp_code; } @@ -703,7 +702,7 @@ static CURLcode sec_send(struct Curl_easy *data, int sockindex, const void *buffer, size_t len, bool eos, size_t *pnwritten) { - (void)eos; /* unused */ + (void)eos; return sec_write(data, sockindex, buffer, len, pnwritten); } diff --git a/lib/mime.c b/lib/mime.c index f480bc704..894413be1 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -129,7 +129,6 @@ static const char aschex[] = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46"; - #ifndef __VMS #define filesize(name, stat_data) (stat_data.st_size) #define fopen_read fopen @@ -661,7 +660,7 @@ static size_t mime_mem_read(char *buffer, size_t size, size_t nitems, { curl_mimepart *part = (curl_mimepart *) instream; size_t sz = curlx_sotouz(part->datasize - part->state.offset); - (void)size; /* Always 1.*/ + (void)size; /* Always 1 */ if(!nitems) return STOP_FILLING; @@ -1000,7 +999,7 @@ static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems, { curl_mime *mime = (curl_mime *) instream; size_t cursize = 0; - (void)size; /* Always 1. */ + (void)size; /* Always 1 */ while(nitems) { size_t sz = 0; @@ -1593,7 +1592,7 @@ size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, void *instream) size_t ret; bool hasread; - (void)size; /* Always 1. */ + (void)size; /* Always 1 */ /* If `nitems` is <= 4, some encoders will return STOP_FILLING without * adding any data and this loops infinitely. */ diff --git a/lib/multi.c b/lib/multi.c index 1c09b14b6..918928d03 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1093,7 +1093,7 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data, /* Unblocked and waiting to receive with buffered input. * Make transfer run again at next opportunity. */ - if(!Curl_xfer_is_blocked(data) && + if(!Curl_xfer_is_blocked(data) && !Curl_xfer_is_too_fast(data) && ((Curl_pollset_want_read(data, ps, data->conn->sock[FIRSTSOCKET]) && Curl_conn_data_pending(data, FIRSTSOCKET)) || (Curl_pollset_want_read(data, ps, data->conn->sock[SECONDARYSOCKET]) && @@ -1103,36 +1103,41 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data, Curl_multi_mark_dirty(data); } - switch(ps->n) { - case 0: - CURL_TRC_M(data, "%s pollset[], timeouts=%zu, paused %d/%d (r/w)", - caller, Curl_llist_count(&data->state.timeoutlist), - Curl_xfer_send_is_paused(data), - Curl_xfer_recv_is_paused(data)); - break; - case 1: - CURL_TRC_M(data, "%s pollset[fd=%" FMT_SOCKET_T " %s%s], timeouts=%zu", - caller, ps->sockets[0], - (ps->actions[0] & CURL_POLL_IN) ? "IN" : "", - (ps->actions[0] & CURL_POLL_OUT) ? "OUT" : "", - Curl_llist_count(&data->state.timeoutlist)); - break; - case 2: - CURL_TRC_M(data, "%s pollset[fd=%" FMT_SOCKET_T " %s%s, " - "fd=%" FMT_SOCKET_T " %s%s], timeouts=%zu", - caller, ps->sockets[0], - (ps->actions[0] & CURL_POLL_IN) ? "IN" : "", - (ps->actions[0] & CURL_POLL_OUT) ? "OUT" : "", - ps->sockets[1], - (ps->actions[1] & CURL_POLL_IN) ? "IN" : "", - (ps->actions[1] & CURL_POLL_OUT) ? "OUT" : "", - Curl_llist_count(&data->state.timeoutlist)); - break; - default: - CURL_TRC_M(data, "%s pollset[fds=%u], timeouts=%zu", - caller, ps->n, Curl_llist_count(&data->state.timeoutlist)); - break; + if(CURL_TRC_M_is_verbose(data)) { + size_t timeout_count = Curl_llist_count(&data->state.timeoutlist); + switch(ps->n) { + case 0: + CURL_TRC_M(data, "%s pollset[], timeouts=%zu, paused %d/%d (r/w)", + caller, timeout_count, + Curl_xfer_send_is_paused(data), + Curl_xfer_recv_is_paused(data)); + break; + case 1: + CURL_TRC_M(data, "%s pollset[fd=%" FMT_SOCKET_T " %s%s], timeouts=%zu", + caller, ps->sockets[0], + (ps->actions[0] & CURL_POLL_IN) ? "IN" : "", + (ps->actions[0] & CURL_POLL_OUT) ? "OUT" : "", + timeout_count); + break; + case 2: + CURL_TRC_M(data, "%s pollset[fd=%" FMT_SOCKET_T " %s%s, " + "fd=%" FMT_SOCKET_T " %s%s], timeouts=%zu", + caller, ps->sockets[0], + (ps->actions[0] & CURL_POLL_IN) ? "IN" : "", + (ps->actions[0] & CURL_POLL_OUT) ? "OUT" : "", + ps->sockets[1], + (ps->actions[1] & CURL_POLL_IN) ? "IN" : "", + (ps->actions[1] & CURL_POLL_OUT) ? "OUT" : "", + timeout_count); + break; + default: + CURL_TRC_M(data, "%s pollset[fds=%u], timeouts=%zu", + caller, ps->n, timeout_count); + break; + } + CURL_TRC_M_TIMEOUTS(data); } + if(expect_sockets && !ps->n && data->multi && !Curl_uint_bset_contains(&data->multi->dirty, data->mid) && !Curl_llist_count(&data->state.timeoutlist) && @@ -1161,7 +1166,7 @@ CURLMcode curl_multi_fdset(CURLM *m, struct Curl_multi *multi = m; struct easy_pollset ps; unsigned int i, mid; - (void)exc_fd_set; /* not used */ + (void)exc_fd_set; if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; @@ -1860,7 +1865,7 @@ static void multi_posttransfer(struct Curl_easy *data) if(!data->set.no_signal) signal(SIGPIPE, data->state.prev_signal); #else - (void)data; /* unused parameter */ + (void)data; #endif } @@ -1880,6 +1885,40 @@ static CURLcode multi_follow(struct Curl_easy *data, return CURLE_TOO_MANY_REDIRECTS; } +static CURLcode mspeed_check(struct Curl_easy *data, + struct curltime *nowp) +{ + timediff_t recv_wait_ms = 0; + timediff_t send_wait_ms = 0; + + /* check if over send speed */ + if(data->set.max_send_speed) + send_wait_ms = Curl_pgrsLimitWaitTime(&data->progress.ul, + data->set.max_send_speed, + *nowp); + + /* check if over recv speed */ + if(data->set.max_recv_speed) + recv_wait_ms = Curl_pgrsLimitWaitTime(&data->progress.dl, + data->set.max_recv_speed, + *nowp); + + if(send_wait_ms || recv_wait_ms) { + if(data->mstate != MSTATE_RATELIMITING) { + Curl_ratelimit(data, *nowp); + multistate(data, MSTATE_RATELIMITING); + } + Curl_expire(data, CURLMAX(send_wait_ms, recv_wait_ms), EXPIRE_TOOFAST); + Curl_multi_clear_dirty(data); + return CURLE_AGAIN; + } + else if(data->mstate != MSTATE_PERFORMING) { + multistate(data, MSTATE_PERFORMING); + Curl_ratelimit(data, *nowp); + } + return CURLE_OK; +} + static CURLMcode state_performing(struct Curl_easy *data, struct curltime *nowp, bool *stream_errorp, @@ -1887,33 +1926,12 @@ static CURLMcode state_performing(struct Curl_easy *data, { char *newurl = NULL; bool retry = FALSE; - timediff_t recv_timeout_ms = 0; - timediff_t send_timeout_ms = 0; CURLMcode rc = CURLM_OK; CURLcode result = *resultp = CURLE_OK; *stream_errorp = FALSE; - /* check if over send speed */ - if(data->set.max_send_speed) - send_timeout_ms = Curl_pgrsLimitWaitTime(&data->progress.ul, - data->set.max_send_speed, - *nowp); - - /* check if over recv speed */ - if(data->set.max_recv_speed) - recv_timeout_ms = Curl_pgrsLimitWaitTime(&data->progress.dl, - data->set.max_recv_speed, - *nowp); - - if(send_timeout_ms || recv_timeout_ms) { - Curl_ratelimit(data, *nowp); - multistate(data, MSTATE_RATELIMITING); - if(send_timeout_ms >= recv_timeout_ms) - Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST); - else - Curl_expire(data, recv_timeout_ms, EXPIRE_TOOFAST); + if(mspeed_check(data, nowp) == CURLE_AGAIN) return CURLM_OK; - } /* read/write data if it is ready to do so */ result = Curl_sendrecv(data, nowp); @@ -2028,6 +2046,9 @@ static CURLMcode state_performing(struct Curl_easy *data, } } } + else { /* not errored, not done */ + mspeed_check(data, nowp); + } free(newurl); *resultp = result; return rc; @@ -2195,30 +2216,8 @@ static CURLMcode state_ratelimiting(struct Curl_easy *data, multi_done(data, result, TRUE); } else { - timediff_t recv_timeout_ms = 0; - timediff_t send_timeout_ms = 0; - if(data->set.max_send_speed) - send_timeout_ms = - Curl_pgrsLimitWaitTime(&data->progress.ul, - data->set.max_send_speed, - *nowp); - - if(data->set.max_recv_speed) - recv_timeout_ms = - Curl_pgrsLimitWaitTime(&data->progress.dl, - data->set.max_recv_speed, - *nowp); - - if(!send_timeout_ms && !recv_timeout_ms) { - multistate(data, MSTATE_PERFORMING); - Curl_ratelimit(data, *nowp); - /* start performing again right away */ + if(!mspeed_check(data, nowp)) rc = CURLM_CALL_MULTI_PERFORM; - } - else if(send_timeout_ms >= recv_timeout_ms) - Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST); - else - Curl_expire(data, recv_timeout_ms, EXPIRE_TOOFAST); } *resultp = result; return rc; @@ -3584,8 +3583,8 @@ void Curl_expire_ex(struct Curl_easy *data, multi->timetree = Curl_splayinsert(*curr_expire, multi->timetree, &data->state.timenode); if(data->id >= 0) - CURL_TRC_M(data, "set expire[%d] in %" FMT_TIMEDIFF_T "ns", - id, curlx_timediff_us(set, *nowp)); + CURL_TRC_M(data, "[TIMEOUT] set %s to expire in %" FMT_TIMEDIFF_T "ns", + CURL_TIMER_NAME(id), curlx_timediff_us(set, *nowp)); } /* @@ -3615,6 +3614,8 @@ void Curl_expire_done(struct Curl_easy *data, expire_id id) { /* remove the timer, if there */ multi_deltimeout(data, id); + if(data->id >= 0) + CURL_TRC_M(data, "[TIMEOUT] cleared %s", CURL_TIMER_NAME(id)); } /* @@ -3646,7 +3647,8 @@ bool Curl_expire_clear(struct Curl_easy *data) /* clear the timeout list too */ Curl_llist_destroy(list, NULL); - CURL_TRC_M(data, "Expire cleared"); + if(data->id >= 0) + CURL_TRC_M(data, "[TIMEOUT] all cleared"); nowp->tv_sec = 0; nowp->tv_usec = 0; return TRUE; @@ -3974,6 +3976,12 @@ void Curl_multi_mark_dirty(struct Curl_easy *data) Curl_uint_bset_add(&data->multi->dirty, data->mid); } +void Curl_multi_clear_dirty(struct Curl_easy *data) +{ + if(data->multi && data->mid != UINT_MAX) + Curl_uint_bset_remove(&data->multi->dirty, data->mid); +} + #ifdef DEBUGBUILD static void multi_xfer_dump(struct Curl_multi *multi, unsigned int mid, void *entry) diff --git a/lib/multiif.h b/lib/multiif.h index 5cf22bc04..1423d5a03 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -162,5 +162,7 @@ unsigned int Curl_multi_xfers_running(struct Curl_multi *multi); /* Mark a transfer as dirty, e.g. to be rerun at earliest convenience. * A cheap operation, can be done many times repeatedly. */ void Curl_multi_mark_dirty(struct Curl_easy *data); +/* Clear transfer from the dirty set. */ +void Curl_multi_clear_dirty(struct Curl_easy *data); #endif /* HEADER_CURL_MULTIIF_H */ diff --git a/lib/pop3.c b/lib/pop3.c index 508f8faed..f5ecfd178 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -811,7 +811,7 @@ static CURLcode pop3_state_servergreet_resp(struct Curl_easy *data, const char *line; size_t len; - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3c) return CURLE_FAILED_INIT; @@ -866,7 +866,7 @@ static CURLcode pop3_state_capa_resp(struct Curl_easy *data, int pop3code, const char *line; size_t len; - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3c) return CURLE_FAILED_INIT; @@ -954,7 +954,7 @@ static CURLcode pop3_state_starttls_resp(struct Curl_easy *data, { struct pop3_conn *pop3c = Curl_conn_meta_get(conn, CURL_META_POP3_CONN); CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3c) return CURLE_FAILED_INIT; @@ -987,7 +987,7 @@ static CURLcode pop3_state_auth_resp(struct Curl_easy *data, struct pop3_conn *pop3c = Curl_conn_meta_get(conn, CURL_META_POP3_CONN); saslprogress progress; - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3c) return CURLE_FAILED_INIT; @@ -1025,7 +1025,7 @@ static CURLcode pop3_state_apop_resp(struct Curl_easy *data, int pop3code, pop3state instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(pop3code != '+') { failf(data, "Authentication failed: %d", pop3code); @@ -1046,7 +1046,7 @@ static CURLcode pop3_state_user_resp(struct Curl_easy *data, int pop3code, CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct pop3_conn *pop3c = Curl_conn_meta_get(conn, CURL_META_POP3_CONN); - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3c) return CURLE_FAILED_INIT; @@ -1070,7 +1070,7 @@ static CURLcode pop3_state_pass_resp(struct Curl_easy *data, int pop3code, pop3state instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(pop3code != '+') { failf(data, "Access denied. %c", pop3code); @@ -1094,7 +1094,7 @@ static CURLcode pop3_state_command_resp(struct Curl_easy *data, struct pop3_conn *pop3c = Curl_conn_meta_get(conn, CURL_META_POP3_CONN); struct pingpong *pp; - (void)instate; /* no use for this yet */ + (void)instate; if(!pop3 || !pop3c) return CURLE_FAILED_INIT; diff --git a/lib/progress.c b/lib/progress.c index 1a3f4334c..fdae3194c 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -281,41 +281,40 @@ void Curl_pgrsStartNow(struct Curl_easy *data) * to wait to get back under the speed limit. */ timediff_t Curl_pgrsLimitWaitTime(struct pgrs_dir *d, - curl_off_t speed_limit, + curl_off_t bytes_per_sec, struct curltime now) { - curl_off_t size = d->cur_size - d->limit.start_size; - timediff_t minimum; - timediff_t actual; + curl_off_t bytes = d->cur_size - d->limit.start_size; + timediff_t should_ms; + timediff_t took_ms; - if(!speed_limit || !size) + /* no limit or we did not get to any bytes yet */ + if(!bytes_per_sec || !bytes) return 0; - /* - * 'minimum' is the number of milliseconds 'size' should take to download to - * stay below 'limit'. - */ - if(size < CURL_OFF_T_MAX/1000) - minimum = (timediff_t) (1000 * size / speed_limit); + /* The time it took us to have `bytes` */ + took_ms = curlx_timediff_ceil(now, d->limit.start); + + /* The time it *should* have taken us to have `bytes` + * when obeying the bytes_per_sec speed_limit. */ + if(bytes < CURL_OFF_T_MAX/1000) { + /* (1000 * bytes / (bytes / sec)) = 1000 * sec = ms */ + should_ms = (timediff_t) (1000 * bytes / bytes_per_sec); + } else { - minimum = (timediff_t) (size / speed_limit); - if(minimum < TIMEDIFF_T_MAX/1000) - minimum *= 1000; + /* very large `bytes`, first calc the seconds it should have taken. + * if that is small enough, convert to milliseconds. */ + should_ms = (timediff_t) (bytes / bytes_per_sec); + if(should_ms < TIMEDIFF_T_MAX/1000) + should_ms *= 1000; else - minimum = TIMEDIFF_T_MAX; + should_ms = TIMEDIFF_T_MAX; } - /* - * 'actual' is the time in milliseconds it took to actually download the - * last 'size' bytes. - */ - actual = curlx_timediff_ceil(now, d->limit.start); - if(actual < minimum) { - /* if it downloaded the data faster than the limit, make it wait the - difference */ - return minimum - actual; + if(took_ms < should_ms) { + /* when gotten to `bytes` too fast, wait the difference */ + return should_ms - took_ms; } - return 0; } diff --git a/lib/rtsp.c b/lib/rtsp.c index dbe3e63cf..1d5f44f91 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -278,6 +278,84 @@ static CURLcode rtsp_done(struct Curl_easy *data, return httpStatus; } + +static CURLcode rtsp_setup_body(struct Curl_easy *data, + Curl_RtspReq rtspreq, + struct dynbuf *reqp) +{ + CURLcode result; + if(rtspreq == RTSPREQ_ANNOUNCE || + rtspreq == RTSPREQ_SET_PARAMETER || + rtspreq == RTSPREQ_GET_PARAMETER) { + curl_off_t req_clen; /* request content length */ + + if(data->state.upload) { + req_clen = data->state.infilesize; + data->state.httpreq = HTTPREQ_PUT; + result = Curl_creader_set_fread(data, req_clen); + if(result) + return result; + } + else { + if(data->set.postfields) { + size_t plen = strlen(data->set.postfields); + req_clen = (curl_off_t)plen; + result = Curl_creader_set_buf(data, data->set.postfields, plen); + } + else if(data->state.infilesize >= 0) { + req_clen = data->state.infilesize; + result = Curl_creader_set_fread(data, req_clen); + } + else { + req_clen = 0; + result = Curl_creader_set_null(data); + } + if(result) + return result; + } + + if(req_clen > 0) { + /* As stated in the http comments, it is probably not wise to + * actually set a custom Content-Length in the headers */ + if(!Curl_checkheaders(data, STRCONST("Content-Length"))) { + result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T"\r\n", + req_clen); + if(result) + return result; + } + + if(rtspreq == RTSPREQ_SET_PARAMETER || + rtspreq == RTSPREQ_GET_PARAMETER) { + if(!Curl_checkheaders(data, STRCONST("Content-Type"))) { + result = curlx_dyn_addn(reqp, + STRCONST("Content-Type: " + "text/parameters\r\n")); + if(result) + return result; + } + } + + if(rtspreq == RTSPREQ_ANNOUNCE) { + if(!Curl_checkheaders(data, STRCONST("Content-Type"))) { + result = curlx_dyn_addn(reqp, + STRCONST("Content-Type: " + "application/sdp\r\n")); + if(result) + return result; + } + } + } + else if(rtspreq == RTSPREQ_GET_PARAMETER) { + /* Check for an empty GET_PARAMETER (heartbeat) request */ + data->state.httpreq = HTTPREQ_HEAD; + data->req.no_body = TRUE; + } + } + else + result = Curl_creader_set_null(data); + return result; +} + static CURLcode rtsp_do(struct Curl_easy *data, bool *done) { struct connectdata *conn = data->conn; @@ -561,79 +639,9 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done) if(result) goto out; - if(rtspreq == RTSPREQ_ANNOUNCE || - rtspreq == RTSPREQ_SET_PARAMETER || - rtspreq == RTSPREQ_GET_PARAMETER) { - curl_off_t req_clen; /* request content length */ - - if(data->state.upload) { - req_clen = data->state.infilesize; - data->state.httpreq = HTTPREQ_PUT; - result = Curl_creader_set_fread(data, req_clen); - if(result) - goto out; - } - else { - if(data->set.postfields) { - size_t plen = strlen(data->set.postfields); - req_clen = (curl_off_t)plen; - result = Curl_creader_set_buf(data, data->set.postfields, plen); - } - else if(data->state.infilesize >= 0) { - req_clen = data->state.infilesize; - result = Curl_creader_set_fread(data, req_clen); - } - else { - req_clen = 0; - result = Curl_creader_set_null(data); - } - if(result) - goto out; - } - - if(req_clen > 0) { - /* As stated in the http comments, it is probably not wise to - * actually set a custom Content-Length in the headers */ - if(!Curl_checkheaders(data, STRCONST("Content-Length"))) { - result = - curlx_dyn_addf(&req_buffer, "Content-Length: %" FMT_OFF_T"\r\n", - req_clen); - if(result) - goto out; - } - - if(rtspreq == RTSPREQ_SET_PARAMETER || - rtspreq == RTSPREQ_GET_PARAMETER) { - if(!Curl_checkheaders(data, STRCONST("Content-Type"))) { - result = curlx_dyn_addn(&req_buffer, - STRCONST("Content-Type: " - "text/parameters\r\n")); - if(result) - goto out; - } - } - - if(rtspreq == RTSPREQ_ANNOUNCE) { - if(!Curl_checkheaders(data, STRCONST("Content-Type"))) { - result = curlx_dyn_addn(&req_buffer, - STRCONST("Content-Type: " - "application/sdp\r\n")); - if(result) - goto out; - } - } - } - else if(rtspreq == RTSPREQ_GET_PARAMETER) { - /* Check for an empty GET_PARAMETER (heartbeat) request */ - data->state.httpreq = HTTPREQ_HEAD; - data->req.no_body = TRUE; - } - } - else { - result = Curl_creader_set_null(data); - if(result) - goto out; - } + result = rtsp_setup_body(data, rtspreq, &req_buffer); + if(result) + goto out; /* Finish the request buffer */ result = curlx_dyn_addn(&req_buffer, STRCONST("\r\n")); diff --git a/lib/smtp.c b/lib/smtp.c index c52cf0dc5..5dba1f9ea 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -924,7 +924,7 @@ static CURLcode smtp_state_servergreet_resp(struct Curl_easy *data, smtpstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode/100 != 2) { failf(data, "Got unexpected smtp-server response: %d", smtpcode); @@ -943,7 +943,7 @@ static CURLcode smtp_state_starttls_resp(struct Curl_easy *data, smtpstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; /* Pipelining in response is forbidden. */ if(smtpc->pp.overflow) @@ -973,7 +973,7 @@ static CURLcode smtp_state_ehlo_resp(struct Curl_easy *data, const char *line = curlx_dyn_ptr(&smtpc->pp.recvbuf); size_t len = smtpc->pp.nfinal; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode/100 != 2 && smtpcode != 1) { if(data->set.use_ssl <= CURLUSESSL_TRY @@ -1074,7 +1074,7 @@ static CURLcode smtp_state_helo_resp(struct Curl_easy *data, smtpstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode/100 != 2) { failf(data, "Remote access denied: %d", smtpcode); @@ -1096,7 +1096,7 @@ static CURLcode smtp_state_auth_resp(struct Curl_easy *data, CURLcode result = CURLE_OK; saslprogress progress; - (void)instate; /* no use for this yet */ + (void)instate; result = Curl_sasl_continue(&smtpc->sasl, data, smtpcode, &progress); if(!result) @@ -1126,7 +1126,7 @@ static CURLcode smtp_state_command_resp(struct Curl_easy *data, char *line = curlx_dyn_ptr(&smtpc->pp.recvbuf); size_t len = smtpc->pp.nfinal; - (void)instate; /* no use for this yet */ + (void)instate; if((smtp->rcpt && smtpcode/100 != 2 && smtpcode != 553 && smtpcode != 1) || (!smtp->rcpt && smtpcode/100 != 2 && smtpcode != 1)) { @@ -1166,7 +1166,7 @@ static CURLcode smtp_state_mail_resp(struct Curl_easy *data, smtpstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode/100 != 2) { failf(data, "MAIL failed: %d", smtpcode); @@ -1190,7 +1190,7 @@ static CURLcode smtp_state_rcpt_resp(struct Curl_easy *data, bool is_smtp_err = FALSE; bool is_smtp_blocking_err = FALSE; - (void)instate; /* no use for this yet */ + (void)instate; is_smtp_err = (smtpcode/100 != 2); @@ -1246,7 +1246,7 @@ static CURLcode smtp_state_data_resp(struct Curl_easy *data, smtpstate instate) { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode != 354) { failf(data, "DATA failed: %d", smtpcode); @@ -1275,7 +1275,7 @@ static CURLcode smtp_state_postdata_resp(struct Curl_easy *data, { CURLcode result = CURLE_OK; - (void)instate; /* no use for this yet */ + (void)instate; if(smtpcode != 250) result = CURLE_WEIRD_SERVER_REPLY; diff --git a/lib/telnet.c b/lib/telnet.c index 731789e46..cc827c1b3 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -1287,8 +1287,8 @@ static CURLcode send_telnet_data(struct Curl_easy *data, static CURLcode telnet_done(struct Curl_easy *data, CURLcode status, bool premature) { - (void)status; /* unused */ - (void)premature; /* not used */ + (void)status; + (void)premature; Curl_meta_remove(data, CURL_META_TELNET_EASY); return CURLE_OK; } diff --git a/lib/tftp.c b/lib/tftp.c index 6a9f964a0..4c2fadc2c 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -1061,8 +1061,8 @@ static CURLcode tftp_done(struct Curl_easy *data, CURLcode status, struct connectdata *conn = data->conn; struct tftp_conn *state = Curl_conn_meta_get(conn, CURL_META_TFTP_CONN); - (void)status; /* unused */ - (void)premature; /* not used */ + (void)status; + (void)premature; if(Curl_pgrsDone(data)) return CURLE_ABORTED_BY_CALLBACK; diff --git a/lib/transfer.c b/lib/transfer.c index 50f621056..1297a3e82 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -280,9 +280,10 @@ static CURLcode sendrecv_dl(struct Curl_easy *data, if(bytestoread && data->set.max_recv_speed > 0) { /* In case of speed limit on receiving: if this loop already got - * data, break out. If not, limit the amount of bytes to receive. - * The overall, timed, speed limiting is done in multi.c */ - if(total_received) + * a quarter of the quota, break out. We want to stutter a bit + * to keep in the limit, but too small receives will just cost + * cpu unnecessarily. */ + if(total_received >= (data->set.max_recv_speed / 4)) break; if(data->set.max_recv_speed < (curl_off_t)bytestoread) bytestoread = (size_t)data->set.max_recv_speed; @@ -958,3 +959,15 @@ CURLcode Curl_xfer_pause_recv(struct Curl_easy *data, bool enable) Curl_conn_ev_data_pause(data, enable); return result; } + +bool Curl_xfer_is_too_fast(struct Curl_easy *data) +{ + struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); + while(e) { + struct time_node *n = Curl_node_elem(e); + e = Curl_node_next(e); + if(n->eid == EXPIRE_TOOFAST) + return TRUE; + } + return FALSE; +} diff --git a/lib/transfer.h b/lib/transfer.h index 91a81e52e..6145efb4a 100644 --- a/lib/transfer.h +++ b/lib/transfer.h @@ -143,5 +143,7 @@ bool Curl_xfer_recv_is_paused(struct Curl_easy *data); CURLcode Curl_xfer_pause_send(struct Curl_easy *data, bool enable); CURLcode Curl_xfer_pause_recv(struct Curl_easy *data, bool enable); +/* Query if transfer has expire timeout TOOFAST set. */ +bool Curl_xfer_is_too_fast(struct Curl_easy *data); #endif /* HEADER_CURL_TRANSFER_H */ diff --git a/lib/version.c b/lib/version.c index aeb133ec7..a2d486720 100644 --- a/lib/version.c +++ b/lib/version.c @@ -624,7 +624,7 @@ curl_version_info_data *curl_version_info(CURLversion stamp) static char zstd_buffer[80]; #endif - (void)stamp; /* avoid compiler warnings, we do not use this */ + (void)stamp; #ifdef USE_SSL Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer)); diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 2898a70f0..695532ff8 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -2840,7 +2840,7 @@ static CURLcode scp_done(struct Curl_easy *data, CURLcode status, bool premature) { struct ssh_conn *sshc = Curl_conn_meta_get(data->conn, CURL_META_SSH_CONN); - (void)premature; /* not used */ + (void)premature; if(!sshc) return CURLE_FAILED_INIT; diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 13f374564..5dfc377ec 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -276,19 +276,19 @@ static CURLcode libssh2_session_error_to_CURLE(int err) static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc) { - (void)abstract; /* arg not used */ + (void)abstract; return Curl_cmalloc(count); } static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc) { - (void)abstract; /* arg not used */ + (void)abstract; return Curl_crealloc(ptr, count); } static LIBSSH2_FREE_FUNC(my_libssh2_free) { - (void)abstract; /* arg not used */ + (void)abstract; if(ptr) /* ssh2 agent sometimes call free with null ptr */ Curl_cfree(ptr); } @@ -3732,7 +3732,7 @@ static CURLcode scp_done(struct Curl_easy *data, CURLcode status, bool premature) { struct ssh_conn *sshc = Curl_conn_meta_get(data->conn, CURL_META_SSH_CONN); - (void)premature; /* not used */ + (void)premature; if(sshc && !status) myssh_state(data, sshc, SSH_SCP_DONE); diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 20eae443d..f38c90e66 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -2232,7 +2232,7 @@ static bool gtls_cert_status_request(void) } static void *gtls_get_internals(struct ssl_connect_data *connssl, - CURLINFO info UNUSED_PARAM) + CURLINFO info) { struct gtls_ssl_backend_data *backend = (struct gtls_ssl_backend_data *)connssl->backend; diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index ebf734aef..7b1a31e42 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -1458,7 +1458,7 @@ static bool mbedtls_data_pending(struct Curl_cfilter *cf, static CURLcode mbedtls_sha256sum(const unsigned char *input, size_t inputlen, unsigned char *sha256sum, - size_t sha256len UNUSED_PARAM) + size_t sha256len) { (void)sha256len; /* returns 0 on success, otherwise failure */ @@ -1468,7 +1468,7 @@ static CURLcode mbedtls_sha256sum(const unsigned char *input, } static void *mbedtls_get_internals(struct ssl_connect_data *connssl, - CURLINFO info UNUSED_PARAM) + CURLINFO info) { struct mbed_ssl_backend_data *backend = (struct mbed_ssl_backend_data *)connssl->backend; diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 5971d9a35..a49203ab0 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -5517,9 +5517,9 @@ static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex, return CURLE_OK; #else /* No X509_get_signature_nid support */ - (void)data; /* unused */ - (void)sockindex; /* unused */ - (void)binding; /* unused */ + (void)data; + (void)sockindex; + (void)binding; return CURLE_OK; #endif } diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c index 7d0fddaa3..221a7a621 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -393,9 +393,11 @@ out: /* A server certificate verify callback for Rustls that always returns RUSTLS_RESULT_OK, or in other words disable certificate verification. */ static uint32_t -cr_verify_none(void *userdata UNUSED_PARAM, - const rustls_verify_server_cert_params *params UNUSED_PARAM) +cr_verify_none(void *userdata, + const rustls_verify_server_cert_params *params) { + (void)userdata; + (void)params; return RUSTLS_RESULT_OK; } @@ -1295,10 +1297,11 @@ cr_connect(struct Curl_cfilter *cf, static void * cr_get_internals(struct ssl_connect_data *connssl, - CURLINFO info UNUSED_PARAM) + CURLINFO info) { struct rustls_ssl_backend_data *backend = (struct rustls_ssl_backend_data *)connssl->backend; + (void)info; DEBUGASSERT(backend); return backend->conn; } diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index ea06d31ab..1afc6790c 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1459,7 +1459,7 @@ static bool cert_counter_callback(const CERT_CONTEXT *ccert_context, bool reverse_order, void *certs_count) { - (void)reverse_order; /* unused */ + (void)reverse_order; if(valid_cert_encoding(ccert_context)) (*(int *)certs_count)++; return TRUE; @@ -2583,7 +2583,7 @@ static size_t schannel_version(char *buffer, size_t size) return msnprintf(buffer, size, "Schannel"); } -static CURLcode schannel_random(struct Curl_easy *data UNUSED_PARAM, +static CURLcode schannel_random(struct Curl_easy *data, unsigned char *entropy, size_t length) { (void)data; @@ -2725,7 +2725,7 @@ static CURLcode schannel_sha256sum(const unsigned char *input, } static void *schannel_get_internals(struct ssl_connect_data *connssl, - CURLINFO info UNUSED_PARAM) + CURLINFO info) { struct schannel_ssl_backend_data *backend = (struct schannel_ssl_backend_data *)connssl->backend; @@ -108,6 +108,15 @@ struct ws_encoder { BIT(contfragment); /* set TRUE if the previous fragment sent was not final */ }; +/* Control frames are allowed up to 125 characters, rfc6455, ch. 5.5 */ +#define WS_MAX_CNTRL_LEN 125 + +struct ws_cntrl_frame { + unsigned int type; + size_t payload_len; + unsigned char payload[WS_MAX_CNTRL_LEN]; +}; + /* A websocket connection with en- and decoder that treat frames * and keep track of boundaries. */ struct websocket { @@ -117,6 +126,7 @@ struct websocket { struct bufq recvbuf; /* raw data from the server */ struct bufq sendbuf; /* raw data to be sent to the server */ struct curl_ws_frame recvframe; /* the current WS FRAME received */ + struct ws_cntrl_frame pending; /* a control frame pending to be sent */ size_t sendbuf_payload; /* number of payload bytes in sendbuf */ }; @@ -229,7 +239,7 @@ static CURLcode ws_frame_flags2firstbyte(struct Curl_easy *data, switch(flags & ~CURLWS_OFFSET) { case 0: if(contfragment) { - infof(data, "[WS] no flags given; interpreting as continuation " + CURL_TRC_WS(data, "no flags given; interpreting as continuation " "fragment for compatibility"); *pfirstbyte = (WSBIT_OPCODE_CONT | WSBIT_FIN); return CURLE_OK; @@ -316,12 +326,12 @@ static CURLcode ws_send_raw_blocking(struct Curl_easy *data, struct websocket *ws, const char *buffer, size_t buflen); -typedef ssize_t ws_write_payload(const unsigned char *buf, size_t buflen, - int frame_age, int frame_flags, - curl_off_t payload_offset, - curl_off_t payload_len, - void *userp, - CURLcode *err); +typedef CURLcode ws_write_payload(const unsigned char *buf, size_t buflen, + int frame_age, int frame_flags, + curl_off_t payload_offset, + curl_off_t payload_len, + void *userp, + size_t *pnwritten); static void ws_dec_next_frame(struct ws_decoder *dec) { @@ -390,21 +400,20 @@ static CURLcode ws_dec_read_head(struct ws_decoder *dec, ws_dec_reset(dec); return CURLE_RECV_ERROR; } - if(dec->frame_flags & CURLWS_PING && dec->head[1] > 125) { + if(dec->frame_flags & CURLWS_PING && dec->head[1] > WS_MAX_CNTRL_LEN) { /* The maximum valid size of PING frames is 125 bytes. Accepting overlong pings would mean sending equivalent pongs! */ failf(data, "[WS] received PING frame is too big"); ws_dec_reset(dec); return CURLE_RECV_ERROR; } - if(dec->frame_flags & CURLWS_PONG && dec->head[1] > 125) { + if(dec->frame_flags & CURLWS_PONG && dec->head[1] > WS_MAX_CNTRL_LEN) { /* The maximum valid size of PONG frames is 125 bytes. */ failf(data, "[WS] received PONG frame is too big"); ws_dec_reset(dec); return CURLE_RECV_ERROR; } - if(dec->frame_flags & CURLWS_CLOSE && dec->head[1] > 125) { - /* The maximum valid size of CLOSE frames is 125 bytes. */ + if(dec->frame_flags & CURLWS_CLOSE && dec->head[1] > WS_MAX_CNTRL_LEN) { failf(data, "[WS] received CLOSE frame is too big"); ws_dec_reset(dec); return CURLE_RECV_ERROR; @@ -479,7 +488,7 @@ static CURLcode ws_dec_pass_payload(struct ws_decoder *dec, { const unsigned char *inbuf; size_t inlen; - ssize_t nwritten; + size_t nwritten; CURLcode result; curl_off_t remain = dec->payload_len - dec->payload_offset; @@ -487,15 +496,15 @@ static CURLcode ws_dec_pass_payload(struct ws_decoder *dec, while(remain && Curl_bufq_peek(inraw, &inbuf, &inlen)) { if((curl_off_t)inlen > remain) inlen = (size_t)remain; - nwritten = write_cb(inbuf, inlen, dec->frame_age, dec->frame_flags, - dec->payload_offset, dec->payload_len, - write_ctx, &result); - if(nwritten < 0) + result = write_cb(inbuf, inlen, dec->frame_age, dec->frame_flags, + dec->payload_offset, dec->payload_len, + write_ctx, &nwritten); + if(result) return result; - Curl_bufq_skip(inraw, (size_t)nwritten); - dec->payload_offset += (curl_off_t)nwritten; + Curl_bufq_skip(inraw, nwritten); + dec->payload_offset += nwritten; remain = dec->payload_len - dec->payload_offset; - CURL_TRC_WS(data, "passed %zd bytes payload, %" + CURL_TRC_WS(data, "passed %zu bytes payload, %" FMT_OFF_T " remain", nwritten, remain); } @@ -532,12 +541,12 @@ static CURLcode ws_dec_pass(struct ws_decoder *dec, /* head parsing done */ dec->state = WS_DEC_PAYLOAD; if(dec->payload_len == 0) { - ssize_t nwritten; + size_t nwritten; const unsigned char tmp = '\0'; /* special case of a 0 length frame, need to write once */ - nwritten = write_cb(&tmp, 0, dec->frame_age, dec->frame_flags, - 0, 0, write_ctx, &result); - if(nwritten < 0) + result = write_cb(&tmp, 0, dec->frame_age, dec->frame_flags, + 0, 0, write_ctx, &nwritten); + if(result) return result; dec->state = WS_DEC_INIT; break; @@ -602,43 +611,82 @@ struct ws_cw_dec_ctx { int cw_type; }; -static ssize_t ws_cw_dec_next(const unsigned char *buf, size_t buflen, - int frame_age, int frame_flags, - curl_off_t payload_offset, - curl_off_t payload_len, - void *user_data, - CURLcode *err) +static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws, + bool blocking); +static CURLcode ws_enc_send(struct Curl_easy *data, + struct websocket *ws, + const unsigned char *buffer, + size_t buflen, + curl_off_t fragsize, + unsigned int flags, + size_t *sent); +static CURLcode ws_enc_add_pending(struct Curl_easy *data, + struct websocket *ws); + +static CURLcode ws_enc_add_cntrl(struct Curl_easy *data, + struct websocket *ws, + const unsigned char *payload, + size_t plen, + unsigned int frame_type) +{ + DEBUGASSERT(plen <= WS_MAX_CNTRL_LEN); + if(plen > WS_MAX_CNTRL_LEN) + return CURLE_BAD_FUNCTION_ARGUMENT; + + /* Overwrite any pending frame with the new one, we keep + * only one. */ + ws->pending.type = frame_type; + ws->pending.payload_len = plen; + memcpy(ws->pending.payload, payload, plen); + + if(!ws->enc.payload_remain) { /* not in the middle of another frame */ + CURLcode result = ws_enc_add_pending(data, ws); + if(!result) + (void)ws_flush(data, ws, Curl_is_in_callback(data)); + return result; + } + return CURLE_OK; +} + +static CURLcode ws_cw_dec_next(const unsigned char *buf, size_t buflen, + int frame_age, int frame_flags, + curl_off_t payload_offset, + curl_off_t payload_len, + void *user_data, + size_t *pnwritten) { struct ws_cw_dec_ctx *ctx = user_data; struct Curl_easy *data = ctx->data; struct websocket *ws = ctx->ws; bool auto_pong = !data->set.ws_no_auto_pong; curl_off_t remain = (payload_len - (payload_offset + buflen)); + CURLcode result; (void)frame_age; + *pnwritten = 0; if(auto_pong && (frame_flags & CURLWS_PING) && !remain) { /* auto-respond to PINGs, only works for single-frame payloads atm */ - size_t bytes; - infof(data, "[WS] auto-respond to PING with a PONG"); + CURL_TRC_WS(data, "auto PONG to [PING payload=%" FMT_OFF_T + "/%" FMT_OFF_T "]", payload_offset, payload_len); /* send back the exact same content as a PONG */ - *err = curl_ws_send(data, buf, buflen, &bytes, 0, CURLWS_PONG); - if(*err) - return -1; + result = ws_enc_add_cntrl(data, ws, buf, buflen, CURLWS_PONG); + if(result) + return result; } else if(buflen || !remain) { /* forward the decoded frame to the next client writer. */ update_meta(ws, frame_age, frame_flags, payload_offset, payload_len, buflen); - *err = Curl_cwriter_write(data, ctx->next_writer, + result = Curl_cwriter_write(data, ctx->next_writer, (ctx->cw_type | CLIENTWRITE_0LEN), (const char *)buf, buflen); - if(*err) - return -1; + if(result) + return result; } - *err = CURLE_OK; - return (ssize_t)buflen; + *pnwritten = buflen; + return CURLE_OK; } static CURLcode ws_cw_write(struct Curl_easy *data, @@ -664,7 +712,7 @@ static CURLcode ws_cw_write(struct Curl_easy *data, result = Curl_bufq_write(&ctx->buf, (const unsigned char *)buf, nbytes, &nwritten); if(result) { - infof(data, "WS: error adding data to buffer %d", result); + infof(data, "[WS] error adding data to buffer %d", result); return result; } } @@ -753,7 +801,7 @@ static void ws_enc_init(struct ws_encoder *enc) +---------------------------------------------------------------+ */ -static CURLcode ws_enc_write_head(struct Curl_easy *data, +static CURLcode ws_enc_add_frame(struct Curl_easy *data, struct ws_encoder *enc, unsigned int flags, curl_off_t payload_len, @@ -787,18 +835,15 @@ static CURLcode ws_enc_write_head(struct Curl_easy *data, enc->contfragment = (flags & CURLWS_CONT) ? (bit)TRUE : (bit)FALSE; } - if(flags & CURLWS_PING && payload_len > 125) { - /* The maximum valid size of PING frames is 125 bytes. */ + if(flags & CURLWS_PING && payload_len > WS_MAX_CNTRL_LEN) { failf(data, "[WS] given PING frame is too big"); return CURLE_TOO_LARGE; } - if(flags & CURLWS_PONG && payload_len > 125) { - /* The maximum valid size of PONG frames is 125 bytes. */ + if(flags & CURLWS_PONG && payload_len > WS_MAX_CNTRL_LEN) { failf(data, "[WS] given PONG frame is too big"); return CURLE_TOO_LARGE; } - if(flags & CURLWS_CLOSE && payload_len > 125) { - /* The maximum valid size of CLOSE frames is 125 bytes. */ + if(flags & CURLWS_CLOSE && payload_len > WS_MAX_CNTRL_LEN) { failf(data, "[WS] given CLOSE frame is too big"); return CURLE_TOO_LARGE; } @@ -847,6 +892,23 @@ static CURLcode ws_enc_write_head(struct Curl_easy *data, return CURLE_OK; } +static CURLcode ws_enc_write_head(struct Curl_easy *data, + struct websocket *ws, + struct ws_encoder *enc, + unsigned int flags, + curl_off_t payload_len, + struct bufq *out) +{ + /* starting a new frame, we want a clean sendbuf. + * Any pending control frame we can add now as part of the flush. */ + if(ws->pending.type) { + CURLcode result = ws_enc_add_pending(data, ws); + if(result) + return result; + } + return ws_enc_add_frame(data, enc, flags, payload_len, out); +} + static CURLcode ws_enc_write_payload(struct ws_encoder *enc, struct Curl_easy *data, const unsigned char *buf, size_t buflen, @@ -881,7 +943,139 @@ static CURLcode ws_enc_write_payload(struct ws_encoder *enc, return CURLE_OK; } +static CURLcode ws_enc_add_pending(struct Curl_easy *data, + struct websocket *ws) +{ + CURLcode result; + size_t n; + + if(!ws->pending.type) /* no pending frame here */ + return CURLE_OK; + if(ws->enc.payload_remain) /* in the middle of another frame */ + return CURLE_AGAIN; + + result = ws_enc_add_frame(data, &ws->enc, ws->pending.type, + (curl_off_t)ws->pending.payload_len, + &ws->sendbuf); + if(result) { + CURL_TRC_WS(data, "ws_enc_cntrl(), error addiong head: %d", + result); + goto out; + } + result = ws_enc_write_payload(&ws->enc, data, ws->pending.payload, + ws->pending.payload_len, + &ws->sendbuf, &n); + if(result) { + CURL_TRC_WS(data, "ws_enc_cntrl(), error adding payload: %d", + result); + goto out; + } + /* our buffer should always be able to take in a control frame */ + DEBUGASSERT(n == ws->pending.payload_len); + DEBUGASSERT(!ws->enc.payload_remain); + +out: + memset(&ws->pending, 0, sizeof(ws->pending)); + return result; +} + +static CURLcode ws_enc_send(struct Curl_easy *data, + struct websocket *ws, + const unsigned char *buffer, + size_t buflen, + curl_off_t fragsize, + unsigned int flags, + size_t *pnsent) +{ + size_t n; + CURLcode result = CURLE_OK; + + DEBUGASSERT(!data->set.ws_raw_mode); + *pnsent = 0; + + if(ws->enc.payload_remain || !Curl_bufq_is_empty(&ws->sendbuf)) { + /* a frame is ongoing with payload buffered or more payload + * that needs to be encoded into the buffer */ + if(buflen < ws->sendbuf_payload) { + /* We have been called with LESS buffer data than before. This + * is not how it's supposed too work. */ + failf(data, "[WS] curl_ws_send() called with smaller 'buflen' than " + "bytes already buffered in previous call, %zu vs %zu", + buflen, ws->sendbuf_payload); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + if((curl_off_t)buflen > + (ws->enc.payload_remain + (curl_off_t)ws->sendbuf_payload)) { + /* too large buflen beyond payload length of frame */ + failf(data, "[WS] unaligned frame size (sending %zu instead of %" + FMT_OFF_T ")", + buflen, ws->enc.payload_remain + ws->sendbuf_payload); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + } + else { + result = ws_flush(data, ws, Curl_is_in_callback(data)); + if(result) + return result; + + result = ws_enc_write_head(data, ws, &ws->enc, flags, + (flags & CURLWS_OFFSET) ? + fragsize : (curl_off_t)buflen, + &ws->sendbuf); + if(result) { + CURL_TRC_WS(data, "curl_ws_send(), error writing frame head %d", result); + return result; + } + } + /* While there is either sendbuf to flush OR more payload to encode... */ + while(!Curl_bufq_is_empty(&ws->sendbuf) || (buflen > ws->sendbuf_payload)) { + /* Try to add more payload to sendbuf */ + if(buflen > ws->sendbuf_payload) { + size_t prev_len = Curl_bufq_len(&ws->sendbuf); + result = ws_enc_write_payload(&ws->enc, data, + buffer + ws->sendbuf_payload, + buflen - ws->sendbuf_payload, + &ws->sendbuf, &n); + if(result && (result != CURLE_AGAIN)) + return result; + ws->sendbuf_payload += Curl_bufq_len(&ws->sendbuf) - prev_len; + if(!ws->sendbuf_payload) { + return CURLE_AGAIN; + } + } + + /* flush, blocking when in callback */ + result = ws_flush(data, ws, Curl_is_in_callback(data)); + if(!result && ws->sendbuf_payload > 0) { + *pnsent += ws->sendbuf_payload; + buffer += ws->sendbuf_payload; + buflen -= ws->sendbuf_payload; + ws->sendbuf_payload = 0; + } + else if(result == CURLE_AGAIN) { + if(ws->sendbuf_payload > Curl_bufq_len(&ws->sendbuf)) { + /* blocked, part of payload bytes remain, report length + * that we managed to send. */ + size_t flushed = (ws->sendbuf_payload - Curl_bufq_len(&ws->sendbuf)); + *pnsent += flushed; + ws->sendbuf_payload -= flushed; + return CURLE_OK; + } + else { + /* blocked before sending headers or 1st payload byte. We cannot report + * OK on 0-length send (caller counts only payload) and EAGAIN */ + CURL_TRC_WS(data, "EAGAIN flushing sendbuf, payload_encoded: %zu/%zu", + ws->sendbuf_payload, buflen); + DEBUGASSERT(*pnsent == 0); + return CURLE_AGAIN; + } + } + else + return result; /* real error sending the data */ + } + return CURLE_OK; +} struct cr_ws_ctx { struct Curl_creader super; @@ -960,7 +1154,7 @@ static CURLcode cr_ws_read(struct Curl_easy *data, if(!ws->enc.payload_remain && Curl_bufq_is_empty(&ws->sendbuf)) { /* encode the data as a new BINARY frame */ - result = ws_enc_write_head(data, &ws->enc, CURLWS_BINARY, nread, + result = ws_enc_write_head(data, ws, &ws->enc, CURLWS_BINARY, nread, &ws->sendbuf); if(result) goto out; @@ -1200,6 +1394,7 @@ CURLcode Curl_ws_accept(struct Curl_easy *data, /* start over with sending */ data->req.eos_read = FALSE; + data->req.upload_done = FALSE; k->keepon |= KEEP_SEND; } @@ -1229,6 +1424,7 @@ out: struct ws_collect { struct Curl_easy *data; + struct websocket *ws; unsigned char *buffer; size_t buflen; size_t bufidx; @@ -1239,19 +1435,20 @@ struct ws_collect { bool written; }; -static ssize_t ws_client_collect(const unsigned char *buf, size_t buflen, - int frame_age, int frame_flags, - curl_off_t payload_offset, - curl_off_t payload_len, - void *userp, - CURLcode *err) +static CURLcode ws_client_collect(const unsigned char *buf, size_t buflen, + int frame_age, int frame_flags, + curl_off_t payload_offset, + curl_off_t payload_len, + void *userp, + size_t *pnwritten) { struct ws_collect *ctx = userp; struct Curl_easy *data = ctx->data; bool auto_pong = !data->set.ws_no_auto_pong; - size_t nwritten; curl_off_t remain = (payload_len - (payload_offset + buflen)); + CURLcode result = CURLE_OK; + *pnwritten = 0; if(!ctx->bufidx) { /* first write */ ctx->frame_age = frame_age; @@ -1262,31 +1459,30 @@ static ssize_t ws_client_collect(const unsigned char *buf, size_t buflen, if(auto_pong && (frame_flags & CURLWS_PING) && !remain) { /* auto-respond to PINGs, only works for single-frame payloads atm */ - size_t bytes; - infof(ctx->data, "[WS] auto-respond to PING with a PONG"); + CURL_TRC_WS(data, "auto PONG to [PING payload=%" FMT_OFF_T + "/%" FMT_OFF_T "]", payload_offset, payload_len); /* send back the exact same content as a PONG */ - *err = curl_ws_send(ctx->data, buf, buflen, &bytes, 0, CURLWS_PONG); - if(*err) - return -1; - nwritten = bytes; + result = ws_enc_add_cntrl(ctx->data, ctx->ws, buf, buflen, CURLWS_PONG); + if(result) + return result; + *pnwritten = buflen; } else { + size_t write_len; + ctx->written = TRUE; DEBUGASSERT(ctx->buflen >= ctx->bufidx); - nwritten = CURLMIN(buflen, ctx->buflen - ctx->bufidx); - if(!nwritten) { - if(!buflen) { /* 0 length write, we accept that */ - *err = CURLE_OK; - return 0; - } - *err = CURLE_AGAIN; /* no more space */ - return -1; + write_len = CURLMIN(buflen, ctx->buflen - ctx->bufidx); + if(!write_len) { + if(!buflen) /* 0 length write, we accept that */ + return CURLE_OK; + return CURLE_AGAIN; /* no more space */ } - *err = CURLE_OK; - memcpy(ctx->buffer + ctx->bufidx, buf, nwritten); - ctx->bufidx += nwritten; + memcpy(ctx->buffer + ctx->bufidx, buf, write_len); + ctx->bufidx += write_len; + *pnwritten = write_len; } - return nwritten; + return result; } static CURLcode nw_in_recv(void *reader_ctx, @@ -1334,6 +1530,7 @@ CURLcode curl_ws_recv(CURL *d, void *buffer, memset(&ctx, 0, sizeof(ctx)); ctx.data = data; + ctx.ws = ws; ctx.buffer = buffer; ctx.buflen = buflen; @@ -1384,6 +1581,13 @@ CURLcode curl_ws_recv(CURL *d, void *buffer, FMT_OFF_T ", %" FMT_OFF_T " left)", buflen, *nread, ws->recvframe.offset, ws->recvframe.bytesleft); + /* all's well, try to send any pending control. we do not know + * when the application will call `curl_ws_send()` again. */ + if(!data->set.ws_raw_mode && ws->pending.type) { + CURLcode r2 = ws_enc_add_pending(data, ws); + if(!r2) + (void)ws_flush(data, ws, Curl_is_in_callback(data)); + } return CURLE_OK; } @@ -1531,9 +1735,10 @@ CURLcode curl_ws_send(CURL *d, const void *buffer_arg, { struct websocket *ws; const unsigned char *buffer = buffer_arg; - size_t n; CURLcode result = CURLE_OK; struct Curl_easy *data = d; + size_t ndummy; + size_t *pnsent = sent ? sent : &ndummy; if(!GOOD_EASY_HANDLE(data)) return CURLE_BAD_FUNCTION_ARGUMENT; @@ -1541,8 +1746,7 @@ CURLcode curl_ws_send(CURL *d, const void *buffer_arg, ", flags=%x), raw=%d", buflen, fragsize, flags, data->set.ws_raw_mode); - if(sent) - *sent = 0; + *pnsent = 0; if(!buffer && buflen) { failf(data, "[WS] buffer is NULL when buflen is not"); @@ -1586,107 +1790,18 @@ CURLcode curl_ws_send(CURL *d, const void *buffer_arg, failf(data, "[WS] fragsize and flags must be zero in raw mode"); return CURLE_BAD_FUNCTION_ARGUMENT; } - result = ws_send_raw(data, buffer, buflen, sent); + result = ws_send_raw(data, buffer, buflen, pnsent); goto out; } - /* Not RAW mode, buf we do the frame encoding */ - - if(ws->enc.payload_remain || !Curl_bufq_is_empty(&ws->sendbuf)) { - /* a frame is ongoing with payload buffered or more payload - * that needs to be encoded into the buffer */ - if(buflen < ws->sendbuf_payload) { - /* We have been called with LESS buffer data than before. This - * is not how it's supposed too work. */ - failf(data, "[WS] curl_ws_send() called with smaller 'buflen' than " - "bytes already buffered in previous call, %zu vs %zu", - buflen, ws->sendbuf_payload); - result = CURLE_BAD_FUNCTION_ARGUMENT; - goto out; - } - if((curl_off_t)buflen > - (ws->enc.payload_remain + (curl_off_t)ws->sendbuf_payload)) { - /* too large buflen beyond payload length of frame */ - failf(data, "[WS] unaligned frame size (sending %zu instead of %" - FMT_OFF_T ")", - buflen, ws->enc.payload_remain + ws->sendbuf_payload); - result = CURLE_BAD_FUNCTION_ARGUMENT; - goto out; - } - } - else { - /* starting a new frame, we want a clean sendbuf */ - result = ws_flush(data, ws, Curl_is_in_callback(data)); - if(result) - goto out; - - result = ws_enc_write_head(data, &ws->enc, flags, - (flags & CURLWS_OFFSET) ? - fragsize : (curl_off_t)buflen, - &ws->sendbuf); - if(result) { - CURL_TRC_WS(data, "curl_ws_send(), error writing frame head %d", result); - goto out; - } - } - - /* While there is either sendbuf to flush OR more payload to encode... */ - while(!Curl_bufq_is_empty(&ws->sendbuf) || (buflen > ws->sendbuf_payload)) { - /* Try to add more payload to sendbuf */ - if(buflen > ws->sendbuf_payload) { - size_t prev_len = Curl_bufq_len(&ws->sendbuf); - result = ws_enc_write_payload(&ws->enc, data, - buffer + ws->sendbuf_payload, - buflen - ws->sendbuf_payload, - &ws->sendbuf, &n); - if(result && (result != CURLE_AGAIN)) - goto out; - ws->sendbuf_payload += Curl_bufq_len(&ws->sendbuf) - prev_len; - if(!ws->sendbuf_payload) { - result = CURLE_AGAIN; - goto out; - } - } - - /* flush, blocking when in callback */ - result = ws_flush(data, ws, Curl_is_in_callback(data)); - if(!result && ws->sendbuf_payload > 0) { - if(sent) - *sent += ws->sendbuf_payload; - buffer += ws->sendbuf_payload; - buflen -= ws->sendbuf_payload; - ws->sendbuf_payload = 0; - } - else if(result == CURLE_AGAIN) { - if(ws->sendbuf_payload > Curl_bufq_len(&ws->sendbuf)) { - /* blocked, part of payload bytes remain, report length - * that we managed to send. */ - size_t flushed = (ws->sendbuf_payload - Curl_bufq_len(&ws->sendbuf)); - if(sent) - *sent += flushed; - ws->sendbuf_payload -= flushed; - result = CURLE_OK; - goto out; - } - else { - /* blocked before sending headers or 1st payload byte. We cannot report - * OK on 0-length send (caller counts only payload) and EAGAIN */ - CURL_TRC_WS(data, "EAGAIN flushing sendbuf, payload_encoded: %zu/%zu", - ws->sendbuf_payload, buflen); - DEBUGASSERT(!sent || *sent == 0); - result = CURLE_AGAIN; - goto out; - } - } - else - goto out; /* real error sending the data */ - } + /* Not RAW mode, we do the frame encoding */ + result = ws_enc_send(data, ws, buffer, buflen, fragsize, flags, pnsent); out: CURL_TRC_WS(data, "curl_ws_send(len=%zu, fragsize=%" FMT_OFF_T ", flags=%x, raw=%d) -> %d, %zu", buflen, fragsize, flags, data->set.ws_raw_mode, result, - sent ? *sent : 0); + *pnsent); return result; } @@ -1760,7 +1875,8 @@ CURL_EXTERN CURLcode curl_ws_start_frame(CURL *d, goto out; } - result = ws_enc_write_head(data, &ws->enc, flags, frame_len, &ws->sendbuf); + result = ws_enc_write_head(data, ws, &ws->enc, flags, frame_len, + &ws->sendbuf); if(result) CURL_TRC_WS(data, "curl_start_frame(), error adding frame head %d", result); diff --git a/packages/OS400/README.OS400 b/packages/OS400/README.OS400 index 41bd24237..e7699e168 100644 --- a/packages/OS400/README.OS400 +++ b/packages/OS400/README.OS400 @@ -256,7 +256,6 @@ _ TELNET _ TFTP - Compiling on OS/400: These instructions targets people who knows about OS/400, compiling, IFS and @@ -328,7 +327,6 @@ _ Do not use original source include files unless you know what you are doing. /curl/include/curl). - ILE/RPG support: Since most of the ILE OS/400 programmers use ILE/RPG exclusively, a diff --git a/projects/Windows/.gitignore b/projects/Windows/.gitignore index f32b8558a..23ef63506 100644 --- a/projects/Windows/.gitignore +++ b/projects/Windows/.gitignore @@ -2,9 +2,6 @@ # # SPDX-License-Identifier: curl -*.ncb -*.opensdf -*.sdf -*.suo -*.user -*.vcxproj +VC10/ +VC11/ +VC12/ diff --git a/projects/Windows/tmpl/README.txt b/projects/Windows/tmpl/README.txt new file mode 100644 index 000000000..08b2908a2 --- /dev/null +++ b/projects/Windows/tmpl/README.txt @@ -0,0 +1,6 @@ +The files in this directory are not meant to be opened with Visual Studio. + +This directory contains template files that are used to generate project files +for legacy versions of Visual Studio 2010, 2012 and 2013. To generate the +files run generate.bat in the projects directory and refer to that directory's +README. diff --git a/projects/Windows/tmpl/curl-all.sln b/projects/Windows/tmpl/curl-all.sln index 66c6d0f2f..8f6afd4e1 100644 --- a/projects/Windows/tmpl/curl-all.sln +++ b/projects/Windows/tmpl/curl-all.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "src\curl.vcxproj", "{5228E9CE-A216-422F-A5E6-58E95E2DD71D}" ProjectSection(ProjectDependencies) = postProject {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} diff --git a/projects/Windows/tmpl/curl.sln b/projects/Windows/tmpl/curl.sln index 01c07e4ff..7e50eed99 100644 --- a/projects/Windows/tmpl/curl.sln +++ b/projects/Windows/tmpl/curl.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "curl.vcxproj", "{5228E9CE-A216-422F-A5E6-58E95E2DD71D}" EndProject Global diff --git a/projects/Windows/tmpl/curl.vcxproj.tmpl b/projects/Windows/tmpl/curl.vcxproj index 940b106b7..940b106b7 100644 --- a/projects/Windows/tmpl/curl.vcxproj.tmpl +++ b/projects/Windows/tmpl/curl.vcxproj diff --git a/projects/Windows/tmpl/curl.vcxproj.filters b/projects/Windows/tmpl/curl.vcxproj.filters index 0d9d4d5fe..793a698a4 100644 --- a/projects/Windows/tmpl/curl.vcxproj.filters +++ b/projects/Windows/tmpl/curl.vcxproj.filters @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="$TOOLSVER" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + <Extensions>c</Extensions> </Filter> <Filter Include="Header Files"> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + <Extensions>h</Extensions> </Filter> <Filter Include="Resource Files"> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + <Extensions>rc</Extensions> </Filter> </ItemGroup> </Project> diff --git a/projects/Windows/tmpl/libcurl.sln b/projects/Windows/tmpl/libcurl.sln index ef31025f8..2eeb679db 100644 --- a/projects/Windows/tmpl/libcurl.sln +++ b/projects/Windows/tmpl/libcurl.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "libcurl.vcxproj", "{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}" EndProject Global diff --git a/projects/Windows/tmpl/libcurl.vcxproj.tmpl b/projects/Windows/tmpl/libcurl.vcxproj index f66765ca9..f66765ca9 100644 --- a/projects/Windows/tmpl/libcurl.vcxproj.tmpl +++ b/projects/Windows/tmpl/libcurl.vcxproj diff --git a/projects/Windows/tmpl/libcurl.vcxproj.filters b/projects/Windows/tmpl/libcurl.vcxproj.filters index 0d9d4d5fe..793a698a4 100644 --- a/projects/Windows/tmpl/libcurl.vcxproj.filters +++ b/projects/Windows/tmpl/libcurl.vcxproj.filters @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="$TOOLSVER" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + <Extensions>c</Extensions> </Filter> <Filter Include="Header Files"> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + <Extensions>h</Extensions> </Filter> <Filter Include="Resource Files"> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + <Extensions>rc</Extensions> </Filter> </ItemGroup> </Project> diff --git a/projects/generate.bat b/projects/generate.bat index 14e57d257..3aebff183 100644 --- a/projects/generate.bat +++ b/projects/generate.bat @@ -109,14 +109,14 @@ rem :generate_proj echo. echo Generating %1 project files - md Windows\%1\lib - md Windows\%1\src + if not exist Windows\%1\lib md Windows\%1\lib + if not exist Windows\%1\src md Windows\%1\src call :generate %1 Windows\tmpl\curl-all.sln Windows\%1\curl-all.sln call :generate %1 Windows\tmpl\curl.sln Windows\%1\src\curl.sln - call :generate %1 Windows\tmpl\curl.vcxproj.tmpl Windows\%1\src\curl.vcxproj + call :generate %1 Windows\tmpl\curl.vcxproj Windows\%1\src\curl.vcxproj call :generate %1 Windows\tmpl\curl.vcxproj.filters Windows\%1\src\curl.vcxproj.filters call :generate %1 Windows\tmpl\libcurl.sln Windows\%1\lib\libcurl.sln - call :generate %1 Windows\tmpl\libcurl.vcxproj.tmpl Windows\%1\lib\libcurl.vcxproj + call :generate %1 Windows\tmpl\libcurl.vcxproj Windows\%1\lib\libcurl.vcxproj call :generate %1 Windows\tmpl\libcurl.vcxproj.filters Windows\%1\lib\libcurl.vcxproj.filters exit /B @@ -125,10 +125,16 @@ rem Main project clean function. rem rem %1 - version rem -:generate_proj +:clean_proj echo. echo Removing %1 project files - rd /Q /S Windows\%1 + call :clean Windows\%1\curl-all.sln + call :clean Windows\%1\src\curl.sln + call :clean Windows\%1\src\curl.vcxproj + call :clean Windows\%1\src\curl.vcxproj.filters + call :clean Windows\%1\lib\libcurl.sln + call :clean Windows\%1\lib\libcurl.vcxproj + call :clean Windows\%1\lib\libcurl.vcxproj.filters exit /B @@ -150,29 +156,25 @@ rem ) set "S01=$FORMATVER" - set "S02=$FORMATYEAR" - set "S03=$PLATFORMTOOLSET" - set "S04=$SUBDIR" - set "S05=$TOOLSVER" + set "S02=$PLATFORMTOOLSET" + set "S03=$SUBDIR" + set "S04=$TOOLSVER" if "%1" == "VC10" ( - set "R01=11.0" - set "R02=2010" - set "R03=v100" - set "R04=VC10" - set "R05=4.0" + set "R01=11.00" + set "R02=v100" + set "R03=VC10" + set "R04=4.0" ) else if "%1%" == "VC11" ( - set "R01=12.0" - set "R02=2012" - set "R03=v110" - set "R04=VC11" - set "R05=4.0" + set "R01=12.00" + set "R02=v110" + set "R03=VC11" + set "R04=4.0" ) else if "%1%" == "VC12" ( - set "R01=12.0" - set "R02=2013" - set "R03=v120" - set "R04=VC12" - set "R05=12.0" + set "R01=12.00" + set "R02=v120" + set "R03=VC12" + set "R04=12.0" ) echo * %CD%\%3 @@ -183,7 +185,6 @@ rem set "var=!var:%S02%=%R02%!" set "var=!var:%S03%=%R03%!" set "var=!var:%S04%=%R04%!" - set "var=!var:%S05%=%R05%!" set "var=!var:*:=!" diff --git a/scripts/singleuse.pl b/scripts/singleuse.pl index 755c3987f..2e8a8e0af 100755 --- a/scripts/singleuse.pl +++ b/scripts/singleuse.pl @@ -56,6 +56,7 @@ my %wl = ( 'curlx_base64_decode' => 'internal api', 'curlx_base64_encode' => 'internal api', 'curlx_base64url_encode' => 'internal api', + 'Curl_multi_clear_dirty' => 'internal api', ); my %api = ( diff --git a/scripts/top-complexity b/scripts/top-complexity index 764351127..414adaf56 100755 --- a/scripts/top-complexity +++ b/scripts/top-complexity @@ -79,10 +79,10 @@ my %whitelist = ( ); # functions with complexity above this level causes the function to return error -my $cutoff = 72; +my $cutoff = 70; # functions above this complexity level are shown -my $show = 60; +my $show = 57; my $error = 0; my %where; diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c index 0b36236ab..6a587cc1c 100644 --- a/src/tool_cb_dbg.c +++ b/src/tool_cb_dbg.c @@ -91,7 +91,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type, char idsbuf[60]; curl_off_t xfer_id, conn_id; - (void)handle; /* not used */ + (void)handle; (void)userdata; if(global->tracetime) { diff --git a/src/tool_cb_rea.c b/src/tool_cb_rea.c index 5b8ba62a5..0a3e9ef0e 100644 --- a/src/tool_cb_rea.c +++ b/src/tool_cb_rea.c @@ -146,10 +146,10 @@ int tool_readbusy_cb(void *clientp, struct OperationConfig *config = per->config; static curl_off_t ulprev; - (void)dltotal; /* unused */ - (void)dlnow; /* unused */ - (void)ultotal; /* unused */ - (void)ulnow; /* unused */ + (void)dltotal; + (void)dlnow; + (void)ultotal; + (void)ulnow; if(config->readbusy) { if(ulprev == ulnow) { diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 165a4bfb6..6be57dbd5 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -2808,6 +2808,12 @@ static ParameterError opt_filestring(struct OperationConfig *config, return err; } +/* detect e2 80 80 - e2 80 ff */ +static bool has_leading_unicode(const unsigned char *arg) +{ + return ((arg[0] == 0xe2) && (arg[1] == 0x80) && (arg[2] & 0x80)); +} + /* the longest command line option, excluding the leading -- */ #define MAX_OPTION_LEN 26 @@ -2947,10 +2953,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ warnf("The filename argument '%s' looks like a flag.", nextarg); } - else if(!strncmp("\xe2\x80\x9c", nextarg, 3)) { - warnf("The argument '%s' starts with a Unicode quote where " - "maybe an ASCII \" was intended?", - nextarg); + else if(has_leading_unicode((const unsigned char *)nextarg)) { + warnf("The argument '%s' starts with a Unicode character. " + "Maybe ASCII was intended?", nextarg); } /* ARG_FILE | ARG_STRG */ err = opt_filestring(config, a, nextarg); diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 9d1fcbb75..daed381e4 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -109,6 +109,7 @@ test727 test728 test729 test730 test731 test732 test733 test734 test735 \ test736 test737 test738 test739 test740 test741 test742 test743 test744 \ test745 test746 test747 test748 test749 test750 test751 test752 test753 \ test754 test755 test756 test757 test758 test759 test760 test761 test762 \ +test763 \ \ test780 test781 test782 test783 test784 test785 test786 test787 test788 \ test789 test790 test791 test792 test793 test794 test795 test796 test797 \ diff --git a/tests/data/test1013 b/tests/data/test1013 index 87e99cd56..aee2bfbef 100644 --- a/tests/data/test1013 +++ b/tests/data/test1013 @@ -13,9 +13,6 @@ curl-config # # Client-side <client> -<server> -none -</server> <name> Compare curl --version with curl-config --protocols </name> diff --git a/tests/data/test1014 b/tests/data/test1014 index ce113a73b..7dce0d8e1 100644 --- a/tests/data/test1014 +++ b/tests/data/test1014 @@ -13,9 +13,6 @@ curl-config # # Client-side <client> -<server> -none -</server> <name> Compare curl --version with curl-config --features </name> diff --git a/tests/data/test1016 b/tests/data/test1016 index fac0ab679..2deeedb0d 100644 --- a/tests/data/test1016 +++ b/tests/data/test1016 @@ -11,9 +11,6 @@ Range # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1017 b/tests/data/test1017 index aa1453371..26f380b10 100644 --- a/tests/data/test1017 +++ b/tests/data/test1017 @@ -12,9 +12,6 @@ Range # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1018 b/tests/data/test1018 index 7aff1a9db..e953faea1 100644 --- a/tests/data/test1018 +++ b/tests/data/test1018 @@ -11,9 +11,6 @@ Range # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1019 b/tests/data/test1019 index 381aa7b27..864833576 100644 --- a/tests/data/test1019 +++ b/tests/data/test1019 @@ -12,9 +12,6 @@ Range # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1020 b/tests/data/test1020 index b0c8c6b40..69de43d78 100644 --- a/tests/data/test1020 +++ b/tests/data/test1020 @@ -12,9 +12,6 @@ Range # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1022 b/tests/data/test1022 index 597dfd05d..888c9ea10 100644 --- a/tests/data/test1022 +++ b/tests/data/test1022 @@ -13,9 +13,6 @@ curl-config # # Client-side <client> -<server> -none -</server> <name> Compare curl --version with curl-config --version </name> diff --git a/tests/data/test1023 b/tests/data/test1023 index 70e027aa8..40fb11f81 100644 --- a/tests/data/test1023 +++ b/tests/data/test1023 @@ -13,9 +13,6 @@ curl-config # # Client-side <client> -<server> -none -</server> <name> Compare curl --version with curl-config --vernum </name> diff --git a/tests/data/test1026 b/tests/data/test1026 index 3e4408244..d7bd12365 100644 --- a/tests/data/test1026 +++ b/tests/data/test1026 @@ -16,9 +16,6 @@ <features> manual </features> -<server> -none -</server> <name> curl --manual </name> diff --git a/tests/data/test1027 b/tests/data/test1027 index 354df4e40..b8fc4a036 100644 --- a/tests/data/test1027 +++ b/tests/data/test1027 @@ -13,9 +13,6 @@ # # Client-side <client> -<server> -none -</server> <name> curl --help </name> diff --git a/tests/data/test1034 b/tests/data/test1034 index eda13bb23..2dab1ab44 100644 --- a/tests/data/test1034 +++ b/tests/data/test1034 @@ -19,9 +19,6 @@ config file # # Client-side <client> -<server> -none -</server> <features> IDN http diff --git a/tests/data/test1035 b/tests/data/test1035 index c8eb282af..50a762d72 100644 --- a/tests/data/test1035 +++ b/tests/data/test1035 @@ -17,9 +17,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> IDN http diff --git a/tests/data/test1063 b/tests/data/test1063 index d85c014f1..6d942f509 100644 --- a/tests/data/test1063 +++ b/tests/data/test1063 @@ -13,9 +13,6 @@ FAILURE # Client-side <client> -<server> -none -</server> <features> file Largefile diff --git a/tests/data/test1084 b/tests/data/test1084 index 1e311a8b1..5cb1646f7 100644 --- a/tests/data/test1084 +++ b/tests/data/test1084 @@ -20,9 +20,6 @@ non-existing host <features> http </features> -<server> -none -</server> <name> HTTP GET with invalid --interface </name> diff --git a/tests/data/test1085 b/tests/data/test1085 index c4a57800f..ca2c8e91b 100644 --- a/tests/data/test1085 +++ b/tests/data/test1085 @@ -22,9 +22,6 @@ non-existing host http IPv6 </features> -<server> -none -</server> <name> HTTP-IPv6 GET with invalid --interface </name> diff --git a/tests/data/test1119 b/tests/data/test1119 index 1a73439e6..b37c4af96 100644 --- a/tests/data/test1119 +++ b/tests/data/test1119 @@ -9,10 +9,6 @@ symbols-in-versions # # Client-side <client> -<server> -none -</server> - <name> Verify that symbols-in-versions and headers are in sync </name> diff --git a/tests/data/test1132 b/tests/data/test1132 index e7a802a71..d0ef42a24 100644 --- a/tests/data/test1132 +++ b/tests/data/test1132 @@ -9,10 +9,6 @@ memory-includes # # Client-side <client> -<server> -none -</server> - <name> Verify memory #include files in libcurl's C source files </name> diff --git a/tests/data/test1135 b/tests/data/test1135 index d3262a1d3..405d4b8fc 100644 --- a/tests/data/test1135 +++ b/tests/data/test1135 @@ -9,10 +9,6 @@ CURL_EXTERN # # Client-side <client> -<server> -none -</server> - # The VMS and OS/400 builds extract the CURL_EXTERN protos and use in # the build. We break binary compatibility by changing order. Only add # new entries last or bump the SONAME. diff --git a/tests/data/test1139 b/tests/data/test1139 index 2704e0a21..c0b488bec 100644 --- a/tests/data/test1139 +++ b/tests/data/test1139 @@ -11,10 +11,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Verify that all libcurl options have man pages </name> diff --git a/tests/data/test1140 b/tests/data/test1140 index 2e4d8daf2..01b1e0309 100644 --- a/tests/data/test1140 +++ b/tests/data/test1140 @@ -10,10 +10,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Verify the nroff of manpages </name> diff --git a/tests/data/test1165 b/tests/data/test1165 index 89f02d719..f345dd9ac 100644 --- a/tests/data/test1165 +++ b/tests/data/test1165 @@ -9,10 +9,6 @@ CURL_DISABLE # # Client-side <client> -<server> -none -</server> - <name> Verify configure.ac and source code CURL_DISABLE_-sync </name> diff --git a/tests/data/test1167 b/tests/data/test1167 index 76777f81b..11b0e4adf 100644 --- a/tests/data/test1167 +++ b/tests/data/test1167 @@ -8,10 +8,6 @@ source analysis # # Client-side <client> -<server> -none -</server> - <name> Verify curl prefix of public symbols in header files </name> diff --git a/tests/data/test1169 b/tests/data/test1169 index bba5d131e..149f93217 100644 --- a/tests/data/test1169 +++ b/tests/data/test1169 @@ -8,9 +8,6 @@ runtests.pl # # Client-side <client> -<server> -none -</server> <name> Verify that runtests.pl accepts an -L option </name> diff --git a/tests/data/test1173 b/tests/data/test1173 index 89b0cb5a7..e49ed9336 100644 --- a/tests/data/test1173 +++ b/tests/data/test1173 @@ -10,10 +10,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Manpage syntax checks </name> diff --git a/tests/data/test1175 b/tests/data/test1175 index cfffa6730..d1611f7ed 100644 --- a/tests/data/test1175 +++ b/tests/data/test1175 @@ -9,10 +9,6 @@ symbols-in-versions # # Client-side <client> -<server> -none -</server> - <name> Verify that symbols-in-versions and libcurl-errors.3 are in sync </name> diff --git a/tests/data/test1177 b/tests/data/test1177 index c1f6d661c..d31672eeb 100644 --- a/tests/data/test1177 +++ b/tests/data/test1177 @@ -10,10 +10,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Verify that feature names and CURL_VERSION_* in lib and docs are in sync </name> diff --git a/tests/data/test1179 b/tests/data/test1179 index 8dca8ab88..2da8d6fdf 100644 --- a/tests/data/test1179 +++ b/tests/data/test1179 @@ -14,9 +14,6 @@ wrong option # # Client-side <client> -<server> -none -</server> # make this test require manual as the error message is different without it <features> manual diff --git a/tests/data/test1182 b/tests/data/test1182 index 118b967b3..6fa37df17 100644 --- a/tests/data/test1182 +++ b/tests/data/test1182 @@ -8,9 +8,6 @@ runtests.pl # # Client-side <client> -<server> -none -</server> <name> Verify that runtests.pl accepts an exclude file with the -E option </name> diff --git a/tests/data/test1185 b/tests/data/test1185 index 6a4d43e29..8b14f4c5f 100644 --- a/tests/data/test1185 +++ b/tests/data/test1185 @@ -8,9 +8,6 @@ checksrc # # Client-side <client> -<server> -none -</server> <name> checksrc </name> diff --git a/tests/data/test1222 b/tests/data/test1222 index abb7d6618..3023c918a 100644 --- a/tests/data/test1222 +++ b/tests/data/test1222 @@ -8,10 +8,6 @@ source analysis # # Client-side <client> -<server> -none -</server> - <name> Verify deprecation statuses and versions </name> diff --git a/tests/data/test1234 b/tests/data/test1234 index 5676a809c..f6b03c42c 100644 --- a/tests/data/test1234 +++ b/tests/data/test1234 @@ -12,9 +12,6 @@ FAILURE # Client-side <client> -<server> -none -</server> <name> abusing {}-globbing </name> diff --git a/tests/data/test1236 b/tests/data/test1236 index 286bb0a02..9134c48f2 100644 --- a/tests/data/test1236 +++ b/tests/data/test1236 @@ -11,9 +11,6 @@ FAILURE # Client-side <client> -<server> -none -</server> <name> [] globbing overflowing the range counter </name> diff --git a/tests/data/test1260 b/tests/data/test1260 index 11cc13dfc..df1ac7895 100644 --- a/tests/data/test1260 +++ b/tests/data/test1260 @@ -12,9 +12,6 @@ HTTP GET # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1263 b/tests/data/test1263 index bed3b35ef..ca5fbc243 100644 --- a/tests/data/test1263 +++ b/tests/data/test1263 @@ -13,9 +13,6 @@ HTTP GET # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1264 b/tests/data/test1264 index e9ae4b508..9eebd58f9 100644 --- a/tests/data/test1264 +++ b/tests/data/test1264 @@ -12,9 +12,6 @@ HTTP GET # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1268 b/tests/data/test1268 index a3fb2bc41..b5dda0361 100644 --- a/tests/data/test1268 +++ b/tests/data/test1268 @@ -13,9 +13,6 @@ warning # # Client-side <client> -<server> -none -</server> <features> UnixSockets </features> diff --git a/tests/data/test1269 b/tests/data/test1269 index 6cc68e0f0..d191d12d3 100644 --- a/tests/data/test1269 +++ b/tests/data/test1269 @@ -13,9 +13,6 @@ # # Client-side <client> -<server> -none -</server> <name> too large --retry-delay value </name> diff --git a/tests/data/test1275 b/tests/data/test1275 index 31893f7ba..1a11e177a 100644 --- a/tests/data/test1275 +++ b/tests/data/test1275 @@ -9,10 +9,6 @@ markdown # # Client-side <client> -<server> -none -</server> - <name> Verify capital letters after period in markdown files </name> diff --git a/tests/data/test1276 b/tests/data/test1276 index b365f800a..b6381938e 100644 --- a/tests/data/test1276 +++ b/tests/data/test1276 @@ -9,10 +9,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Verify lib/optiontable.pl </name> diff --git a/tests/data/test1279 b/tests/data/test1279 index 4b9ce2f19..98a6122c9 100644 --- a/tests/data/test1279 +++ b/tests/data/test1279 @@ -10,10 +10,6 @@ libcurl.def # # Client-side <client> -<server> -none -</server> - <name> Verify libcurl.def against CURL_EXTERN declarations </name> diff --git a/tests/data/test1281 b/tests/data/test1281 index c7520608a..bac41caa8 100644 --- a/tests/data/test1281 +++ b/tests/data/test1281 @@ -12,9 +12,6 @@ URL # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1291 b/tests/data/test1291 index 8d51138da..7c9c50c63 100644 --- a/tests/data/test1291 +++ b/tests/data/test1291 @@ -15,9 +15,6 @@ HTTP PUT # Client-side <client> -<server> -none -</server> <name> Attempt to upload 1000 files but fail immediately </name> diff --git a/tests/data/test1300 b/tests/data/test1300 index 1c1ec7bf8..4336a94e6 100644 --- a/tests/data/test1300 +++ b/tests/data/test1300 @@ -9,9 +9,6 @@ llist # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1301 b/tests/data/test1301 index ad6113e56..8ebf1f021 100644 --- a/tests/data/test1301 +++ b/tests/data/test1301 @@ -8,9 +8,6 @@ curl_strequal # # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1302 b/tests/data/test1302 index 22102413b..50d0d171a 100644 --- a/tests/data/test1302 +++ b/tests/data/test1302 @@ -9,9 +9,6 @@ base64 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1303 b/tests/data/test1303 index 2e12ae43f..705a04111 100644 --- a/tests/data/test1303 +++ b/tests/data/test1303 @@ -9,9 +9,6 @@ Curl_timeleft # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1304 b/tests/data/test1304 index da36ed1a0..6311194cb 100644 --- a/tests/data/test1304 +++ b/tests/data/test1304 @@ -9,9 +9,6 @@ netrc # # Client-side <client> -<server> -none -</server> <features> unittest netrc diff --git a/tests/data/test1305 b/tests/data/test1305 index 3765f80a0..7a6aa2209 100644 --- a/tests/data/test1305 +++ b/tests/data/test1305 @@ -10,9 +10,6 @@ hash # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1306 b/tests/data/test1306 index 5512c3f5f..f09e7ac08 100644 --- a/tests/data/test1306 +++ b/tests/data/test1306 @@ -10,9 +10,6 @@ hash # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1307 b/tests/data/test1307 index cf4a4ac1a..31e404818 100644 --- a/tests/data/test1307 +++ b/tests/data/test1307 @@ -10,9 +10,6 @@ wildcardmatch # # Client-side <client> -<server> -none -</server> <features> unittest ftp diff --git a/tests/data/test1308 b/tests/data/test1308 index a106e1a0a..4ad1140b6 100644 --- a/tests/data/test1308 +++ b/tests/data/test1308 @@ -14,9 +14,6 @@ FORM http form-api </features> -<server> -none -</server> <name> formpost tests </name> diff --git a/tests/data/test1309 b/tests/data/test1309 index 4b86377fb..c9ae845ff 100644 --- a/tests/data/test1309 +++ b/tests/data/test1309 @@ -9,9 +9,6 @@ splay # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1323 b/tests/data/test1323 index 66bac61ff..3456c3cde 100644 --- a/tests/data/test1323 +++ b/tests/data/test1323 @@ -14,9 +14,6 @@ curlx_tvdiff # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1330 b/tests/data/test1330 index 93b860461..ee54be1b2 100644 --- a/tests/data/test1330 +++ b/tests/data/test1330 @@ -13,9 +13,6 @@ TrackMemory # Client-side <client> -<server> -none -</server> <features> unittest TrackMemory diff --git a/tests/data/test1394 b/tests/data/test1394 index 312a995b3..a204c4200 100644 --- a/tests/data/test1394 +++ b/tests/data/test1394 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1395 b/tests/data/test1395 index a73e043ca..29fb4bc1d 100644 --- a/tests/data/test1395 +++ b/tests/data/test1395 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1396 b/tests/data/test1396 index d65ab2552..811416e34 100644 --- a/tests/data/test1396 +++ b/tests/data/test1396 @@ -10,9 +10,6 @@ curl_easy_unescape # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1397 b/tests/data/test1397 index f31b2c2a3..a9ed7fd37 100644 --- a/tests/data/test1397 +++ b/tests/data/test1397 @@ -9,9 +9,6 @@ Curl_cert_hostcheck # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1398 b/tests/data/test1398 index f77e32174..f44f9efd9 100644 --- a/tests/data/test1398 +++ b/tests/data/test1398 @@ -9,9 +9,6 @@ curl_msnprintf # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1399 b/tests/data/test1399 index f8a7c19bb..a978a5681 100644 --- a/tests/data/test1399 +++ b/tests/data/test1399 @@ -9,9 +9,6 @@ Curl_pgrsTime # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1409 b/tests/data/test1409 index 6e248ca10..e0c32be18 100644 --- a/tests/data/test1409 +++ b/tests/data/test1409 @@ -10,9 +10,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <name> Pass in string to -C </name> diff --git a/tests/data/test1410 b/tests/data/test1410 index 0a9f4878b..73362dc00 100644 --- a/tests/data/test1410 +++ b/tests/data/test1410 @@ -10,9 +10,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <name> Pass in negative number to --max-time </name> diff --git a/tests/data/test1427 b/tests/data/test1427 index ce5cbd15a..e667f996f 100644 --- a/tests/data/test1427 +++ b/tests/data/test1427 @@ -8,9 +8,6 @@ integer overflow # # Client-side <client> -<server> -none -</server> <name> too large -m timeout value </name> diff --git a/tests/data/test1447 b/tests/data/test1447 index 0b0e4e65c..517c22b04 100644 --- a/tests/data/test1447 +++ b/tests/data/test1447 @@ -13,9 +13,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> http proxy diff --git a/tests/data/test1453 b/tests/data/test1453 index aa0878efa..921b1bdf9 100644 --- a/tests/data/test1453 +++ b/tests/data/test1453 @@ -13,9 +13,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> tftp </features> diff --git a/tests/data/test1461 b/tests/data/test1461 index f1c481ec6..79b370bc1 100644 --- a/tests/data/test1461 +++ b/tests/data/test1461 @@ -16,9 +16,6 @@ <features> manual </features> -<server> -none -</server> <name> curl important --help </name> diff --git a/tests/data/test1462 b/tests/data/test1462 index 086591286..953dc1327 100644 --- a/tests/data/test1462 +++ b/tests/data/test1462 @@ -13,9 +13,6 @@ # # Client-side <client> -<server> -none -</server> <name> curl invalid category --help </name> diff --git a/tests/data/test1463 b/tests/data/test1463 index 9fd527f78..55174be50 100644 --- a/tests/data/test1463 +++ b/tests/data/test1463 @@ -14,9 +14,6 @@ FILE # # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1464 b/tests/data/test1464 index 59f58dfc5..c005b5afc 100644 --- a/tests/data/test1464 +++ b/tests/data/test1464 @@ -14,9 +14,6 @@ FILE # # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1469 b/tests/data/test1469 index 1aa512e50..f9600b5b9 100644 --- a/tests/data/test1469 +++ b/tests/data/test1469 @@ -9,9 +9,6 @@ FAILURE # Client-side <client> -<server> -none -</server> <name> Space in FTP upload URL </name> diff --git a/tests/data/test1471 b/tests/data/test1471 index e8e41430d..27343fd2f 100644 --- a/tests/data/test1471 +++ b/tests/data/test1471 @@ -14,9 +14,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1472 b/tests/data/test1472 index 07f0620c9..2266e3ec9 100644 --- a/tests/data/test1472 +++ b/tests/data/test1472 @@ -14,9 +14,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1474 b/tests/data/test1474 index 8fc39e0e6..8ccecf187 100644 --- a/tests/data/test1474 +++ b/tests/data/test1474 @@ -15,9 +15,6 @@ HTTP GET # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1477 b/tests/data/test1477 index a8c4659e4..a0e0d6ed7 100644 --- a/tests/data/test1477 +++ b/tests/data/test1477 @@ -8,10 +8,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> Verify that error codes in headers and libcurl-errors.3 are in sync </name> diff --git a/tests/data/test1478 b/tests/data/test1478 index ef7b40372..b3eefbb8a 100644 --- a/tests/data/test1478 +++ b/tests/data/test1478 @@ -10,10 +10,6 @@ documentation # # Client-side <client> -<server> -none -</server> - <name> src/tool_listhelp.c is in sync with docs/cmdline-opts </name> diff --git a/tests/data/test1486 b/tests/data/test1486 index e974b99e0..e8b3f6825 100644 --- a/tests/data/test1486 +++ b/tests/data/test1486 @@ -10,10 +10,6 @@ docs # # Client-side <client> -<server> -none -</server> - <name> Verify that write-out.md and tool_writeout.c are in sync </name> diff --git a/tests/data/test1488 b/tests/data/test1488 index f5f23bf84..9b326ed13 100644 --- a/tests/data/test1488 +++ b/tests/data/test1488 @@ -10,10 +10,6 @@ manpages # # Client-side <client> -<server> -none -</server> - <name> symbols-in-versions and manpages agree on added-in versions </name> diff --git a/tests/data/test1508 b/tests/data/test1508 index 65345df7b..eb10b3619 100644 --- a/tests/data/test1508 +++ b/tests/data/test1508 @@ -8,9 +8,6 @@ multi # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1521 b/tests/data/test1521 index a6319e3f3..552f3b427 100644 --- a/tests/data/test1521 +++ b/tests/data/test1521 @@ -8,9 +8,6 @@ curl_easy_setopt # # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1530 b/tests/data/test1530 index 2475c1417..0a5995ff8 100644 --- a/tests/data/test1530 +++ b/tests/data/test1530 @@ -6,9 +6,6 @@ CURLOPT_OPENSOCKETFUNCTION </info> <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1537 b/tests/data/test1537 index 9e585b7a2..912a8c878 100644 --- a/tests/data/test1537 +++ b/tests/data/test1537 @@ -12,9 +12,6 @@ URL escape # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1538 b/tests/data/test1538 index 02f8bc431..bbae00f0e 100644 --- a/tests/data/test1538 +++ b/tests/data/test1538 @@ -13,9 +13,6 @@ verbose logs # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1544 b/tests/data/test1544 index 037caa0ac..3f95c90be 100644 --- a/tests/data/test1544 +++ b/tests/data/test1544 @@ -8,10 +8,6 @@ source analysis # # Client-side <client> -<server> -none -</server> - <name> Verify all string options are translated by OS/400 wrapper </name> diff --git a/tests/data/test1550 b/tests/data/test1550 index 8fd36f72e..f995ae80d 100644 --- a/tests/data/test1550 +++ b/tests/data/test1550 @@ -11,9 +11,6 @@ multi # Client-side <client> -<server> -none -</server> # tool is what to use instead of 'curl' <tool> lib%TESTNUMBER diff --git a/tests/data/test1557 b/tests/data/test1557 index 738a58dab..0c308f033 100644 --- a/tests/data/test1557 +++ b/tests/data/test1557 @@ -10,9 +10,6 @@ crash </reply> <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1558 b/tests/data/test1558 index 46332d198..2fe32f25e 100644 --- a/tests/data/test1558 +++ b/tests/data/test1558 @@ -10,9 +10,6 @@ CURLINFO_PROTOCOL </reply> <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test1559 b/tests/data/test1559 index 721703531..cf4b13d4a 100644 --- a/tests/data/test1559 +++ b/tests/data/test1559 @@ -10,9 +10,6 @@ verbose logs </reply> <client> -<server> -none -</server> # require HTTP so that CURLOPT_POSTFIELDS works as assumed <features> diff --git a/tests/data/test1560 b/tests/data/test1560 index ce8c7c42a..e7a82e1df 100644 --- a/tests/data/test1560 +++ b/tests/data/test1560 @@ -9,9 +9,6 @@ urlapi # # Client-side <client> -<server> -none -</server> <setenv> LC_ALL=C.UTF-8 </setenv> diff --git a/tests/data/test1564 b/tests/data/test1564 index e69067450..02e1d435c 100644 --- a/tests/data/test1564 +++ b/tests/data/test1564 @@ -15,9 +15,6 @@ wakeup <features> wakeup </features> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1592 b/tests/data/test1592 index 4dde49760..aacdb9ead 100644 --- a/tests/data/test1592 +++ b/tests/data/test1592 @@ -12,9 +12,6 @@ timing-dependent # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test1597 b/tests/data/test1597 index 0becf616c..ea66ef5eb 100644 --- a/tests/data/test1597 +++ b/tests/data/test1597 @@ -10,9 +10,6 @@ CURLOPT_PROTOCOLS_STR </reply> # Client-side <client> -<server> -none -</server> <name> CURLOPT_PROTOCOLS_STR </name> diff --git a/tests/data/test1600 b/tests/data/test1600 index 0705a0df3..61b0c68b1 100644 --- a/tests/data/test1600 +++ b/tests/data/test1600 @@ -9,9 +9,6 @@ NTLM # # Client-side <client> -<server> -none -</server> <features> unittest NTLM diff --git a/tests/data/test1601 b/tests/data/test1601 index 935f4e236..ca00e5b19 100644 --- a/tests/data/test1601 +++ b/tests/data/test1601 @@ -9,9 +9,6 @@ MD5 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1602 b/tests/data/test1602 index 546e8cbbd..7377b6d37 100644 --- a/tests/data/test1602 +++ b/tests/data/test1602 @@ -9,9 +9,6 @@ hash # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1603 b/tests/data/test1603 index 43cd3849d..01b435153 100644 --- a/tests/data/test1603 +++ b/tests/data/test1603 @@ -9,9 +9,6 @@ hash # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1604 b/tests/data/test1604 index 6fa7702f1..e3845c0f3 100644 --- a/tests/data/test1604 +++ b/tests/data/test1604 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1605 b/tests/data/test1605 index d97c85178..6b7fa414e 100644 --- a/tests/data/test1605 +++ b/tests/data/test1605 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1606 b/tests/data/test1606 index 99104def2..f4351bc02 100644 --- a/tests/data/test1606 +++ b/tests/data/test1606 @@ -9,9 +9,6 @@ speedcheck # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1607 b/tests/data/test1607 index 17f8a8159..4b6c264f2 100644 --- a/tests/data/test1607 +++ b/tests/data/test1607 @@ -9,9 +9,6 @@ CURLOPT_RESOLVE # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1608 b/tests/data/test1608 index c7d6a0a90..22b67ddcd 100644 --- a/tests/data/test1608 +++ b/tests/data/test1608 @@ -9,9 +9,6 @@ curlopt_dns_shuffle_addresses # # Client-side <client> -<server> -none -</server> <features> unittest shuffle-dns diff --git a/tests/data/test1609 b/tests/data/test1609 index 17f8a8159..4b6c264f2 100644 --- a/tests/data/test1609 +++ b/tests/data/test1609 @@ -9,9 +9,6 @@ CURLOPT_RESOLVE # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1610 b/tests/data/test1610 index 8ee68d43c..c58801e55 100644 --- a/tests/data/test1610 +++ b/tests/data/test1610 @@ -9,9 +9,6 @@ SHA256 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1611 b/tests/data/test1611 index ffd9de3cf..56d779fa4 100644 --- a/tests/data/test1611 +++ b/tests/data/test1611 @@ -9,9 +9,6 @@ MD4 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1612 b/tests/data/test1612 index e186a4a56..fecac63a7 100644 --- a/tests/data/test1612 +++ b/tests/data/test1612 @@ -9,9 +9,6 @@ HMAC # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1614 b/tests/data/test1614 index 2c4d6abe9..504d328fc 100644 --- a/tests/data/test1614 +++ b/tests/data/test1614 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest proxy diff --git a/tests/data/test1615 b/tests/data/test1615 index 8eb06792e..8e5173822 100644 --- a/tests/data/test1615 +++ b/tests/data/test1615 @@ -9,9 +9,6 @@ SHA-512/256 # # Client-side <client> -<server> -none -</server> <features> unittest sha512-256 diff --git a/tests/data/test1616 b/tests/data/test1616 index a203c95b0..a11ef46e1 100644 --- a/tests/data/test1616 +++ b/tests/data/test1616 @@ -9,9 +9,6 @@ uint_hash # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1620 b/tests/data/test1620 index 32f50994f..7b3d66450 100644 --- a/tests/data/test1620 +++ b/tests/data/test1620 @@ -9,9 +9,6 @@ URL # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1621 b/tests/data/test1621 index a93c07f02..334a7de8e 100644 --- a/tests/data/test1621 +++ b/tests/data/test1621 @@ -9,9 +9,6 @@ stripcredentials # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1650 b/tests/data/test1650 index b99001923..cbcd1c757 100644 --- a/tests/data/test1650 +++ b/tests/data/test1650 @@ -9,9 +9,6 @@ DOH # # Client-side <client> -<server> -none -</server> <features> unittest DoH diff --git a/tests/data/test1651 b/tests/data/test1651 index e7b725763..827f80027 100644 --- a/tests/data/test1651 +++ b/tests/data/test1651 @@ -9,9 +9,6 @@ x509 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1652 b/tests/data/test1652 index 678d19517..face77c98 100644 --- a/tests/data/test1652 +++ b/tests/data/test1652 @@ -7,9 +7,6 @@ infof </info> <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1653 b/tests/data/test1653 index fff7f6e56..a77598120 100644 --- a/tests/data/test1653 +++ b/tests/data/test1653 @@ -7,9 +7,6 @@ urlapi </info> <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1654 b/tests/data/test1654 index d7c1443bd..5659277ce 100644 --- a/tests/data/test1654 +++ b/tests/data/test1654 @@ -7,9 +7,6 @@ Alt-Svc </info> <client> -<server> -none -</server> <features> unittest alt-svc diff --git a/tests/data/test1655 b/tests/data/test1655 index b69b36a29..9057033b6 100644 --- a/tests/data/test1655 +++ b/tests/data/test1655 @@ -9,9 +9,6 @@ DOH # # Client-side <client> -<server> -none -</server> <features> unittest DoH diff --git a/tests/data/test1656 b/tests/data/test1656 index 2fab21be6..4d50d42b1 100644 --- a/tests/data/test1656 +++ b/tests/data/test1656 @@ -9,9 +9,6 @@ Curl_x509_GTime2str # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1657 b/tests/data/test1657 index 8e2a9c5a7..06dfd9cab 100644 --- a/tests/data/test1657 +++ b/tests/data/test1657 @@ -9,9 +9,6 @@ Curl_x509_getASN1Element # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1658 b/tests/data/test1658 index 96e247c32..c5a685ef9 100644 --- a/tests/data/test1658 +++ b/tests/data/test1658 @@ -10,9 +10,6 @@ httpsrr # # Client-side <client> -<server> -none -</server> <features> unittest DoH diff --git a/tests/data/test1660 b/tests/data/test1660 index 4b6f9615c..cc4022038 100644 --- a/tests/data/test1660 +++ b/tests/data/test1660 @@ -7,9 +7,6 @@ HSTS </info> <client> -<server> -none -</server> <features> unittest HSTS diff --git a/tests/data/test1661 b/tests/data/test1661 index 5a648e515..d9347128a 100644 --- a/tests/data/test1661 +++ b/tests/data/test1661 @@ -9,9 +9,6 @@ bufref # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1663 b/tests/data/test1663 index 160bfde3f..bb5615a7a 100644 --- a/tests/data/test1663 +++ b/tests/data/test1663 @@ -10,9 +10,6 @@ bind # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1664 b/tests/data/test1664 index 4d5379303..b36ef3597 100644 --- a/tests/data/test1664 +++ b/tests/data/test1664 @@ -9,9 +9,6 @@ strparse # # Client-side <client> -<server> -none -</server> <features> unittest large-size diff --git a/tests/data/test1705 b/tests/data/test1705 index 6736d928c..b56982ae4 100644 --- a/tests/data/test1705 +++ b/tests/data/test1705 @@ -10,9 +10,6 @@ managen # # Client-side <client> -<server> -none -</server> <name> managen makes manpage diff --git a/tests/data/test1706 b/tests/data/test1706 index ca121c446..6362678e9 100644 --- a/tests/data/test1706 +++ b/tests/data/test1706 @@ -10,9 +10,6 @@ managen # # Client-side <client> -<server> -none -</server> <name> managen makes ASCII page diff --git a/tests/data/test1707 b/tests/data/test1707 index f18749068..518a81300 100644 --- a/tests/data/test1707 +++ b/tests/data/test1707 @@ -11,9 +11,6 @@ curl <features> manual </features> -<server> -none -</server> <name> Verify curl -h --insecure diff --git a/tests/data/test1708 b/tests/data/test1708 index ab59e71fa..771c1a3c0 100644 --- a/tests/data/test1708 +++ b/tests/data/test1708 @@ -11,9 +11,6 @@ curl <features> manual </features> -<server> -none -</server> <name> Verify curl -h -F diff --git a/tests/data/test1709 b/tests/data/test1709 index efdc8a7d3..65fc51309 100644 --- a/tests/data/test1709 +++ b/tests/data/test1709 @@ -11,9 +11,6 @@ curl <features> manual </features> -<server> -none -</server> <name> Verify curl -h with bad option name diff --git a/tests/data/test1710 b/tests/data/test1710 index 7356355e4..e4114befc 100644 --- a/tests/data/test1710 +++ b/tests/data/test1710 @@ -11,9 +11,6 @@ curl <features> manual </features> -<server> -none -</server> <name> Verify curl -h --no-clobber diff --git a/tests/data/test19 b/tests/data/test19 index 659088831..40a5c2cb5 100644 --- a/tests/data/test19 +++ b/tests/data/test19 @@ -12,9 +12,6 @@ FAILURE # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test1900 b/tests/data/test1900 index f04e7e2af..ff8b79b1a 100644 --- a/tests/data/test1900 +++ b/tests/data/test1900 @@ -16,9 +16,6 @@ HSTS HSTS http </features> -<server> -none -</server> <name> HSTS curl_easy_duphandle diff --git a/tests/data/test1911 b/tests/data/test1911 index 07e87a64c..179163082 100644 --- a/tests/data/test1911 +++ b/tests/data/test1911 @@ -11,9 +11,6 @@ curl_easy_option # Client-side <client> -<server> -none -</server> <name> verify that curl_easy_setopt() rejects too long string inputs </name> diff --git a/tests/data/test1912 b/tests/data/test1912 index 85dca0d6b..6fe6a8bd1 100644 --- a/tests/data/test1912 +++ b/tests/data/test1912 @@ -12,9 +12,6 @@ typecheck # Client-side <client> -<server> -none -</server> <name> Cross validate that gcc-typecheck macros match the option types. </name> diff --git a/tests/data/test1915 b/tests/data/test1915 index 34a2881ef..304325931 100644 --- a/tests/data/test1915 +++ b/tests/data/test1915 @@ -17,9 +17,6 @@ CURLOPT_HSTSREADFUNCTION HSTS http </features> -<server> -none -</server> <name> HSTS read/write callbacks diff --git a/tests/data/test1918 b/tests/data/test1918 index e9fe44140..1018ffa0d 100644 --- a/tests/data/test1918 +++ b/tests/data/test1918 @@ -13,9 +13,6 @@ curl_easy_option_by_id # Client-side <client> -<server> -none -</server> <name> curl_easy_option_by_name() and curl_easy_option_by_id() </name> diff --git a/tests/data/test1979 b/tests/data/test1979 index 3cff1314d..0dac5219d 100644 --- a/tests/data/test1979 +++ b/tests/data/test1979 @@ -10,9 +10,6 @@ aws-sigv4 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test1980 b/tests/data/test1980 index 4ac36377f..1ee3cf4d8 100644 --- a/tests/data/test1980 +++ b/tests/data/test1980 @@ -10,9 +10,6 @@ aws-sigv4 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test20 b/tests/data/test20 index 31bdd7180..a84928a2d 100644 --- a/tests/data/test20 +++ b/tests/data/test20 @@ -13,9 +13,6 @@ non-existing host # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test2043 b/tests/data/test2043 index eb4387667..e3174b2a7 100644 --- a/tests/data/test2043 +++ b/tests/data/test2043 @@ -12,9 +12,6 @@ HTTP GET <features> Schannel </features> -<server> -none -</server> <name> Disable certificate revocation checks </name> diff --git a/tests/data/test2044 b/tests/data/test2044 index 33e81a8d9..209cc5e85 100644 --- a/tests/data/test2044 +++ b/tests/data/test2044 @@ -8,12 +8,6 @@ # # Client-side <client> -<features> -none -</features> -<server> -none -</server> <name> Attempt to set a default protocol that does not exist </name> diff --git a/tests/data/test2045 b/tests/data/test2045 index 15647d3e7..41b31e540 100644 --- a/tests/data/test2045 +++ b/tests/data/test2045 @@ -29,9 +29,6 @@ REPLY welcome HTTP/1.1 200 OK\r\nContent-Length: 21\r\n\r\n500 Weird FTP Reply # # Client-side <client> -<features> -none -</features> <server> ftp </server> diff --git a/tests/data/test2075 b/tests/data/test2075 index 88db7ae29..57228109a 100644 --- a/tests/data/test2075 +++ b/tests/data/test2075 @@ -12,9 +12,6 @@ HTTP <features> http </features> -<server> -none -</server> <name> Verify usernames are not allowed in url </name> diff --git a/tests/data/test2080 b/tests/data/test2080 index 28d3c6b21..d49bd5c45 100644 --- a/tests/data/test2080 +++ b/tests/data/test2080 @@ -14,9 +14,6 @@ config # # Client-side <client> -<server> -none -</server> <name> config file with overly long option </name> diff --git a/tests/data/test219 b/tests/data/test219 index d597478b6..0bdca5a9d 100644 --- a/tests/data/test219 +++ b/tests/data/test219 @@ -14,9 +14,6 @@ unsupported scheme # # Client-side <client> -<server> -none -</server> <features> http proxy diff --git a/tests/data/test2600 b/tests/data/test2600 index 0b4ee8b2f..eb8c6538c 100644 --- a/tests/data/test2600 +++ b/tests/data/test2600 @@ -10,9 +10,6 @@ timing-dependent # # Client-side <client> -<server> -none -</server> <features> unittest Debug diff --git a/tests/data/test2601 b/tests/data/test2601 index a6581a803..f601f0309 100644 --- a/tests/data/test2601 +++ b/tests/data/test2601 @@ -9,9 +9,6 @@ bufq # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test2602 b/tests/data/test2602 index 798cd02c0..17f5414cf 100644 --- a/tests/data/test2602 +++ b/tests/data/test2602 @@ -9,9 +9,6 @@ dynhds # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test2603 b/tests/data/test2603 index c8845bb2e..95d5e9bf4 100644 --- a/tests/data/test2603 +++ b/tests/data/test2603 @@ -9,9 +9,6 @@ http1 # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test2604 b/tests/data/test2604 index 4e825aa27..a78851fa8 100644 --- a/tests/data/test2604 +++ b/tests/data/test2604 @@ -8,9 +8,6 @@ unittest # # Client-side <client> -<server> -none -</server> <features> unittest sftp diff --git a/tests/data/test288 b/tests/data/test288 index a341df61f..6ca82a4c8 100644 --- a/tests/data/test288 +++ b/tests/data/test288 @@ -18,9 +18,6 @@ moo # Client-side <client> -<server> -none -</server> <features> file </features> diff --git a/tests/data/test3026 b/tests/data/test3026 index 08d74c4d9..0be9f290b 100644 --- a/tests/data/test3026 +++ b/tests/data/test3026 @@ -21,9 +21,6 @@ slow threadsafe threaded-resolver </features> -<server> -none -</server> <name> curl_global_init thread-safety </name> diff --git a/tests/data/test3105 b/tests/data/test3105 index c06caa647..543d52e43 100644 --- a/tests/data/test3105 +++ b/tests/data/test3105 @@ -9,9 +9,6 @@ curl_multi_remove_handle # # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test3200 b/tests/data/test3200 index b2206fef3..f1f8e4936 100644 --- a/tests/data/test3200 +++ b/tests/data/test3200 @@ -9,9 +9,6 @@ curl_get_line # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test3205 b/tests/data/test3205 index 3a26cd6d8..58b3a189f 100644 --- a/tests/data/test3205 +++ b/tests/data/test3205 @@ -9,9 +9,6 @@ cipher_suite # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test3211 b/tests/data/test3211 index bc5c765b9..95f71986e 100644 --- a/tests/data/test3211 +++ b/tests/data/test3211 @@ -9,9 +9,6 @@ uint_bset # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test3212 b/tests/data/test3212 index bc5c765b9..95f71986e 100644 --- a/tests/data/test3212 +++ b/tests/data/test3212 @@ -9,9 +9,6 @@ uint_bset # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test3213 b/tests/data/test3213 index 1eb1b9da4..20e3d64d5 100644 --- a/tests/data/test3213 +++ b/tests/data/test3213 @@ -9,9 +9,6 @@ uint_spbset # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test3214 b/tests/data/test3214 index 626548e51..c114cf562 100644 --- a/tests/data/test3214 +++ b/tests/data/test3214 @@ -9,9 +9,6 @@ size # # Client-side <client> -<server> -none -</server> <features> unittest </features> diff --git a/tests/data/test333 b/tests/data/test333 index 690e40759..ee71f0f0e 100644 --- a/tests/data/test333 +++ b/tests/data/test333 @@ -13,9 +13,6 @@ cmdline # # Client-side <client> -<server> -none -</server> <name> Try a non-boolean command line option with --no- </name> diff --git a/tests/data/test370 b/tests/data/test370 index 671e35f63..05be53b96 100644 --- a/tests/data/test370 +++ b/tests/data/test370 @@ -15,9 +15,6 @@ etag # # Client-side <client> -<server> -none -</server> <name> --etag-save with bad path - no transfer </name> diff --git a/tests/data/test375 b/tests/data/test375 index aefc8e4ac..a054c658b 100644 --- a/tests/data/test375 +++ b/tests/data/test375 @@ -9,9 +9,6 @@ CURL_DISABLE_PROXY <features> !proxy </features> -<server> -none -</server> <name> Disabled proxy should make curl fail with --proxy </name> diff --git a/tests/data/test378 b/tests/data/test378 index ef77225be..9777b878b 100644 --- a/tests/data/test378 +++ b/tests/data/test378 @@ -14,9 +14,6 @@ HTTP POST # # Client-side <client> -<server> -none -</server> <name> Reject using -T and -d at once </name> diff --git a/tests/data/test411 b/tests/data/test411 index cdfdd46b4..e225aac33 100644 --- a/tests/data/test411 +++ b/tests/data/test411 @@ -13,9 +13,6 @@ # # Client-side <client> -<server> -none -</server> <name> -K with missing file causes error </name> diff --git a/tests/data/test422 b/tests/data/test422 index 2caaa4915..db7ebe1b9 100644 --- a/tests/data/test422 +++ b/tests/data/test422 @@ -14,9 +14,6 @@ cmdline # # Client-side <client> -<server> -none -</server> <name> use --next with missing URL before it </name> diff --git a/tests/data/test460 b/tests/data/test460 index 824166a81..3b61958f6 100644 --- a/tests/data/test460 +++ b/tests/data/test460 @@ -8,9 +8,6 @@ expand # Client-side <client> -<server> -none -</server> <name> try --expand without an argument </name> diff --git a/tests/data/test462 b/tests/data/test462 index 24c414ef3..fdbce3b46 100644 --- a/tests/data/test462 +++ b/tests/data/test462 @@ -14,9 +14,6 @@ variables # # Client-side <client> -<server> -none -</server> <name> Missing environment variables in config file </name> diff --git a/tests/data/test467 b/tests/data/test467 index 45a6d6e84..ebf40d874 100644 --- a/tests/data/test467 +++ b/tests/data/test467 @@ -8,9 +8,6 @@ cmdline # # Client-side <client> -<server> -none -</server> <name> use a bad short option letter that does not exist (after one does exist) </name> diff --git a/tests/data/test469 b/tests/data/test469 index 1e394c9f2..87754a264 100644 --- a/tests/data/test469 +++ b/tests/data/test469 @@ -45,8 +45,8 @@ warn about Unicode quote character # Verify data after the test has been "shot" <verify> <stderr> -%hex[Warning: The argument '%e2%80%9chost:' starts with a Unicode quote where maybe an ]hex% -Warning: ASCII " was intended? +%hex[Warning: The argument '%e2%80%9chost:' starts with a Unicode character. Maybe ASCII ]hex% +Warning: was intended? </stderr> </verify> </testcase> diff --git a/tests/data/test470 b/tests/data/test470 index 5667bbb59..547121d11 100644 --- a/tests/data/test470 +++ b/tests/data/test470 @@ -45,8 +45,8 @@ warn about Unicode quote character read from config file # Verify data after the test has been "shot" <verify> <stderr mode="text"> -%hex[Warning: The argument '%e2%80%9chost:fake%e2%80%9d' starts with a Unicode quote where ]hex% -Warning: maybe an ASCII " was intended? +%hex[Warning: The argument '%e2%80%9chost:fake%e2%80%9d' starts with a Unicode character. Maybe ]hex% +Warning: ASCII was intended? </stderr> </verify> </testcase> diff --git a/tests/data/test484 b/tests/data/test484 index 3850ce4df..1335e638f 100644 --- a/tests/data/test484 +++ b/tests/data/test484 @@ -14,9 +14,6 @@ etag # # Client-side <client> -<server> -none -</server> <name> Use --etag-compare and -save with more than one URL </name> diff --git a/tests/data/test485 b/tests/data/test485 index 01761e956..f1169dc89 100644 --- a/tests/data/test485 +++ b/tests/data/test485 @@ -14,9 +14,6 @@ etag # # Client-side <client> -<server> -none -</server> <name> Use --etag-compare and -save with more than one URL, URLs specified first </name> diff --git a/tests/data/test496 b/tests/data/test496 index aa729c66a..5cb0c8df7 100644 --- a/tests/data/test496 +++ b/tests/data/test496 @@ -15,9 +15,6 @@ parallel # # Client-side <client> -<server> -none -</server> <name> parallel upload missing file </name> diff --git a/tests/data/test501 b/tests/data/test501 index 3661351ea..b2b06bdba 100644 --- a/tests/data/test501 +++ b/tests/data/test501 @@ -11,9 +11,6 @@ missing URL # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test504 b/tests/data/test504 index 02196a3d0..fecab8d44 100644 --- a/tests/data/test504 +++ b/tests/data/test504 @@ -16,9 +16,6 @@ connect to non-listen # Client-side <client> -<server> -none -</server> <features> http proxy diff --git a/tests/data/test509 b/tests/data/test509 index 4990f3738..4c2d8274a 100644 --- a/tests/data/test509 +++ b/tests/data/test509 @@ -11,9 +11,6 @@ memory callbacks # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test517 b/tests/data/test517 index fb57f4a4b..859e54f31 100644 --- a/tests/data/test517 +++ b/tests/data/test517 @@ -12,9 +12,6 @@ unittest # Client-side <client> -<server> -none -</server> # tool is what to use instead of 'curl' <tool> lib%TESTNUMBER diff --git a/tests/data/test543 b/tests/data/test543 index 2ec9ff863..c9a5a2139 100644 --- a/tests/data/test543 +++ b/tests/data/test543 @@ -8,9 +8,6 @@ curl_easy_escape # Client-side <client> -<server> -none -</server> <tool> lib%TESTNUMBER </tool> diff --git a/tests/data/test557 b/tests/data/test557 index 08394d229..b251a4b31 100644 --- a/tests/data/test557 +++ b/tests/data/test557 @@ -12,9 +12,6 @@ unittest # Client-side <client> -<server> -none -</server> # tool is what to use instead of 'curl' <tool> lib%TESTNUMBER diff --git a/tests/data/test558 b/tests/data/test558 index 2dcf270bf..359d690cf 100644 --- a/tests/data/test558 +++ b/tests/data/test558 @@ -12,9 +12,6 @@ TrackMemory # Client-side <client> -<server> -none -</server> <features> TrackMemory IPv6 diff --git a/tests/data/test632 b/tests/data/test632 index c89a8c715..c11ac301d 100644 --- a/tests/data/test632 +++ b/tests/data/test632 @@ -10,9 +10,6 @@ server key check # # Client-side <client> -<server> -none -</server> <features> sftp </features> diff --git a/tests/data/test680 b/tests/data/test680 index 5ea3eaa64..ab8794b99 100644 --- a/tests/data/test680 +++ b/tests/data/test680 @@ -13,9 +13,6 @@ netrc # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test686 b/tests/data/test686 index 6189d7a17..34186a80f 100644 --- a/tests/data/test686 +++ b/tests/data/test686 @@ -13,9 +13,6 @@ errorcode # # Client-side <client> -<server> -none -</server> <name> verify return code for missing URL after --next </name> diff --git a/tests/data/test697 b/tests/data/test697 index 5b9776169..f1958e83e 100644 --- a/tests/data/test697 +++ b/tests/data/test697 @@ -13,9 +13,6 @@ netrc # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test745 b/tests/data/test745 index 9761dd5d0..1ca5d9b6e 100644 --- a/tests/data/test745 +++ b/tests/data/test745 @@ -9,9 +9,6 @@ symbols-in-versions # # Client-side <client> -<server> -none -</server> <name> Verify that typecheck-gcc and curl.h are in sync diff --git a/tests/data/test746 b/tests/data/test746 index ef7a46082..a09e10edc 100644 --- a/tests/data/test746 +++ b/tests/data/test746 @@ -8,9 +8,6 @@ cmdline # # Client-side <client> -<server> -none -</server> <name> too large numerical value passed to -m </name> diff --git a/tests/data/test748 b/tests/data/test748 index 7172b7eb4..de7df714a 100644 --- a/tests/data/test748 +++ b/tests/data/test748 @@ -14,9 +14,6 @@ # Client-side <client> -<server> -none -</server> <name> A --config file that uses -h and no URL </name> diff --git a/tests/data/test75 b/tests/data/test75 index dc8b49979..3aa416a5b 100644 --- a/tests/data/test75 +++ b/tests/data/test75 @@ -15,9 +15,6 @@ FAILURE # # Client-side <client> -<server> -none -</server> <features> http </features> diff --git a/tests/data/test751 b/tests/data/test751 index 49c6b67b1..dde1116d4 100644 --- a/tests/data/test751 +++ b/tests/data/test751 @@ -11,9 +11,6 @@ MULTI # Client-side <client> -<server> -none -</server> # tool is what to use instead of 'curl' <tool> lib%TESTNUMBER diff --git a/tests/data/test759 b/tests/data/test759 index 755236599..1c97653d7 100644 --- a/tests/data/test759 +++ b/tests/data/test759 @@ -8,9 +8,6 @@ globbing # # Client-side <client> -<server> -none -</server> <name> glob '{,' </name> diff --git a/tests/data/test760 b/tests/data/test760 index ae84f1069..27477d6b5 100644 --- a/tests/data/test760 +++ b/tests/data/test760 @@ -8,9 +8,6 @@ globbing # # Client-side <client> -<server> -none -</server> <name> more cmdline options than URLs and --next </name> diff --git a/tests/data/test761 b/tests/data/test761 index 55005c462..3044e1e54 100644 --- a/tests/data/test761 +++ b/tests/data/test761 @@ -8,9 +8,6 @@ globbing # # Client-side <client> -<server> -none -</server> <name> too many {} globs </name> diff --git a/tests/data/test763 b/tests/data/test763 new file mode 100644 index 000000000..75059ef32 --- /dev/null +++ b/tests/data/test763 @@ -0,0 +1,29 @@ +<testcase> +<info> +<keywords> +IDN +</keywords> +</info> + +<client> +<features> +IDN +!AppleIDN +</features> +<name> +Unicode hostname ending up in a blank name +</name> +# e2 80 8b - ZERO WIDTH SPACE +# e2 80 8c - ZERO WIDTH NON-JOINER +<command> +%hex['%e2%80%8b%e2%80%8c']hex% +</command> +</client> + +<verify> +# curl: (3) URL using bad/illegal format or missing URL +<errorcode> +3 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test795 b/tests/data/test795 index 5eeb5b7d8..2c98b3bcc 100644 --- a/tests/data/test795 +++ b/tests/data/test795 @@ -16,9 +16,6 @@ Debug <name> Delayed resolve --connect-timeout check </name> -<server> -none -</server> <setenv> CURL_DNS_DELAY_MS=5000 </setenv> diff --git a/tests/data/test96 b/tests/data/test96 index 4efc3491a..a96b61762 100644 --- a/tests/data/test96 +++ b/tests/data/test96 @@ -12,9 +12,6 @@ TrackMemory # Client-side <client> -<server> -none -</server> <features> TrackMemory </features> diff --git a/tests/data/test971 b/tests/data/test971 index 3f11bbc37..b86530ee8 100644 --- a/tests/data/test971 +++ b/tests/data/test971 @@ -9,10 +9,6 @@ options-in-versions # # Client-side <client> -<server> -none -</server> - <name> Verify that options-in-versions and docs/cmdline-opts are in sync </name> diff --git a/tests/http/scorecard.py b/tests/http/scorecard.py index d6ff5dbfd..9c5417f1b 100644 --- a/tests/http/scorecard.py +++ b/tests/http/scorecard.py @@ -61,7 +61,14 @@ class Card: @classmethod def fmt_mbs(cls, val): - return f'{val/(1024*1024):0.000f} MB/s' if val >= 0 else '--' + if val is None or val < 0: + return '--' + if val >= (1024*1024): + return f'{val/(1024*1024):0.000f} MB/s' + elif val >= 1024: + return f'{val / 1024:0.000f} KB/s' + else: + return f'{val:0.000f} B/s' @classmethod def fmt_reqs(cls, val): @@ -119,6 +126,8 @@ class Card: print(f'Version: {score["meta"]["curl_V"]}') if 'curl_features' in score["meta"]: print(f'Features: {score["meta"]["curl_features"]}') + if 'limit-rate' in score['meta']: + print(f'--limit-rate: {score["meta"]["limit-rate"]}') print(f'Samples Size: {score["meta"]["samples"]}') if 'handshakes' in score: print(f'{"Handshakes":<24} {"ipv4":25} {"ipv6":28}') @@ -188,7 +197,8 @@ class ScoreRunner: server_addr: Optional[str] = None, with_dtrace: bool = False, with_flame: bool = False, - socks_args: Optional[List[str]] = None): + socks_args: Optional[List[str]] = None, + limit_rate: Optional[str] = None): self.verbose = verbose self.env = env self.protocol = protocol @@ -200,6 +210,7 @@ class ScoreRunner: self._with_dtrace = with_dtrace self._with_flame = with_flame self._socks_args = socks_args + self._limit_rate = limit_rate def info(self, msg): if self.verbose > 0: @@ -289,7 +300,8 @@ class ScoreRunner: curl = self.mk_curl_client() r = curl.http_download(urls=[url], alpn_proto=self.protocol, no_save=True, with_headers=False, - with_profile=True) + with_profile=True, + limit_rate=self._limit_rate) err = self._check_downloads(r, count) if err: errors.append(err) @@ -309,7 +321,9 @@ class ScoreRunner: curl = self.mk_curl_client() r = curl.http_download(urls=[url], alpn_proto=self.protocol, no_save=True, - with_headers=False, with_profile=True) + with_headers=False, + with_profile=True, + limit_rate=self._limit_rate) err = self._check_downloads(r, count) if err: errors.append(err) @@ -332,6 +346,7 @@ class ScoreRunner: no_save=True, with_headers=False, with_profile=True, + limit_rate=self._limit_rate, extra_args=[ '--parallel', '--parallel-max', str(max_parallel) @@ -582,6 +597,9 @@ class ScoreRunner: 'date': f'{datetime.datetime.now(tz=datetime.timezone.utc).isoformat()}', } } + if self._limit_rate: + score['meta']['limit-rate'] = self._limit_rate + if self.protocol == 'h3': score['meta']['protocol'] = 'h3' if not self.env.have_h3_curl(): @@ -710,7 +728,8 @@ def run_score(args, protocol): download_parallel=args.download_parallel, with_dtrace=args.dtrace, with_flame=args.flame, - socks_args=socks_args) + socks_args=socks_args, + limit_rate=args.limit_rate) cards.append(card) if test_httpd: @@ -737,7 +756,8 @@ def run_score(args, protocol): download_parallel=args.download_parallel, with_dtrace=args.dtrace, with_flame=args.flame, - socks_args=socks_args) + socks_args=socks_args, + limit_rate=args.limit_rate) card.setup_resources(server_docs, downloads) cards.append(card) @@ -763,7 +783,8 @@ def run_score(args, protocol): verbose=args.verbose, curl_verbose=args.curl_verbose, download_parallel=args.download_parallel, with_dtrace=args.dtrace, - socks_args=socks_args) + socks_args=socks_args, + limit_rate=args.limit_rate) card.setup_resources(server_docs, downloads) cards.append(card) @@ -847,6 +868,8 @@ def main(): default = False, help="produce dtrace of curl") parser.add_argument("--flame", action='store_true', default = False, help="produce a flame graph on curl, implies --dtrace") + parser.add_argument("--limit-rate", action='store', type=str, + default=None, help="use curl's --limit-rate") parser.add_argument("-H", "--handshakes", action='store_true', default=False, help="evaluate handshakes only") diff --git a/tests/http/test_30_vsftpd.py b/tests/http/test_30_vsftpd.py index c6193c2c7..5f294fdfc 100644 --- a/tests/http/test_30_vsftpd.py +++ b/tests/http/test_30_vsftpd.py @@ -215,6 +215,13 @@ class TestVsFTPD: r.check_stats(count=count, http_status=226) self.check_upload(env, vsftpd, docname=docname, binary=False) + def test_30_11_download_non_existing(self, env: Env, vsftpd: VsFTPD): + curl = CurlClient(env=env) + url = f'ftp://{env.ftp_domain}:{vsftpd.port}/does-not-exist' + r = curl.ftp_get(urls=[url], with_stats=True) + r.check_exit_code(78) + r.check_stats(count=1, exitcode=78) + def check_downloads(self, client, srcfile: str, count: int, complete: bool = True): for i in range(count): diff --git a/tests/http/test_31_vsftpds.py b/tests/http/test_31_vsftpds.py index 63f4b695d..a3a9e66ca 100644 --- a/tests/http/test_31_vsftpds.py +++ b/tests/http/test_31_vsftpds.py @@ -246,6 +246,13 @@ class TestVsFTPD: expdata = [indata] if len(indata) else [] assert expdata == destdata, f'expected: {expdata}, got: {destdata}' + def test_31_11_download_non_existing(self, env: Env, vsftpds: VsFTPD): + curl = CurlClient(env=env) + url = f'ftp://{env.ftp_domain}:{vsftpds.port}/does-not-exist' + r = curl.ftp_ssl_get(urls=[url], with_stats=True) + r.check_exit_code(78) + r.check_stats(count=1, exitcode=78) + def check_downloads(self, client, srcfile: str, count: int, complete: bool = True): for i in range(count): diff --git a/tests/http/test_32_ftps_vsftpd.py b/tests/http/test_32_ftps_vsftpd.py index f6c55f5fc..4a2861224 100644 --- a/tests/http/test_32_ftps_vsftpd.py +++ b/tests/http/test_32_ftps_vsftpd.py @@ -258,6 +258,13 @@ class TestFtpsVsFTPD: expdata = [indata] if len(indata) else [] assert expdata == destdata, f'expected: {expdata}, got: {destdata}' + def test_32_11_download_non_existing(self, env: Env, vsftpds: VsFTPD): + curl = CurlClient(env=env) + url = f'ftps://{env.ftp_domain}:{vsftpds.port}/does-not-exist' + r = curl.ftp_get(urls=[url], with_stats=True) + r.check_exit_code(78) + r.check_stats(count=1, exitcode=78) + def check_downloads(self, client, srcfile: str, count: int, complete: bool = True): for i in range(count): diff --git a/tests/http/testenv/curl.py b/tests/http/testenv/curl.py index 26d2dd716..7c3f6e72d 100644 --- a/tests/http/testenv/curl.py +++ b/tests/http/testenv/curl.py @@ -582,17 +582,16 @@ class CurlClient: with_profile: bool = False, with_tcpdump: bool = False, no_save: bool = False, + limit_rate: Optional[str] = None, extra_args: Optional[List[str]] = None): if extra_args is None: extra_args = [] if no_save: - extra_args.extend([ - '--out-null', - ]) + extra_args.extend(['--out-null']) else: - extra_args.extend([ - '-o', 'download_#1.data', - ]) + extra_args.extend(['-o', 'download_#1.data']) + if limit_rate: + extra_args.extend(['--limit-rate', limit_rate]) # remove any existing ones for i in range(100): self._rmf(self.download_file(i)) diff --git a/tests/libtest/cli_h2_serverpush.c b/tests/libtest/cli_h2_serverpush.c index a58f38dd0..7b465bc61 100644 --- a/tests/libtest/cli_h2_serverpush.c +++ b/tests/libtest/cli_h2_serverpush.c @@ -68,7 +68,7 @@ static int server_push_callback(CURL *parent, static unsigned int count = 0; int rv; - (void)parent; /* we have no use for this */ + (void)parent; curl_msnprintf(filename, sizeof(filename) - 1, "push%u", count++); /* here's a new stream, save it in a new file for each new push */ diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c index 6e6287dbf..dd80163d4 100644 --- a/tests/libtest/lib1512.c +++ b/tests/libtest/lib1512.c @@ -42,7 +42,7 @@ static CURLcode test_lib1512(const char *URL) struct curl_slist *slist = NULL; size_t i; char target_url[256]; - (void)URL; /* URL is setup in the code */ + (void)URL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { curl_mfprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib1533.c b/tests/libtest/lib1533.c index 15256deaf..ff5c83cc8 100644 --- a/tests/libtest/lib1533.c +++ b/tests/libtest/lib1533.c @@ -77,7 +77,6 @@ static size_t t1533_write_cb(char *ptr, size_t size, size_t nmemb, void *userp) struct cb_data *data = (struct cb_data *)userp; size_t totalsize = nmemb * size; - /* unused parameter */ (void)ptr; /* all response headers have been received */ diff --git a/tests/libtest/lib1537.c b/tests/libtest/lib1537.c index 52272cb2e..cb35fb190 100644 --- a/tests/libtest/lib1537.c +++ b/tests/libtest/lib1537.c @@ -35,7 +35,7 @@ static CURLcode test_lib1537(const char *URL) int outlen = 0; char *raw; - (void)URL; /* we don't use this */ + (void)URL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { curl_mfprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib1550.c b/tests/libtest/lib1550.c index 6fedbf688..11583aec4 100644 --- a/tests/libtest/lib1550.c +++ b/tests/libtest/lib1550.c @@ -38,7 +38,7 @@ static CURLcode test_lib1550(const char *URL) global_init(CURL_GLOBAL_ALL); handle = curl_multi_init(); - (void)URL; /* unused */ + (void)URL; curl_multi_setopt(handle, CURLMOPT_PIPELINING_SERVER_BL, bl_servers); curl_multi_setopt(handle, CURLMOPT_PIPELINING_SITE_BL, bl_sites); diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 99112389f..1973d8a91 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -2036,7 +2036,7 @@ static CURLcode test_lib1560(const char *URL) { bool has_utf8 = !!getenv("CURL_TEST_HAVE_CODESET_UTF8"); - (void)URL; /* not used */ + (void)URL; if(urldup()) return (CURLcode)11; diff --git a/tests/libtest/lib1971.c b/tests/libtest/lib1971.c index 03b254c1c..bc25226bd 100644 --- a/tests/libtest/lib1971.c +++ b/tests/libtest/lib1971.c @@ -27,10 +27,10 @@ static size_t t1971_read_cb(char *ptr, size_t size, size_t nitems, void *userp) { - (void)ptr; /* unused */ - (void)size; /* unused */ - (void)nitems; /* unused */ - (void)userp; /* unused */ + (void)ptr; + (void)size; + (void)nitems; + (void)userp; return 0; } diff --git a/tests/libtest/lib1975.c b/tests/libtest/lib1975.c index 95db9ae58..d6c05a125 100644 --- a/tests/libtest/lib1975.c +++ b/tests/libtest/lib1975.c @@ -27,10 +27,10 @@ static size_t t1975_read_cb(char *ptr, size_t size, size_t nitems, void *userp) { - (void)ptr; /* unused */ - (void)size; /* unused */ - (void)nitems; /* unused */ - (void)userp; /* unused */ + (void)ptr; + (void)size; + (void)nitems; + (void)userp; return 0; } diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c index d32e4397b..d761c8a63 100644 --- a/tests/libtest/lib501.c +++ b/tests/libtest/lib501.c @@ -30,7 +30,7 @@ static CURLcode test_lib501(const char *URL) CURLcode res; CURL *curl; - (void)URL; /* we don't use this */ + (void)URL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { curl_mfprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c index cf1a14d31..85950dd86 100644 --- a/tests/libtest/lib517.c +++ b/tests/libtest/lib517.c @@ -164,7 +164,7 @@ static CURLcode test_lib517(const char *URL) int i; int error = 0; - (void)URL; /* not used */ + (void)URL; for(i = 0; dates[i].input; i++) { time_t out = curl_getdate(dates[i].input, NULL); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index e6fe6ceff..7d8cc3cbc 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -136,8 +136,8 @@ static int t530_curlSocketCallback(CURL *easy, curl_socket_t s, int action, { struct t530_ReadWriteSockets *sockets = userp; - (void)easy; /* unused */ - (void)socketp; /* unused */ + (void)easy; + (void)socketp; t530_ctx.socket_calls++; t530_msg("-> CURLMOPT_SOCKETFUNCTION"); @@ -169,7 +169,7 @@ static int t530_curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) { struct curltime *timeout = userp; - (void)multi; /* unused */ + (void)multi; t530_ctx.timer_calls++; t530_msg("-> CURLMOPT_TIMERFUNCTION"); if(t530_ctx.timer_calls == t530_ctx.max_timer_calls) { diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index e3597d6d3..6114d57aa 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -56,7 +56,7 @@ static size_t t547_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp) static curlioerr t547_ioctl_callback(CURL *handle, int cmd, void *clientp) { int *counter = (int *)clientp; - (void)handle; /* unused */ + (void)handle; if(cmd == CURLIOCMD_RESTARTREAD) { curl_mfprintf(stderr, "REWIND!\n"); *counter = 0; /* clear counter to make the read callback restart */ diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index 30438bafa..fe3b69211 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -60,7 +60,7 @@ static size_t t555_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp) static curlioerr t555_ioctl_callback(CURL *handle, int cmd, void *clientp) { int *counter = (int *)clientp; - (void)handle; /* unused */ + (void)handle; if(cmd == CURLIOCMD_RESTARTREAD) { curl_mfprintf(stderr, "REWIND!\n"); *counter = 0; /* clear counter to make the read callback restart */ diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index 61b051a43..9742272a4 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -1222,7 +1222,6 @@ static int test_width_precision(void) } - static int test_weird_arguments(void) { int errors = 0; @@ -1535,7 +1534,7 @@ static int test_return_codes(void) static CURLcode test_lib557(const char *URL) { int errors = 0; - (void)URL; /* not used */ + (void)URL; #ifdef HAVE_SETLOCALE /* diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c index 795a0b74b..c82b6ee96 100644 --- a/tests/libtest/lib558.c +++ b/tests/libtest/lib558.c @@ -33,7 +33,7 @@ static CURLcode test_lib558(const char *URL) char *ptr = NULL; int asize; - (void)URL; /* we don't use this */ + (void)URL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { curl_mfprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c index 5b46c8e62..a15c9a4f8 100644 --- a/tests/libtest/lib578.c +++ b/tests/libtest/lib578.c @@ -35,9 +35,9 @@ static int t578_progress_callback(void *clientp, double dltotal, double dlnow, { FILE *moo = fopen(libtest_arg2, "wb"); - (void)clientp; /* UNUSED */ - (void)dltotal; /* UNUSED */ - (void)dlnow; /* UNUSED */ + (void)clientp; + (void)dltotal; + (void)dlnow; if(moo) { if((size_t)ultotal == data_size && (size_t)ulnow == data_size) diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index 4f6b67e54..76ecefe4e 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -48,9 +48,9 @@ static void progress_final_report(void) static int t579_progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { - (void)clientp; /* UNUSED */ - (void)dltotal; /* UNUSED */ - (void)dlnow; /* UNUSED */ + (void)clientp; + (void)dltotal; + (void)dlnow; if(started && ulnow <= 0.0 && last_ul) { progress_final_report(); diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index 8ca87d459..70a9ab65d 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -97,8 +97,8 @@ static int t582_curlSocketCallback(CURL *easy, curl_socket_t s, int action, { struct t582_ReadWriteSockets *sockets = userp; - (void)easy; /* unused */ - (void)socketp; /* unused */ + (void)easy; + (void)socketp; if(action == CURL_POLL_IN || action == CURL_POLL_INOUT) t582_addFd(&sockets->read, s, "read"); @@ -121,7 +121,7 @@ static int t582_curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) { struct curltime *timeout = userp; - (void)multi; /* unused */ + (void)multi; if(timeout_ms != -1) { *timeout = curlx_now(); timeout->tv_usec += (int)timeout_ms * 1000; diff --git a/tests/libtest/lib668.c b/tests/libtest/lib668.c index 219fb8b15..87cf19bbe 100644 --- a/tests/libtest/lib668.c +++ b/tests/libtest/lib668.c @@ -35,7 +35,7 @@ static size_t t668_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) struct t668_WriteThis *pooh = (struct t668_WriteThis *)userp; size_t len = strlen(pooh->readptr); - (void)size; /* Always 1.*/ + (void)size; /* Always 1 */ if(len > nmemb) len = nmemb; diff --git a/tests/libtest/lib758.c b/tests/libtest/lib758.c index f98309f24..e9fe4ea2c 100644 --- a/tests/libtest/lib758.c +++ b/tests/libtest/lib758.c @@ -184,7 +184,7 @@ static int t758_curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) { struct curltime *timeout = userp; - (void)multi; /* unused */ + (void)multi; t758_ctx.timer_calls++; t758_msg("-> CURLMOPT_TIMERFUNCTION"); if(t758_ctx.timer_calls == t758_ctx.max_timer_calls) { @@ -204,7 +204,7 @@ static int t758_curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) static int t758_cert_verify_callback(X509_STORE_CTX *ctx, void *arg) { SSL * ssl; - (void)arg; /* unused */ + (void)arg; ssl = (SSL *)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); t758_ctx.number_of_cert_verify_callbacks++; @@ -227,7 +227,7 @@ static CURLcode t758_set_ssl_ctx_callback(CURL *curl, void *ssl_ctx, void *clientp) { SSL_CTX *ctx = (SSL_CTX *) ssl_ctx; - (void)curl; /* unused */ + (void)curl; SSL_CTX_set_cert_verify_callback(ctx, t758_cert_verify_callback, clientp); return CURLE_OK; } diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index 23782d74c..e0a7d157d 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -352,7 +352,7 @@ static CURLcode test_lib1521(const char *URL) struct curl_tlssessioninfo *tlssession; struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0}; CURLcode res = CURLE_OK; - (void)URL; /* not used */ + (void)URL; global_init(CURL_GLOBAL_ALL); easy_init(dep); easy_init(curl); diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c index b221f38cd..8aa377fb0 100644 --- a/tests/libtest/testtrace.c +++ b/tests/libtest/testtrace.c @@ -166,7 +166,7 @@ int cli_debug_cb(CURL *handle, curl_infotype type, char idsbuf[60]; curl_off_t xfer_id, conn_id; - (void)handle; /* not used */ + (void)handle; (void)userp; if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) { diff --git a/tests/runner.pm b/tests/runner.pm index 0ecfc84c5..62f722f31 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -609,11 +609,7 @@ sub singletest_startservers { my $error; if(!$listonly) { my @what = getpart("client", "server"); - if(!$what[0]) { - warn "Test case $testnum has no server(s) specified"; - $why = "no server specified"; - $error = -1; - } else { + if($what[0]) { my $err; ($why, $err) = serverfortest(@what); if($err == 1) { @@ -1144,7 +1140,6 @@ sub singletest_postcheck { } - ################################################################### # Get ready to run a single test case sub runner_test_preprocess { diff --git a/tests/servers.pm b/tests/servers.pm index 94809d3e7..e62505887 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -2244,8 +2244,6 @@ sub runnegtelnetserver { } - - ####################################################################### # Single shot http and gopher server responsiveness test. This should only # be used to verify that a server present in %run hash is still functional @@ -3028,9 +3026,6 @@ sub startservers { $run{'telnet'}="$pid $pid2"; } } - elsif($what eq "none") { - logmsg "* starts no server\n" if($verbose); - } else { warn "we don't support a server for $what"; return ("no server for $what", 4); diff --git a/tests/unit/unit1603.c b/tests/unit/unit1603.c index f6e39dc68..d59b458d5 100644 --- a/tests/unit/unit1603.c +++ b/tests/unit/unit1603.c @@ -32,16 +32,16 @@ static const size_t slots = 3; static void t1603_mydtor(void *p) { /* Data are statically allocated */ - (void)p; /* unused */ + (void)p; } static size_t elem_dtor_calls; static void my_elem_dtor(void *key, size_t key_len, void *p) { - (void)p; /* unused */ - (void)key; /* unused */ - (void)key_len; /* unused */ + (void)p; + (void)key; + (void)key_len; ++elem_dtor_calls; } diff --git a/winbuild/MakefileBuild.vc b/winbuild/MakefileBuild.vc index 8d1dd2888..509e43e26 100644 --- a/winbuild/MakefileBuild.vc +++ b/winbuild/MakefileBuild.vc @@ -422,7 +422,6 @@ CFGSET = true !ENDIF - # CURL_XX macros are for the curl.exe command !IF "$(DEBUG)"=="yes" |