]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 years agotest1275: verify upercase after period in markdown
Daniel Stenberg [Tue, 11 Oct 2022 07:34:38 +0000 (09:34 +0200)] 
test1275: verify upercase after period in markdown

Script based on the #9474 pull-request logic, but implemented in perl.

Updated docs/URL-SYNTAX.md accordingly.

Suggested-by: Dan Fandrich
Closes #9697

3 years agomisc: nitpick grammar in comments/docs
12932 [Tue, 11 Oct 2022 14:01:37 +0000 (22:01 +0800)] 
misc: nitpick grammar in comments/docs

because the 'u' in URL is actually a consonant *sound* it is only
correct to write "a URL"

sorry this is a bit nitpicky :P

https://english.stackexchange.com/questions/152/when-should-i-use-a-vs-an
https://www.techtarget.com/whatis/feature/Which-is-correct-a-URL-or-an-URL

Closes #9699

3 years agoMakefile.m32: drop CROSSPREFIX and our CC/AR defaults [ci skip]
Viktor Szakats [Tue, 11 Oct 2022 21:16:00 +0000 (21:16 +0000)] 
Makefile.m32: drop CROSSPREFIX and our CC/AR defaults [ci skip]

This patch aimed to fix a regression [0], where `CC` initialization
moved beyond its first use. But, on closer inspection it turned out that
the `CC` initialization does not work as expected due to GNU Make
filling it with `cc` by default. So unless implicit values were
explicitly disabled via a GNU Make option, the default value of
`$CROSSPREFIX` + `gcc` was never used. At the same time the implicit
value `cc` maps to `gcc` in (most/all?) MinGW envs.

`AR` has the same issue, with a default value of `ar`.

We could reintroduce a separate variable to fix this without ill
effects, but for simplicity and flexibility, it seems better to drop
support for `CROSSPREFIX`, along with our own `CC`/`AR` init logic, and
require the caller to initialize `CC`, `AR` and `RC` to the full
(prefixed if necessary) names of these tools, as desired.

We keep `RC ?= windres` because `RC` is empty by default.

Also fix grammar in a comment.

[0] 10fbd8b4e3f83b967fd9ad9a41ab484c0e7e7ca3

Closes #9698

3 years agosmb: replace CURL_WIN32 with WIN32
Viktor Szakats [Tue, 11 Oct 2022 21:05:44 +0000 (21:05 +0000)] 
smb: replace CURL_WIN32 with WIN32

PR #9255 aimed to fix a Cygwin/MSYS issue (#8220). It used the
`CURL_WIN32` macro, but that one is not defined here, while compiling
curl itself. This patch changes this to `WIN32`, assuming this was the
original intent.

Regression from 1c52e8a3795ccdf8ec9c308f4f8f19cf10ea1f1a

Reviewed-by: Marcel Raad
Closes #9701

3 years agoaws_sigv4: fix header computation
Matthias Gatto [Thu, 13 Jan 2022 14:53:52 +0000 (15:53 +0100)] 
aws_sigv4: fix header computation

Handle canonical headers and signed headers creation as explained here:
https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

The algo tells that signed and canonical must contain at last host and
x-amz-date.

So we check whatever thoses are present in the curl http headers list.
If they are, we use the one enter by curl user, otherwise we generate
them.  then we to lower, and remove space from each http headers plus
host and x-amz-date, then sort them all by alphabetical order.

This patch also fix a bug with host header, which was ignoring the port.

Closes #7966

3 years agoREADME.md: link the curl logo to the website
Aftab Alam [Sun, 9 Oct 2022 17:33:21 +0000 (23:03 +0530)] 
README.md: link the curl logo to the website

- Link the curl:// image to https://curl.se/

Closes https://github.com/curl/curl/pull/9675

3 years agoschannel: when importing PFX, disable key persistence
Dustin Howett [Thu, 25 Aug 2022 00:20:43 +0000 (19:20 -0500)] 
schannel: when importing PFX, disable key persistence

By default, the PFXImportCertStore API persists the key in the user's
key store (as though the certificate was being imported for permanent,
ongoing use.)

The documentation specifies that keys that are not to be persisted
should be imported with the flag PKCS12_NO_PERSIST_KEY.
NOTE: this flag is only supported on versions of Windows newer than XP
and Server 2003.

--

This is take 2 of the original fix. It extends the lifetime of the
client certificate store to that of the credential handle. The original
fix which landed in 70d010d and was later reverted in aec8d30 failed to
work properly because it did not do that.

Minor changes were made to the schannel credential context to support
closing the client certificate store handle at the end of an SSL session.

--

Reported-by: ShadowZzj@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/9300
Supersedes https://github.com/curl/curl/pull/9363
Closes https://github.com/curl/curl/pull/9460

3 years agoMakefile.m32: support more options [ci skip]
Viktor Szakats [Tue, 11 Oct 2022 07:56:01 +0000 (07:56 +0000)] 
Makefile.m32: support more options [ci skip]

- Add support for these options:
  `-wolfssl`, `-wolfssh`, `-mbedtls`, `-libssh`, `-psl`

  Caveats:
  - `-wolfssh` requires `-wolfssl`.
  - `-wolfssl` cannot be used with OpenSSL backends in parallel.
  - `-libssh` has build issues with BoringSSL and LibreSSL, and also
     what looks like a world-writable-config vulnerability on Windows.
     Consider it experimental.
  - `-psl` requires `-idn2` and extra libs passed via
    `LIBS=-liconv -lunistring`.

- Detect BoringSSL/wolfSSL and set ngtcp2 crypto lib accordingly.
- Generalize MultiSSL detection.
- Use else-if syntax. Requires GNU Make 3.81 (2006-04-01).
- Document more customization options.

This brings over some configuration logic from `curl-for-win`.

Closes #9680

3 years agocmake: enable more detection on Windows
Viktor Szakats [Tue, 11 Oct 2022 07:52:32 +0000 (07:52 +0000)] 
cmake: enable more detection on Windows

Enable `HAVE_UNISTD_H`, `HAVE_STRTOK_R` and `HAVE_STRCASECMP` detection
on Windows, instead of having predefined values.

With these features detected correctly, CMake Windows builds get closer
to the autotools and `config-win32.h` ones.

This also fixes detecting `HAVE_FTRUNCATE` correctly, which required
`unistd.h`.

Fixing `ftruncate()` in turn causes a build warning/error with legacy
MinGW/MSYS1 due to an offset type size mismatch. This env misses to
detect `HAVE_FILE_OFFSET_BITS`, which may be a reason. This patch
force-disables `HAVE_FTRUNCATE` for this platform.

Reviewed-by: Daniel Stenberg
Closes #9687

3 years agoautotools: allow unix sockets on Windows
Viktor Szakats [Tue, 11 Oct 2022 07:51:33 +0000 (07:51 +0000)] 
autotools: allow unix sockets on Windows

Fixes: https://github.com/curl/curl-for-win/blob/73a070d96fd906fdee929e2f1f00a9149fb39239/curl-autotools.sh#L44-L47
On Windows this feature is present, but not the header used in the
detection logic. It also requires an elaborate enabler logic
(as seen in `lib/curl_setup.h`). Let's always allow it and let the
lib code deal with the details.

Closes #9688

3 years agocmake: add missing inet_ntop check
Viktor Szakats [Tue, 11 Oct 2022 07:42:16 +0000 (07:42 +0000)] 
cmake: add missing inet_ntop check

This adds the missing half of the check, next to the other half
already present in `lib/curl_config.h.cmake`.

Force disable `HAVE_INET_NTOP` for old MSVC where it caused compiler
warnings.

Reviewed-by: Daniel Stenberg
Closes #9689

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 11 Oct 2022 06:29:06 +0000 (08:29 +0200)] 
RELEASE-NOTES: synced

3 years agoasyn-ares: set hint flags when calling ares_getaddrinfo
bsergean [Mon, 10 Oct 2022 23:24:43 +0000 (16:24 -0700)] 
asyn-ares: set hint flags when calling ares_getaddrinfo

The hint flag is ARES_AI_NUMERICSERV, and it will save a call to
getservbyname or getservbyname_r to set it.

Closes #9694

3 years agoheader.d: add category smtp and imap
Daniel Stenberg [Mon, 10 Oct 2022 21:10:52 +0000 (23:10 +0200)] 
header.d: add category smtp and imap

They were previously (erroneously) added manually to tool_listhelp.c
which would make them get removed again when the file is updated next
time, unless added correctly here in header.d

Follow-up to 2437fac01

Closes #9690

3 years agocurl/get_url_file_name: use libcurl URL parser
Daniel Stenberg [Mon, 10 Oct 2022 09:10:12 +0000 (11:10 +0200)] 
curl/get_url_file_name: use libcurl URL parser

To avoid URL tricks, use the URL parser for this.

This update changes curl's behavior slightly in that it will ignore the
possible query part from the URL and only use the file name from the
actual path from the URL. I consider it a bugfix.

"curl -O localhost/name?giveme-giveme" will now save the output in the
local file named 'name'

Updated test 1210 to verify

Assisted-by: Jay Satiro
Closes #9684

3 years agodocs: fix grammar around needing pass phrase
Martin Ågren [Tue, 11 Oct 2022 05:57:42 +0000 (07:57 +0200)] 
docs: fix grammar around needing pass phrase

"You never needed a pass phrase" reads like it's about to be followed by
something like "until version so-and-so", but that is not what is
intended. Change to "You never need a pass phrase". There are two
instances of this text, so make sure to update both.

3 years agocmake: add the check of HAVE_SOCKETPAIR
Xiang Xiao [Sun, 9 Oct 2022 22:54:59 +0000 (06:54 +0800)] 
cmake: add the check of HAVE_SOCKETPAIR

which is used by Curl_socketpair

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Closes #9686

3 years agocurl/add_file_name_to_url: use the libcurl URL parser
Daniel Stenberg [Mon, 10 Oct 2022 08:55:05 +0000 (10:55 +0200)] 
curl/add_file_name_to_url: use the libcurl URL parser

instead of the custom error-prone parser, to extract and update the path
of the given URL

Closes #9683

3 years agosingle_transfer: use the libcurl URL parser when appending query parts
Daniel Stenberg [Mon, 10 Oct 2022 07:15:18 +0000 (09:15 +0200)] 
single_transfer: use the libcurl URL parser when appending query parts

Instead of doing "manual" error-prone parsing in another place.

Used when --data contents is added to the URL query when -G is provided.

Closes #9681

3 years agows: fix buffer pointer use in the callback loop
Daniel Stenberg [Sun, 9 Oct 2022 21:35:21 +0000 (23:35 +0200)] 
ws: fix buffer pointer use in the callback loop

Closes #9678

3 years agocurl-wolfssl.m4: error out if wolfSSL is not usable
Petr Štetiar [Mon, 10 Oct 2022 05:36:56 +0000 (07:36 +0200)] 
curl-wolfssl.m4: error out if wolfSSL is not usable

When I explicitly declare, that I would like to have curl built with
wolfSSL support using `--with-wolfssl` configure option, then I would
expect, that either I endup with curl having that support, for example
in form of https support or it wouldn't be available at all.

Downstream projects like for example OpenWrt build curl wolfSSL variant
with `--with-wolfssl` already, but in certain corner cases it does fail:

  configure:25299: checking for wolfSSL_Init in -lwolfssl
  configure:25321: x86_64-openwrt-linux-musl-gcc -o conftest [snip]
  In file included from target-x86_64_musl/usr/include/wolfssl/wolfcrypt/dsa.h:33,
                   from target-x86_64_musl/usr/include/wolfssl/wolfcrypt/asn_public.h:35,
                  from target-x86_64_musl/usr/include/wolfssl/ssl.h:35,
                   from conftest.c:47:
  target-x86_64_musl/usr/include/wolfssl/wolfcrypt/integer.h:37:14: fatal error: wolfssl/wolfcrypt/sp_int.h: No such file or directory
       #include <wolfssl/wolfcrypt/sp_int.h>
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.

and in the end thus produces curl without https support:

 curl: (1) Protocol "https" not supported or disabled in libcurl

So fix it, by making the working wolfSSL mandatory and error out in
configure step when that's not the case:

 checking for wolfSSL_Init in -lwolfssl... no
 configure: error: --with-wolfssl but wolfSSL was not found or doesn't work

References: https://github.com/openwrt/packages/issues/19005
References: https://github.com/openwrt/packages/issues/19547
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Closes #9682

3 years agotool_getparam: pass in the snprintf("%.*s") string length as 'int'
Daniel Stenberg [Sun, 9 Oct 2022 21:42:08 +0000 (23:42 +0200)] 
tool_getparam: pass in the snprintf("%.*s") string length as 'int'

Reported by Coverity CID 1515928

Closes #9679

3 years agows: minor fixes for web sockets without the CONNECT_ONLY flag
Paul Seligman [Fri, 7 Oct 2022 11:52:31 +0000 (07:52 -0400)] 
ws: minor fixes for web sockets without the CONNECT_ONLY flag

- Fixed an issue where is_in_callback was getting cleared when using web
  sockets with debug logging enabled
- Ensure the handle is is_in_callback when calling out to fwrite_func
- Change the write vs. send_data decision to whether or not the handle
  is in CONNECT_ONLY mode.
- Account for buflen not including the header length in curl_ws_send

Closes #9665

3 years agoCI/cirrus: merge existing macOS jobs into a job matrix 9627/head
Marc Hoersken [Fri, 7 Oct 2022 20:04:55 +0000 (22:04 +0200)] 
CI/cirrus: merge existing macOS jobs into a job matrix

Ref: #9627
Reviewed-by: Philip H.
Closes #9672

3 years agostrcase: add and use Curl_timestrcmp
Daniel Stenberg [Wed, 5 Oct 2022 22:49:10 +0000 (00:49 +0200)] 
strcase: add and use Curl_timestrcmp

This is a strcmp() alternative function for comparing "secrets",
designed to take the same time no matter the content to not leak
match/non-match info to observers based on how fast it is.

The time this function takes is only a function of the shortest input
string.

Reported-by: Trail of Bits
Closes #9658

3 years agotool_getparam: split out data_urlencode() into its own function
Daniel Stenberg [Fri, 7 Oct 2022 22:25:45 +0000 (00:25 +0200)] 
tool_getparam: split out data_urlencode() into its own function

Closes #9673

3 years agoconnect: fix Curl_updateconninfo for TRNSPRT_UNIX
Daniel Stenberg [Fri, 7 Oct 2022 16:10:05 +0000 (18:10 +0200)] 
connect: fix Curl_updateconninfo for TRNSPRT_UNIX

Reported-by: Vasiliy Ulyanov
Fixes #9664
Closes #9670

3 years agows: fix Coverity complaints
Daniel Stenberg [Fri, 7 Oct 2022 12:07:46 +0000 (14:07 +0200)] 
ws: fix Coverity complaints

Coverity pointed out several flaws where variables remained
uninitialized after forks.

Follow-up to e3f335148adc6742728f

Closes #9666

3 years agoCI/GHA: merge msh3 and openssl3 builds into linux workflow
Marc Hoersken [Tue, 4 Oct 2022 20:30:33 +0000 (22:30 +0200)] 
CI/GHA: merge msh3 and openssl3 builds into linux workflow

Continue work on merging all Linux workflows into one file.

Follow up to #9501
Closes #9646

3 years agocurl_ws_send.3: call the argument 'fragsize'
Daniel Stenberg [Fri, 7 Oct 2022 15:33:44 +0000 (17:33 +0200)] 
curl_ws_send.3: call the argument 'fragsize'

Since WebSocket works with "fragments" not "frames"

Closes #9668

3 years agoeasy: avoid Intel error #2312: pointer cast involving 64-bit pointed-to type
Daniel Stenberg [Fri, 7 Oct 2022 15:50:37 +0000 (17:50 +0200)] 
easy: avoid Intel error #2312: pointer cast involving 64-bit pointed-to type

Follow-up to e3f335148adc6742728ff8

Closes #9669

3 years agotool_main: exit at once if out of file descriptors
Daniel Stenberg [Wed, 5 Oct 2022 08:33:07 +0000 (10:33 +0200)] 
tool_main: exit at once if out of file descriptors

If the main_checkfds function cannot create new file descriptors in an
attempt to detect of stdin, stdout or stderr are closed.

Also changed the check to use fcntl() to check if the descriptors are
open, which avoids superfluously calling pipe() if they all already are.

Follow-up to facfa19cdd4d0094

Reported-by: Trail of Bits
Closes #9663

3 years agowebsockets: remodeled API to support 63 bit frame sizes
Daniel Stenberg [Mon, 3 Oct 2022 15:40:02 +0000 (17:40 +0200)] 
websockets: remodeled API to support 63 bit frame sizes

curl_ws_recv() now receives data to fill up the provided buffer, but can
return a partial fragment. The function now also get a pointer to a
curl_ws_frame struct with metadata that also mentions the offset and
total size of the fragment (of which you might be receiving a smaller
piece). This way, large incoming fragments will be "streamed" to the
application. When the curl_ws_frame struct field 'bytesleft' is 0, the
final fragment piece has been delivered.

curl_ws_recv() was also adjusted to work with a buffer size smaller than
the fragment size. (Possibly needless to say as the fragment size can
now be 63 bit large).

curl_ws_send() now supports sending a piece of a fragment, in a
streaming manner, in addition to sending the entire fragment in a single
call if it is small enough. To send a huge fragment, curl_ws_send() can
be used to send it in many small calls by first telling libcurl about
the total expected fragment size, and then send the payload in N number
of separate invokes and libcurl will stream those over the wire.

The struct curl_ws_meta() returns is now called 'curl_ws_frame' and it
has been extended with two new fields: *offset* and *bytesleft*. To help
describe the passed on data chunk when a fragment is delivered in many
smaller pieces.

The documentation has been updated accordingly.

Closes #9636

3 years agodocs/examples: avoid deprecated options in examples where possible
Patrick Monnerat [Thu, 6 Oct 2022 23:43:21 +0000 (01:43 +0200)] 
docs/examples: avoid deprecated options in examples where possible

Example programs targeting a deprecated feature/option are commented with
a warning about it.
Other examples are adapted to not use deprecated options.

Closes #9661

3 years agocmake: fix enabling websocket support
Viktor Szakats [Thu, 6 Oct 2022 21:34:37 +0000 (21:34 +0000)] 
cmake: fix enabling websocket support

Follow-up from 664249d095275ec532f55dd1752d80c8c1093a77

Closes #9660

3 years agotidy-up: delete parallel/unused feature flags
Viktor Szakats [Thu, 6 Oct 2022 15:30:13 +0000 (15:30 +0000)] 
tidy-up: delete parallel/unused feature flags

Detecting headers and lib separately makes sense when headers come in
variations or with extra ones, but this wasn't the case here. These were
duplicate/parallel macros that we had to keep in sync with each other
for a working build. This patch leaves a single macro for each of these
dependencies:

- Rely on `HAVE_LIBZ`, delete parallel `HAVE_ZLIB_H`.

  Also delete CMake logic making sure these two were in sync, along with
  a toggle to turn off that logic, called `CURL_SPECIAL_LIBZ`.

  Also delete stray `HAVE_ZLIB` defines.

  There is also a `USE_ZLIB` variant in `lib/config-dos.h`. This patch
  retains it for compatibility and deprecates it.

- Rely on `USE_LIBSSH2`, delete parallel `HAVE_LIBSSH2_H`.

  Also delete `LIBSSH2_WIN32`, `LIBSSH2_LIBRARY` from
  `winbuild/MakefileBuild.vc`, these have a role when building libssh2
  itself. And `CURL_USE_LIBSSH`, which had no use at all.

  Also delete stray `HAVE_LIBSSH2` defines.

- Rely on `USE_LIBSSH`, delete parallel `HAVE_LIBSSH_LIBSSH_H`.

  Also delete `LIBSSH_WIN32`, `LIBSSH_LIBRARY` and `HAVE_LIBSSH` from
  `winbuild/MakefileBuild.vc`, these were the result of copy-pasting the
  libssh2 line, and were not having any use.

- Delete unused `HAVE_LIBPSL_H` and `HAVE_LIBPSL`.

Reviewed-by: Daniel Stenberg
Closes #9652

3 years agonetrc: compare user name case sensitively
Daniel Stenberg [Thu, 6 Oct 2022 07:16:42 +0000 (09:16 +0200)] 
netrc: compare user name case sensitively

User name comparisions in netrc need to match the case.

Closes #9657

3 years agoCURLOPT_COOKIEFILE: insist on "" for enable-without-file
Daniel Stenberg [Wed, 5 Oct 2022 22:52:35 +0000 (00:52 +0200)] 
CURLOPT_COOKIEFILE: insist on "" for enable-without-file

The former way that also suggested using a non-existing file to just
enable the cookie engine could lead to developers maybe a bit carelessly
guessing a file name that will not exist, and then in a future due to
circumstances, such a file could be made to exist and then accidentally
libcurl would read cookies not actually meant to.

Reported-by: Trail of bits
Closes #9654

3 years agotests/Makefile: remove run time stats from ci-test
Daniel Stenberg [Thu, 6 Oct 2022 07:07:03 +0000 (09:07 +0200)] 
tests/Makefile: remove run time stats from ci-test

The ci-test is the normal makefile target invoked in CI jobs. This has
been using the -r option to runtests.pl since a long time, but I find
that it mostly just adds many lines to the test output report without
anyone caring much about those stats.

Remove it.

Closes #9656

3 years agotool: reorganize function c_escape around a dynbuf
Patrick Monnerat [Wed, 5 Oct 2022 16:51:16 +0000 (18:51 +0200)] 
tool: reorganize function c_escape around a dynbuf

This is a bit shorter and a lot safer.

Substrings of unescaped characters are added by a single call to reduce
overhead.

Extend test 1465 to handle more kind of escapes.

Closes #9653

3 years agoCURLOPT_HTTPPOST.3: bolden the deprecation notice
Jay Satiro [Mon, 3 Oct 2022 18:00:19 +0000 (14:00 -0400)] 
CURLOPT_HTTPPOST.3: bolden the deprecation notice

Ref: https://github.com/curl/curl/pull/9621

Closes https://github.com/curl/curl/pull/9637

3 years agomisc: fix spelling in docs and comments
John Bampton [Tue, 4 Oct 2022 15:40:54 +0000 (01:40 +1000)] 
misc: fix spelling in docs and comments

also: remove outdated sentence

Closes #9644

3 years agotool: avoid generating ambiguous escaped characters in --libcurl
Patrick Monnerat [Tue, 4 Oct 2022 14:50:45 +0000 (16:50 +0200)] 
tool: avoid generating ambiguous escaped characters in --libcurl

C string hexadecimal-escaped characters may have more than 2 digits.
This results in a wrong C compiler interpretation of a 2-digit escaped
character when followed by an hex digit character.

The solution retained here is to represent such characters as 3-digit
octal escapes.

Adjust and extend test 1465 for this case.

Closes #9643

3 years agoconfigure: the ngtcp2 option should default to 'no'
Daniel Stenberg [Wed, 5 Oct 2022 08:30:04 +0000 (10:30 +0200)] 
configure: the ngtcp2 option should default to 'no'

While still experimental.

Bug: https://curl.se/mail/lib-2022-10/0007.html
Reported-by: Daniel Hallberg
Closes #9650

3 years agoCURLOPT_MIMEPOST.3: add an (inline) example
Daniel Stenberg [Wed, 5 Oct 2022 08:02:13 +0000 (10:02 +0200)] 
CURLOPT_MIMEPOST.3: add an (inline) example

Reported-by: Jay Satiro
Bug: https://github.com/curl/curl/pull/9637#issuecomment-1268070723

Closes #9649

3 years agoMakefile.m32: exclude libs & libpaths for shared mode exes [ci skip]
Viktor Szakats [Wed, 5 Oct 2022 13:56:31 +0000 (13:56 +0000)] 
Makefile.m32: exclude libs & libpaths for shared mode exes [ci skip]

Exclude linker flags specifying depedency libs and libpaths, when
building against `libcurl.dll`. In such case these options are not
necessary (but may cause errors if not/wrongly configured.)

Also move and reword a comment on `CPPFLAGS` to not apply to
`UNICODE` options. These are necessary for all build targets.

Closes #9651

3 years agoruntests: fix uninitialized value on ignored tests
Jay Satiro [Wed, 5 Oct 2022 07:33:39 +0000 (03:33 -0400)] 
runtests: fix uninitialized value on ignored tests

- Don't show TESTFAIL message (ie tests failed which aren't ignored) if
  only ignored tests failed.

Before:
IGNORED: failed tests: 571 612 1056
TESTDONE: 1214 tests out of 1217 reported OK: 99%
Use of uninitialized value $failed in concatenation (.) or string at
./runtests.pl line 6290.
TESTFAIL: These test cases failed:

After:
IGNORED: failed tests: 571 612 1056
TESTDONE: 1214 tests out of 1217 reported OK: 99%

Closes https://github.com/curl/curl/pull/9648

3 years agocirrus: use make LDFLAGS=-all-static instead of curl_LDFLAGS
Jay Satiro [Sun, 2 Oct 2022 21:21:28 +0000 (17:21 -0400)] 
cirrus: use make LDFLAGS=-all-static instead of curl_LDFLAGS

- Correct the use of -all-static for static Windows CI builds.

curl_LDFLAGS was removed from the makefile when metalink support was
removed. LDFLAGS=-all-static is passed to make only, because it is not a
valid option for configure compilation tests.

Closes https://github.com/curl/curl/pull/9633

3 years agoMakefile.m32: fix regression with tool_hugehelp [ci skip]
Viktor Szakats [Tue, 4 Oct 2022 19:14:38 +0000 (19:14 +0000)] 
Makefile.m32: fix regression with tool_hugehelp [ci skip]

In a recent commit I mistakenly deleted this logic, after seeing a
reference to a filename ending with `.cvs` and thinking it must have
been long gone. Turns out this is an existing file. Restore the rule
and the necessary `COPY` definitions with it.

The restored logic is required for a successful build on a bare source
tree (as opposed to a source release tarball).

Also shorten an existing condition similar to the one added in this
patch.

Regression since 07a0047882dd3f1fbf73486c5dd9c15370877ad6

Closes #9645

3 years agoMakefile.m32: deduplicate build rules [ci skip]
Viktor Szakats [Tue, 4 Oct 2022 17:09:51 +0000 (17:09 +0000)] 
Makefile.m32: deduplicate build rules [ci skip]

After this patch, we reduce the three copies of most `Makefile.m32`
logic to one. This now resides in `lib/Makefile.m32`. It makes future
updates easier, the code shorter, with a small amount of added
complexity.

`Makefile.m32` reduction:

|                   |  bytes | LOC total |  blank |  comment |  code |
|-------------------|-------:|----------:|-------:|---------:|------:|
| 7.85.0            |  34772 |      1337 |     79 |      192 |  1066 |
| before this patch |  17601 |       625 |     62 |      106 |   457 |
| after this patch  |  11680 |       392 |     52 |      104 |   236 |

Details:

- Change rules to create objects for the `v*` subdirs in the `lib` dir.
  This allows to use a shared compile rule and assumes that filenames
  are not (and will not be) colliding across these directories.
  `Makefile.m32` now also stores a list of these subdirs. They are
  changing rarely though.

- Sync as much as possible between the three `Makefile.m32` scripts'
  rules and their source/target sections.

- After this patch `CPPFLAGS` are all applied to the `src` sources once
  again. This matches the behaviour of cmake/autotools. Only zlib ones
  are actually required there.

- Use `.rc` names from `Makefile.inc` instead of keeping a duplicate.

- Change examples to link `libcurl.dll` by default. This makes building
  trivial, even as a cross-build:
    `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32`
  To run them, you need to move/copy or add-to-path `libcurl.dll`.
  You can select static mode via `CFG=-static`.

- List more of the `Makefile.m32` config variables.

- Drop `.rc` support from examples. It made it fragile without much
  benefit.

- Include a necessary system lib for the `externalsocket.c` example.

- Exclude unnecessary systems libs when building in `-dyn` mode.

Closes #9642

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 4 Oct 2022 14:24:19 +0000 (16:24 +0200)] 
RELEASE-NOTES: synced

3 years agoCURLOPT_COOKIELIST.3: fix formatting mistake
Daniel Stenberg [Tue, 4 Oct 2022 07:23:21 +0000 (09:23 +0200)] 
CURLOPT_COOKIELIST.3: fix formatting mistake

Also, updated manpage-syntax.pl to make it detect this error in test
1173.

Reported-by: ProceduralMan on github
Fixes #9639
Closes #9640

3 years agoconnect: change verbose IPv6 address:port to [address]:port
Jay Satiro [Mon, 3 Oct 2022 07:29:32 +0000 (03:29 -0400)] 
connect: change verbose IPv6 address:port to [address]:port

- Use brackets for the IPv6 address shown in verbose message when the
  format is address:port so that it is less confusing.

Before: Trying 2606:4700:4700::1111:443...
After: Trying [2606:4700:4700::1111]:443...

Bug: https://curl.se/mail/archive-2022-02/0041.html
Reported-by: David Hu
Closes #9635

3 years agoMakefile.m32: major rework [ci skip]
Viktor Szakats [Mon, 3 Oct 2022 19:46:56 +0000 (19:46 +0000)] 
Makefile.m32: major rework [ci skip]

This patch overhauls `Makefile.m32` scripts, fixing a list of quirks,
making its behaviour and customization envvars align better with other
build systems, aiming for less code, that is easier to read, use and
maintain.

Details:
- Rename customization envvars:
  `CURL_CC` -> `CC`
  `CURL_RC` -> `RC`
  `CURL_AR` -> `AR`
  `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB`
  `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN`
- Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used.
- Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars.
- Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in
  favor of the above.
- Do not automatically enable `zlib` with `libssh2`. `zlib` is optional
  with `libssh2`.
- Omit unnecessary `CPPFLAGS` options when building `curl.exe` and
  examples.
- Drop support for deprecated `-winssl` `CFG` option. Use `-schannel`
  instead.
- Avoid late evaluation where not necessary (`=` -> `:=`).
- Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix.
  Instead, use the standard naming scheme by default: `libcurl.dll.a`.
  The toolchain recognizes the name, and selects it automatically when
  asking for a `-shared` vs. `-static` build.
- Stop applying `strip` to `libcurl.a`. Follow-up from
  16a58e9f93c7e89e1f87720199388bcfcfa148a4. There was no debug info to
  strip since then.
- Stop setting `-O3`, `-W`, `-Wall` options. You can add these to
  `CFLAGS` as desired.
- Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL,
  to avoid that vulnerability on Windows.
- Add `-lbrotlicommon` to `LIBS` when using `brotli`.
- Do not enable `-nghttp3` without `-ngtcp2`.
- `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend.
  You need to set the backend explicitly. This scales better and avoids
  issues with certain combinations (e.g. `libssh2` + `wolfssl` with no
  `schannel`).
- Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via
  `NGTCP2_LIBS`.
- Old, alternate method of enabling components (e.g. `SSH2=1`) no longer
  supported.
- Delete `SPNEGO` references. They were no-ops.
- Drop support for Win9x environments.
- Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`.
- Support autotools/CMake `libssh2` builds by default.
- Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and
  examples.
- Assume standard directory layout with `LIBCARES_PATH`. (Instead of the
  long gone embedded one.)
- Stop static linking with c-ares by default. Add
  `CPPFLAGS=-DCARES_STATICLIB` to enable it.
- Reorganize internal layout to avoid redundancy and emit clean diffs
  between src/lib and example make files.
- Delete unused variables.
- Code cleanups/rework.
- Comment and indentation fixes.

Closes #9632

3 years agoscripts/release-notes.pl: strip ci skip tag [ci skip]
Viktor Szakats [Sun, 2 Oct 2022 22:15:21 +0000 (22:15 +0000)] 
scripts/release-notes.pl: strip ci skip tag [ci skip]

Ref: https://github.com/curl/curl/commit/e604a82cae922bf86403a94f5803ac5e4303ae97#commitcomment-85637701

Reviewed-by: Daniel Stenberg
Closes #9634

3 years agoMakefile.m32: delete legacy component bits [ci skip]
Viktor Szakats [Sun, 2 Oct 2022 09:34:13 +0000 (09:34 +0000)] 
Makefile.m32: delete legacy component bits [ci skip]

- Drop auto-detection of OpenSSL 1.0.2 and earlier. Now always defaulting
  to OpenSSL 1.1.0 and later, LibreSSL and BoringSSL.

- Drop `Invalid path to OpenSSL package` detection. OpenSSL has been
  using a standard file layout since 1.1.0, so this seems unnecessary
  now.

- Drop special logic to enable Novell LDAP SDK support.

- Drop special logic to enable OpenLDAP LDAP SDK support. This seems
  to be distinct from native OpenLDAP, with support implemented inside
  `lib/ldap.c` (vs. `lib/openldap.c`) back when the latter did not exist
  yet in curl.

- Add `-lwldap32` only if there is no other LDAP library (either native
  OpenLDAP, or SDKs above) present.

- Update `doc/INSTALL.md` accordingly.

After this patch, it's necessary to make configration changes when using
OpenSSL 1.0.2 or earlier, or the two LDAP SDKs.

OpenSSL 1.0.2 and earlier:
```
export OPENSSL_INCLUDE = <path-to-openssl>/outinc
export OPENSSL_LIBPATH = <path-to-openssl>/out
export OPENSSL_LIBS = -lssl32 -leay32 -lgdi32
```

Novell LDAP SDK, previously enabled via `USE_LDAP_NOVELL=1`:
```
export CURL_CFLAG_EXTRAS = -I<path-to-sdk>/inc -DCURL_HAS_NOVELL_LDAPSDK
export CURL_LDFLAG_EXTRAS = -L<path-to-sdk>/lib/mscvc -lldapsdk -lldapssl -lldapx
```

OpenLDAP LDAP SDK, previously enabled via `USE_LDAP_OPENLDAP=1`:
```
export CURL_CFLAG_EXTRAS = -I<path-to-sdk>/include -DCURL_HAS_OPENLDAP_LDAPSDK
export CURL_LDFLAG_EXTRAS = -L<path-to-sdk>/lib -lldap -llber
```

I haven't tested these scenarios, and in general we recommend using
a recent OpenSSL release. Also, WinLDAP (the Windows default) and
OpenLDAP (via `-DUSE_OPENLDAP`) are the LDAP options actively worked on
in curl.

Closes #9631

3 years agovauth/ntlm.h: make line shorter than 80 columns
Daniel Stenberg [Sat, 1 Oct 2022 22:21:18 +0000 (00:21 +0200)] 
vauth/ntlm.h: make line shorter than 80 columns

Follow-up from 265fbd937

3 years agodocs: update sourceforge project links [ci skip]
Viktor Szakats [Sat, 1 Oct 2022 18:23:09 +0000 (18:23 +0000)] 
docs: update sourceforge project links [ci skip]

SourceForge projects can now choose between two hostnames, with .io and
.net ending. Both support HTTPS by default now. Opening the other variant
will perm-redirected to the one chosen by the project.

The .io -> .net redirection is done insecurely.

Let's update the URLs to point to the current canonical endpoints to
avoid any redirects.

Closes #9630

3 years agocurl_url_set.3: document CURLU_APPENDQUERY proper
Daniel Stenberg [Fri, 30 Sep 2022 21:41:18 +0000 (23:41 +0200)] 
curl_url_set.3: document CURLU_APPENDQUERY proper

Listed among the other supported flags.

Reported-by: Robby Simpson
Fixes #9628
Closes #9629

3 years agoMakefile.m32: cleanups and fixes [ci skip]
Viktor Szakats [Sat, 1 Oct 2022 10:07:34 +0000 (10:07 +0000)] 
Makefile.m32: cleanups and fixes [ci skip]

- Add `-lcrypt32` once, and add it always for simplicity.
- Delete broken link and reference to the pre-Vista WinIDN add-on.
  MS no longer distribute it.
- Delete related `WINIDN_PATH` option. IDN is a system lib since Vista.
- Sync `LIBCARES_PATH` default with the rest of dependencies.
- Delete version numbers from dependency path defaults.
- `libgsasl` package is now called `gsasl`.
- Delete `libexpat` and `libxml2` references. No longer used by curl.
- Delete `Edit the path below...` comments. We recommend to predefine
  those envvars instead.
- `libcares.a` is not an internal dependency anymore. Stop using it as
  such.
- `windres` `--include-dir` -> `-I`, `-F` -> `--target=` for readability.
- Delete `STRIP`, `CURL_STRIP`, `AR` references from `src/Makefile.m32`.
  They were never used.
- Stop to `clean` some objects twice in `src/Makefile.m32`.
- Delete cvs-specific leftovers.
- Finish resource support in examples make file.
- Delete `-I<root>/lib` from examples make file.
- Fix copyright start year in examples make file.
- Delete duplicate `ftpuploadresume` input in examples make file.
- Sync OpenSSL lib order, `SYNC` support, `PROOT` use, dependency path
  defaults, variables names and other internal bits between the three
  make files.
- `lib/Makefile.m32` accepted custom options via `DLL_LIBS` envvar. This
  was lib-specific and possibly accidental. Use `CURL_LDFLAG_EXTRAS_DLL`
  envvar for the same effect.
- Fix linking `curl.exe` and examples to wrong static libs with
  auto-detected OpenSSL 1.0.2 or earlier.
- Add `-lgdi32` for OpenSSL 1.0.2 and earlier only.
- Add link to Novell LDAP SDK and use a relative default path. Latest
  version is from 2016, linked to an outdated OpenSSL 1.0.1.
- Whitespace and comment cleanups.

TODO in a next commit:

Delete built-in detection/logic for OpenSSL 1.0.2 and earlier, the Novell
LDAP SDK and the other LDAP SDK (which is _not_ OpenLDAP). Write up the
necessary custom envvars to configure them.

Closes #9616

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 30 Sep 2022 08:46:12 +0000 (10:46 +0200)] 
RELEASE-NOTES: synced

3 years agoHTTP3.md: update Caddy example
Matt Holt [Thu, 29 Sep 2022 18:42:00 +0000 (12:42 -0600)] 
HTTP3.md: update Caddy example

Closes #9623

3 years agoeasy: fix the altsvc init for curl_easy_duphandle
Daniel Stenberg [Thu, 29 Sep 2022 20:50:45 +0000 (22:50 +0200)] 
easy: fix the altsvc init for curl_easy_duphandle

It was using the old #ifdef which nothing sets anymore

Closes #9624

3 years agoGHA: build tests in a separate step from the running of them
Daniel Stenberg [Thu, 29 Sep 2022 10:26:04 +0000 (12:26 +0200)] 
GHA: build tests in a separate step from the running of them

... to make the output smaller for when you want to look at test
failures.

Removed the examples build from msh3

Closes #9619

3 years agoldap: delete stray CURL_HAS_MOZILLA_LDAP reference
Viktor Szakats [Thu, 29 Sep 2022 21:29:53 +0000 (21:29 +0000)] 
ldap: delete stray CURL_HAS_MOZILLA_LDAP reference

Added in 68b215157fdf69612edebdb220b3804822277822, while adding openldap
support. This is also the single mention of this constant in the source
tree and also in that commit. Based on these, it seems like an accident.

Delete this reference.

Reviewed-by: Daniel Stenberg
Closes #9625

3 years agodocs: spelling nits
Viktor Szakats [Thu, 29 Sep 2022 21:29:04 +0000 (21:29 +0000)] 
docs: spelling nits

- MingW -> MinGW (Minimalist GNU for Windows)
- f.e. -> e.g.
- some whitespace and punctuation.

Reviewed-by: Daniel Stenberg
Closes #9622

3 years agocirrus-ci: add macOS build with m1
Philip H [Wed, 21 Sep 2022 18:46:33 +0000 (20:46 +0200)] 
cirrus-ci: add macOS build with m1

Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Closes #9565

3 years agolib: sanitize conditional exclusion around MIME
Patrick Monnerat [Wed, 28 Sep 2022 16:12:15 +0000 (18:12 +0200)] 
lib: sanitize conditional exclusion around MIME

The introduction of CURL_DISABLE_MIME came with some additional bugs:
- Disabled MIME is compiled-in anyway if SMTP and/or IMAP is enabled.
- CURLOPT_MIMEPOST, CURLOPT_MIME_OPTIONS and CURLOPT_HTTPHEADER are
  conditioned on HTTP, although also needed for SMTP and IMAP MIME mail
  uploads.

In addition, the CURLOPT_HTTPHEADER and --header documentation does not
mention their use for MIME mail.

This commit fixes the problems above.

Closes #9610

3 years agodocs: minor grammar fixes
Thiago Suchorski [Tue, 27 Sep 2022 16:53:54 +0000 (13:53 -0300)] 
docs: minor grammar fixes

Closes #9609

3 years agoCURLSHOPT_UNLOCKFUNC.3: the callback as no 'access' argument
Daniel Stenberg [Wed, 28 Sep 2022 13:44:23 +0000 (15:44 +0200)] 
CURLSHOPT_UNLOCKFUNC.3: the callback as no 'access' argument

Probably a copy and paste error from the lock function man page.

Reported-by: Robby Simpson
Fixes #9612
Closes #9613

3 years agoCURLOPT_ACCEPT_ENCODING.3: remove "four" as they are five
Daniel Stenberg [Wed, 28 Sep 2022 14:10:46 +0000 (16:10 +0200)] 
CURLOPT_ACCEPT_ENCODING.3: remove "four" as they are five

... instead just list the supported encodings.

Reported-by: ProceduralMan on github
Fixes #9614
Closes #9615

3 years agotests: Remove a duplicated keyword
Dan Fandrich [Wed, 28 Sep 2022 17:57:10 +0000 (10:57 -0700)] 
tests: Remove a duplicated keyword

3 years agodocs: document more server names for test files
Dan Fandrich [Wed, 28 Sep 2022 17:56:31 +0000 (10:56 -0700)] 
docs: document more server names for test files

3 years agoaltsvc: reject bad port numbers
Daniel Stenberg [Tue, 27 Sep 2022 15:20:23 +0000 (17:20 +0200)] 
altsvc: reject bad port numbers

The existing code tried but did not properly reject alternative services
using negative or too large port numbers.

With this fix, the logic now also flushes the old entries immediately
before adding a new one, making a following header with an illegal entry
not flush the already stored entry.

Report from the ongoing source code audit by Trail of Bits.

Adjusted test 356 to verify.

Closes #9607

3 years agofunctypes: provide the recv and send arg and return types
Daniel Stenberg [Mon, 26 Sep 2022 09:45:18 +0000 (11:45 +0200)] 
functypes: provide the recv and send arg and return types

This header is for providing the argument types for recv() and send()
when built to not use a dedicated config-[platfor].h file.

Remove the slow brute-force checks from configure and cmake.

This change also removes the use of the types for select, as they were
not used in code.

Closes #9592

3 years agourlapi: reject more bad characters from the host name field
Daniel Stenberg [Tue, 27 Sep 2022 15:48:08 +0000 (17:48 +0200)] 
urlapi: reject more bad characters from the host name field

Extended test 1560 to verify

Report from the ongoing source code audit by Trail of Bits.

Closes #9608

3 years agoconfigure: deprecate builds with small curl_off_t
Daniel Stenberg [Tue, 27 Sep 2022 09:13:21 +0000 (11:13 +0200)] 
configure: deprecate builds with small curl_off_t

If curl_off_t turns out to be smaller than 8 bytes,
--with-n64-deprecated needs to be used to allow the build to
continue. This is to highlight the fact that support for such builds is
going away next year.

Also mentioned in DEPRECATED.md

Closes #9605

3 years agohttp, vauth: always provide Curl_allow_auth_to_host() functionality
Patrick Monnerat [Mon, 26 Sep 2022 23:01:16 +0000 (01:01 +0200)] 
http, vauth: always provide Curl_allow_auth_to_host() functionality

This function is currently located in the lib/http.c module and is
therefore disabled by the CURL_DISABLE_HTTP conditional token.

As it may be called by TLS backends, disabling HTTP results in an
undefined reference error at link time.

Move this function to vauth/vauth.c to always provide it and rename it
as Curl_auth_allowed_to_host() to respect the vauth module naming
convention.

Closes #9600

3 years agongtcp2: fix C89 compliance nit
Daniel Stenberg [Tue, 27 Sep 2022 07:06:37 +0000 (09:06 +0200)] 
ngtcp2: fix C89 compliance nit

3 years agoopenssl: make certinfo available for QUIC
Daniel Stenberg [Mon, 26 Sep 2022 14:19:50 +0000 (16:19 +0200)] 
openssl: make certinfo available for QUIC

Curl_ossl_certchain() is now an exported function in lib/vtls/openssl.c that
can also be used from quiche.c and ngtcp2.c to get the cert chain for QUIC
connections as well.

The *certchain function was moved to the top of the file for this reason.

Reported-by: Eloy Degen
Fixes #9584
Closes #9597

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 27 Sep 2022 11:09:44 +0000 (13:09 +0200)] 
RELEASE-NOTES: synced

3 years agoDEPRECATE.md: Support for systems without 64 bit data types
Daniel Stenberg [Tue, 27 Sep 2022 08:42:36 +0000 (10:42 +0200)] 
DEPRECATE.md: Support for systems without 64 bit data types

Closes #9604

3 years agotests: skip mime/form tests when mime is not built-in
Patrick Monnerat [Mon, 26 Sep 2022 13:38:41 +0000 (15:38 +0200)] 
tests: skip mime/form tests when mime is not built-in

Closes #9596

3 years agourl: rename function due to name-clash in Watt-32
Daniel Stenberg [Tue, 27 Sep 2022 07:32:20 +0000 (09:32 +0200)] 
url: rename function due to name-clash in Watt-32

Follow-up to 2481dbe5f4f58 and applies the change the way it was
intended.

3 years agowindows: adjust name of two internal public functions
Viktor Szakats [Mon, 26 Sep 2022 22:31:09 +0000 (22:31 +0000)] 
windows: adjust name of two internal public functions

According to `docs/INTERNALS.md`, internal function names spanning source
files start with uppercase `Curl_`. Bring these two functions in
alignment with this.

This also stops exporting them from `libcurl.dll` in autotools builds.

Reviewed-by: Daniel Stenberg
Closes #9598

3 years agourl: rename function due to name-clash in Watt-32
Gisle Vanem [Sat, 24 Sep 2022 18:58:09 +0000 (20:58 +0200)] 
url: rename function due to name-clash in Watt-32

Since the commit 764c958c52edb427f39, there was a new function called
resolve_ip(). This clashes with an internal function in Watt-32.

Closes #9585

3 years agoschannel: ban server ALPN change during recv renegotiation
Jay Satiro [Fri, 9 Sep 2022 19:33:47 +0000 (15:33 -0400)] 
schannel: ban server ALPN change during recv renegotiation

By the time schannel_recv is renegotiating the connection, libcurl has
already decided on a protocol and it is too late for the server to
select a protocol via ALPN except for the originally selected protocol.

Ref: https://github.com/curl/curl/issues/9451

Closes https://github.com/curl/curl/pull/9463

3 years agourl: a zero-length userinfo part in the URL is still a (blank) user
Daniel Stenberg [Sun, 25 Sep 2022 09:17:04 +0000 (11:17 +0200)] 
url: a zero-length userinfo part in the URL is still a (blank) user

Adjusted test 1560 to verify

Reported-by: Jay Satiro
Fixes #9088
Closes #9590

3 years agoautotools: allow --enable-symbol-hiding with windows
Viktor Szakats [Sun, 25 Sep 2022 22:19:13 +0000 (22:19 +0000)] 
autotools: allow --enable-symbol-hiding with windows

This local autotools logic was put in place in
9e24b9c7afbcb81120af4cf3f6cdee49a06d8224 (in 2012) which disabled it for
Windows unconditionally. Testing reveals that it actually works with
tested toolchains (mingw-w64 and CI ones), so let's allow this build
feature on that platform. Bringing this in sync with CMake, which already
supported this.

Reviewed-by: Jay Satiro
Closes #9586

3 years agoautotools: reduce brute-force when detecting recv/send arg list
Viktor Szakats [Sun, 25 Sep 2022 21:58:21 +0000 (21:58 +0000)] 
autotools: reduce brute-force when detecting recv/send arg list

autotools uses brute-force to detect `recv`/`send`/`select` argument
lists, by interating through _all_ argument type combinations on each
`./configure` run. This logic exists since
01fa02d0b545e1433dced2430561f8c0c72b74a9 (from 2006) and was a bit later
extended with Windows support.

This results in a worst-case number of compile + link cycles as below:
- `recv`: 96
- `send`: 192
- `select`: 60
Total: 348 (the number of curl C source files is 195, for comparison)

Notice that e.g. curl-for-win autotools builds require two `./configure`
invocations, doubling these numbers.

`recv` on Windows was especially unlucky because `SOCKET` (the correct
choice there) was listed _last_ in one of the outer trial loops. This
resulted in lengthy waits while autotools was trying all invalid
combinations first, wasting cycles, disk writes and slowing down
iteration.

This patch reduces the amount of idle work by reordering the tests in
a way to succeed first on a well-known platform such as Windows, and
also on non-Windows by testing for POSIX prototypes first, on the
assumption that these are the most likely candidates these days. (We do
not touch `select`, where the order was already optimal for these
platforms.)

For non-Windows, this means to try a return value of `ssize_t` first,
then `int`, reordering the buffer argument type to try `void *` first,
then `byte *`, and prefer the `const` flavor with `send`. If we are
here, also stop testing for `SOCKET` type in non-Windows builds.

After the patch, detection on Windows is instantaneous. It should also be
faster on popular platforms such as Linux and BSD-based ones.

If there are known-good variations for other platforms, they can also be
fast-tracked like above, given a way to check for that platform inside
the autotools logic.

Reviewed-by: Daniel Stenberg
Closes #9591

3 years agoTODO: Provide the error body from a CONNECT response
Daniel Stenberg [Fri, 23 Sep 2022 12:10:10 +0000 (14:10 +0200)] 
TODO: Provide the error body from a CONNECT response

Spellchecked-by: Jay Satiro
Closes #9513
Closes #9581

3 years agowindows: autotools .rc warnings fixup
Viktor Szakats [Fri, 23 Sep 2022 19:39:18 +0000 (19:39 +0000)] 
windows: autotools .rc warnings fixup

Move `LT_LANG([Windows Resource])` after `XC_LIBTOOL`, fixing:

- Warnings when running `autoreconf -fi`.

- Warning when compiling .rc files:
  libtool: compile: unable to infer tagged configuration
  libtool:   error: specify a tag with '--tag'

Follow up to 6de7322c03d5b4d91576a7d9fc893e03cc9d1057
Ref: https://github.com/curl/curl/pull/9521#issuecomment-1256291156

Suggested-by: Patrick Monnerat
Closes #9582

3 years agocurl_setup: disable use of FLOSS for 64-bit NonStop builds
Randall S. Becker [Thu, 22 Sep 2022 14:49:13 +0000 (08:49 -0600)] 
curl_setup: disable use of FLOSS for 64-bit NonStop builds

Older 32-bit builds currently need FLOSS. This dependency may be removed
in future OS releases.

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Closes #9575

3 years agotool: remove dead code
Patrick Monnerat [Fri, 23 Sep 2022 09:51:06 +0000 (11:51 +0200)] 
tool: remove dead code

Add a debug assertion to verify protocols included/excluded in a set
are always tokenized.

Follow-up to commit 677266c.

Closes #9576

3 years agolib: prepare the incoming of additional protocols
Patrick Monnerat [Thu, 22 Sep 2022 13:27:04 +0000 (15:27 +0200)] 
lib: prepare the incoming of additional protocols

Move the curl_prot_t to its own conditional block. Introduce symbol
PROTO_TYPE_SMALL to control it.

Fix a cast in a curl_prot_t assignment.
Remove an outdated comment.

Follow-up to cd5ca80.

Closes #9534

3 years agomsh3: change the static_assert to make the code C89
Daniel Stenberg [Wed, 21 Sep 2022 08:36:41 +0000 (10:36 +0200)] 
msh3: change the static_assert to make the code C89

3 years agobearssl: make it proper C89 compliant
Daniel Stenberg [Wed, 21 Sep 2022 08:32:54 +0000 (10:32 +0200)] 
bearssl: make it proper C89 compliant

3 years agocurl-compilers.m4: for gcc + want warnings, set gnu89 standard
Daniel Stenberg [Tue, 20 Sep 2022 08:56:44 +0000 (10:56 +0200)] 
curl-compilers.m4: for gcc + want warnings, set gnu89 standard

To better verify that the code is C89

Closes #9542

3 years agolib517: fix C89 constant signedness
Patrick Monnerat [Thu, 22 Sep 2022 10:35:52 +0000 (12:35 +0200)] 
lib517: fix C89 constant signedness

In C89, positive integer literals that overflow an int but not an
unsigned int may be understood as a negative int.

lib517.c:129:3: warning: this decimal constant is unsigned only in ISO C90
   {"Sun, 06 Nov 2044 08:49:37 GMT", 2362034977 },
   ^

Closes #9572

3 years agomprintf: use snprintf if available
Daniel Stenberg [Thu, 22 Sep 2022 09:52:08 +0000 (11:52 +0200)] 
mprintf: use snprintf if available

This is the single place in libcurl code where it uses the "native"
s(n)printf() function. Used for writing floats. The use has been
reviewed and vetted and uses a HUGE target buffer, but switching to
snprintf() still makes this safer and removes build-time warnings.

Reported-by: Philip Heiduck
Fixes #9569
Closes #9570