Commit Graph

31104 Commits

Author SHA1 Message Date
Viktor Szakats
d82b080f63
cmake: disable unity mode with Windows Unicode + TrackMemory
"TrackMemory" is `ENABLE_DEBUG=ON` (aka `ENABLE_CURLDEBUG=ON`,
aka `-DCURLDEBUG`).

There is an issue with memory tracking and Unicode when built in "unity"
mode, which results in the curl tool crashing right on startup, even
without any command-line option. Interestingly this doesn't happen under
WINE (at least on the system I tested this on), but consistenly happens
on real Windows machines. Crash is 0xC0000374 heap corruption. Both
shared and static curl executables are affected.

This limitation probably won't hit too many people, but it remains
a TODO to find and fix the root cause and drop this workaround.

Example builds and runs:
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd7iwj#L313 (static)
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tbyqu9c#L317 (shared)

Follow-up to 3f8fc25720 #11095

Ref: #11928
Closes #12005
2023-10-02 23:28:18 +00:00
Viktor Szakats
4e8a3a1fc8
cmake: tidy-up NOT_NEED_LBER_H detection
Follow-up to 772f0d8edf #12006
2023-10-02 22:58:37 +00:00
Viktor Szakats
75078a415d
appveyor: rewrite batch in PowerShell + CI improvements
1. Rewrite in PowerShell:

- rewrite MS-DOS batch build script in PowerShell.
- move some bash operations into native PowerShell.
- fixups for PowerShell insisting on failure when a command outputs
  something to stderr.
- fix to actually run `curl -V` after every build.
  (and exclude ARM64 builds.)
- also say why we skipped `curl -V` if we had to skip.
- fix CMake warnings about unused configuration variables, by adapting
  these dynamically for build cases.
- dedupe OpenSSL path into a variable.
- disable `test1451` failing with a warning anyway due to missing python
  impacket. (after trying and failing to install impacket)
  PowerShell promotes these warnings to errors by PowerShell. We can also
  suppress they wholesale if they start causing issues in the future,
  like we already to with `autoreconf` and `./configure`.

PowerShell is better than MS-DOS batches, so the hope is this makes it
easier to extend and maintain the AppVeyor build logic. POSIX/bash isn't
supported inline by AppVeyor on Windows build machines, but we are okay
to keep it in an external script, so it's also an option.

2. CI improvements:

- enable tests for a "unity" build job.
- speed-up CI initialization by using shallow clones of the curl repo.
- speed-up CMake MSVC jobs with `TrackFileAccess=false`.
- enable parallelism in `VisualStudioSolution` builds.
- display CMake version before builds.
- always show the CPU in job names.
- tell which jobs are build-only in job names.
- move `TESTING:` value next to `DISABLED_TESTS:` in two jobs.
- add `config.log` (autotools) to dumped logs (need to enable manually).

3. Style:

- use single-quotes in YAML like we do in other CI YAML files.
  It also allows to drop quoting characters and lighter to write/read.
  (keep double quotes for PowerShell strings needing expansion.)

Closes #11999
2023-10-02 22:47:23 +00:00
Viktor Szakats
772f0d8edf
cmake: fix HAVE_LDAP_SSL, HAVE_LDAP_URL_PARSE on non-Windows
- set `HAVE_LDAP_URL_PARSE` if `ldap_url_parse` function exists.
  Before this patch we set it based it on the presence of `stricmp`,
  which correctly enabled it on e.g. Windows, but was inaccurate for
  other platforms.

- always set `HAVE_LDAP_SSL` if an LDAP backend is detected and
  LDAPS is not explicitly disabled. This mimics autotools behaviour.
  Previously we set it only for Windows LDAP. After this fix, LDAPS is
  correctly enabled in default macOS builds.

- enable LDAP[S] for a CMake macOS CI job. Target OS X 10.9 (Mavericks)
  to avoid deprecation warnings for LDAP API.

- always detect `HAVE_LDAP_SSL_H`, even with LDAPS explicitly disabled.
  This doesn't make much sense, but let's do it to sync behaviour with
  autotools.

- fix benign typo in variable name.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12006
2023-10-02 22:19:47 +00:00
Viktor Szakats
4c6365af02
autotools: restore HAVE_IOCTL_* detections
This restores `CURL_CHECK_FUNC_IOCTL` detection. I deleted it in
4d73854462 and
c3456652a0 (2022-08), because the
`HAVE_IOCTL` result it generated was unused in the source. But,
I did miss the fact that this had two dependent checks:
`CURL_CHECK_FUNC_IOCTL_FIONBIO`,
`CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR` that we do actually need:
`HAVE_IOCTL_FIONBIO`, `HAVE_IOCTL_SIOCGIFADDR`.

Regression from 4d73854462

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12008
2023-10-02 21:19:23 +00:00
Daniel Stenberg
2a5f6b60b3
RELEASE-PROCEDURE.md: updated coming release dates 2023-10-02 13:31:51 +02:00
Daniel Stenberg
6d8dd746f1
RELEASE-NOTES: synced 2023-10-02 09:41:33 +02:00
Viktor Szakats
fa95f7ee87
cmake: pre-cache HAVE_POLL_FINE on Windows
Windows doesn't support `poll()`, so we can safely skip checking for
fine poll.

Closes #12003
2023-10-01 18:02:25 +00:00
Viktor Szakats
c39585d9b7
gha: bump actions to latest versions
- actions@checkout@v4 (from v3 and v2)

- fsfe/reuse-action@v2 (from v1)

Closes #12000
2023-10-01 12:16:23 +00:00
Stefan Eissing
6b9a591bf7
h2: testcase and fix for pausing h2 streams
- refs #11982 where it was noted that paused transfers may
  close successfully without delivering the complete data
- made sample poc into tests/http/client/h2-pausing.c and
  added test_02_27 to reproduce

Closes #11989
Fixes #11982
Reported-by: Harry Sintonen
2023-09-30 23:53:33 +02:00
Viktor Szakats
717c15f8c0
cmake: validate CURL_DEFAULT_SSL_BACKEND config value
Before this patch CMake builds accepted any value and it was used at
runtime as-is. This patch make sure that the selected default backend
is also enabled in the build. It also enforces a full lowercase value.

This improves reproducibility and brings CMake in sync with autotools
which already worked like described above.

Follow-up to 26c7feb8b9 #11774

Closes #11998
2023-09-30 15:17:21 +00:00
Viktor Szakats
b8f6c3ca42
autotools: adjust CURL_CA_PATH value to CMake
autotools was using the same value as CMake, but with an ending
slash. Delete the ending slash to match configurations.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11997
2023-09-30 15:17:21 +00:00
Viktor Szakats
f85dcaa6d2
cmake: detect sys/wait.h and netinet/udp.h
Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11996
2023-09-30 15:17:21 +00:00
Daniel Stenberg
91878ebeca
lib: provide and use Curl_hexencode
Generates a lower case ASCII hex output from a binary input.

Closes #11990
2023-09-30 11:45:39 +02:00
Daniel Stenberg
849bd50cc9
configure: check for the capath by default
... if the chosen TLS backend supports it: OpenSSL, GnuTLS, mbedTLS or wolfSSL

cmake: synced

Assisted-by: Viktor Szakats
Closes #11987
2023-09-30 11:19:38 +02:00
Daniel Stenberg
463528b0f8
wolfssl: ignore errors in CA path
The default wolfSSL_CTX_load_verify_locations() function is quite picky
with the certificates it loads and will for example return error if just
one of the certs has expired.

With the *_ex() function and its WOLFSSL_LOAD_FLAG_IGNORE_ERR flag, it
behaves more similar to what OpenSSL does by default.

Even the set of default certs on my Debian unstable has several expired
ones.

Assisted-by: Juliusz Sosinowicz
Assisted-by: Michael Osipov

Closes #11987
2023-09-30 11:19:38 +02:00
Daniel Stenberg
5bbe732d20
create-dirs.d: clarify it also uses --output-dirs
Reported-by: Robert Simpson
Fixes #11991
Closes #11995
2023-09-30 10:15:54 +02:00
Viktor Szakats
a1d73a6bbf
appveyor: fix yamlint issues, indent
Also:
- use double quotes in all batch if statements.

Closes #11994
2023-09-30 07:05:54 +00:00
Viktor Szakats
da5dcb7007
cmake: detect HAVE_CLOCK_GETTIME_MONOTONIC_RAW
Based on existing autotools logic.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11981
2023-09-29 18:30:34 +00:00
Viktor Szakats
04a3a377d8
cmake: detect HAVE_GETADDRINFO_THREADSAFE
Based on existing autotools logic.

autotools checks for old versions of the allowlisted target OSes and
disables this feature when seeing them. In CMake we assume we're running
on newer systems and enable regardless of OS version.

autotools always runs all 3 probes for non-fast-tracked systems and
enables this feature if any one of them was successful. To save
configuration time,  CMake stops at the first successful check.

OpenBSD is not fast-tracked and then gets blocklisted as a generic BSD
system. I haven't double-checked if this is correct, but looks odd.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11979
2023-09-29 18:30:34 +00:00
Viktor Szakats
ca7daadd9b
cmake: fix HAVE_WRITABLE_ARGV detection
Move detection before the creation of detection results in
`curl_config.h`.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11978
2023-09-29 18:29:55 +00:00
Viktor Szakats
69aa8f6de4
appveyor: minor improvements
- run `curl -V` after builds to see if they run and with what features.
  Except for one job where a CRT DLL is missing. And ARM64 which should
  fail, but is silently not launched instead.

- copy libcurl DLL next to curl tool and tests binaries in shared mode.
  This makes it possible to run the tests. (We don't run tests after
  these builds yet.)

- list the DLLs and EXEs present after the builds.

- add `DEBUG` variable for CMake builds to allow disabling it, for
  testing non-debug builds. (currently enabled for all)

- add commented lines that dump CMake configuration logs for debugging
  build/auto-detection issues.

- add gcc version to jobs where missing.

- switch a job to the native MSYS2 mingw-w64 toolchain. This adds gcc 9
  to the build mix.

- make `SHARED=OFF` and `OPENSSL=OFF` defaults global.

- delete a duplicate backslash.

Closes #11976
2023-09-29 18:27:47 +00:00
Viktor Szakats
1e8c7fac42
configure: replace adhoc domain with localhost in tests
Reviewed-by: Daniel Stenberg
Closes #11988
2023-09-29 18:25:59 +00:00
Viktor Szakats
1bc69df7b4
tidy-up: use more example domains
Also make use of the example TLD:
https://en.wikipedia.org/wiki/.example

Reviewed-by: Daniel Stenberg
Closes #11992
2023-09-29 18:25:56 +00:00
Dan Fandrich
65729f65c7 runtests: display the test status if tests appear hung
It sometimes happens that a test hangs during a test run and never
returns. The test harness will wait indefinitely for the results and on
CI servers the CI job will eventually be killed after an hour or two.
At the end of a test run, if results haven't come in within a couple of
minutes, display the status of all test runners and what tests they're
running to help in debugging the problem.

This feature is really only kick in with parallel testing enabled, which
is fine because without parallel testing it's usually easy to tell what
test has hung.

Closes #11980
2023-09-29 08:58:52 -07:00
Dan Fandrich
5c006df36c github/labeler: remove workaround for labeler
This was added due to what seemed to be a bug regarding the sync-labels:
config option, but it looks like it wasn't necessary.

Follow-up to b2b0534e7
2023-09-29 08:58:52 -07:00
Viktor Szakats
ecdde58c14
docs: upgrade an URL to HTTPS in BINDINGS.md [ci skip] 2023-09-29 12:15:41 +00:00
Daniel Stenberg
21498a168e
docs: replace made up domains with example.com
in FAQ and MANUAL.md

- example.com was made for this purpose.

- reduces the risk that one of those domains suddenly start hosting
  something nasty and we provide links to them

Closes #11986
2023-09-29 13:49:43 +02:00
Michael Osipov
4266dd9684
acinclude.m4: Document proper system truststore on FreeBSD
The default system truststore on FreeBSD has been /etc/ssl/certs for many
years now. It is managed canonically through certctl(8) and contains hashed
symlinks for OpenSSL and other TLS providers.
The previous ones require security/ca_root_nss which might not be installed or
will not contain any custom CA certificates.

Closes #11985
2023-09-29 13:19:43 +02:00
Daniel Stenberg
1afc8a7df0
FAQ: How do I upgrade curl.exe in Windows?
This is a growing question, better answer it here to get somewhere to
point users to.

Closes #11984
2023-09-29 13:11:17 +02:00
Viktor Szakats
14b745608b
cmake: pre-cache HAVE_BASENAME for mingw-w64 and MSVC
`basename` is present in mingw-w64, missing from MSVC. Pre-cache
accordingly to make configure faster.

Notice that `basename` has a bug so we later disable it even with
mingw-w64:
781242ffa4/lib/curl_setup.h (L820-L825)

Closes #11974
2023-09-28 21:33:55 +00:00
Daniel Stenberg
9b517c8b69
cmake: add missing checks
- check for arc4random. To make rand.c use it accordingly.
- check for fcntl
- fix fseek detection
- add SIZEOF_CURL_SOCKET_T
- fix USE_UNIX_SOCKETS
- define HAVE_SNPRINTF to 1
- check for fnmatch
- check for sched_yield
- remove HAVE_GETPPID duplicate from curl_config.h
- add HAVE_SENDMSG

Ref: #11964

Co-authored-by: Viktor Szakats
Closes #11973
2023-09-28 23:00:43 +02:00
Daniel Stenberg
2ba804942f
configure: remove unused checks
- for sys/uio.h
- for fork
- for connect

Ref: #11964

Closes #11973
2023-09-28 23:00:39 +02:00
Daniel Stenberg
db07376a3e
lib: remove TIME_WITH_SYS_TIME
It is not used in any code anywhere.

Ref: #11964
Closes #11975
2023-09-28 22:58:36 +02:00
Daniel Stenberg
f11a5d2c5a
docs: update curl man page references
Detected by the manpage-syntax update

Closes #11963
2023-09-28 22:57:24 +02:00
Daniel Stenberg
2b8937ce3a
manpage-syntax: verify curl man page references
1. References to curl symbols are now checked that they indeed exist as
   man pages. This for \f references as well as the names referenced in the
   SEE ALSO section.

   Allowlist curl.1 since it is not always built in builds

2. References to curl symbols that lack section now causes warning, since that
   will prevent them from getting linked properly

3. Check for "bare" references to curl functions and warn, they should be
   references

Closes #11963
2023-09-28 22:57:22 +02:00
Daniel Stenberg
290622cea6
cmake: add check for suseconds_t
And fix the HAVE_LONGLONG define

Ref: #11964
Closes #11977
2023-09-28 22:56:24 +02:00
Viktor Szakats
a8c773845f
tidy-up: whitespace fixes
Closes #11972
2023-09-28 12:03:28 +00:00
Viktor Szakats
781242ffa4
cmake: detect TLS-SRP in OpenSSL/wolfSSL/GnuTLS
With new option `CURL_DISABLE_SRP=ON` to force-disable it.
To match existing option and detection logic in autotools.

Also:
- fix detecting GnuTLS.
  We assume `nettle` as a GnuTLS dependency.
- add CMake GnuTLS CI job.
- bump AppVeyor CMake OpenSSL MSVC job to OpenSSL 1.1.1 (from 1.0.2)
  TLS-SRP fails to detect with 1.0.2 due to an OpenSSL header bug.
- fix compiler warning when building with GnuTLS and disabled TLS-SRP.
- fix comment typos, whitespace.

Ref: #11964

Closes #11967
2023-09-28 10:50:56 +00:00
Viktor Szakats
e5bb88b8f8
tool: use our own stderr variable
Earlier this year we changed our own stderr variable to use the standard
name `stderr` (to avoid bugs where someone is using `stderr` instead of
the curl-tool specific variable). This solution needed to override the
standard `stderr` symbol via the preprocessor. This in turn didn't play
well with unity builds and caused curl tool to crash or stay silent due
to an uninitialized stderr. This was a hard to find issue, fixed by
manually breaking out one file from the unity sources.

To avoid two these two tricks, this patch implements a different
solution: Restore using our own local variable for our stderr output and
leave `stderr` as-is. To avoid using `stderr` by mistake, add a
`checksrc` rule (based on logic we already used in lib for `strerror`)
that detects any `stderr` use in `src` and points to using our own
variable instead: `tool_stderr`.

Follow-up to 06133d3e9b
Follow-up to 2f17a9b654

Closes #11958
2023-09-28 10:50:56 +00:00
Loïc Yhuel
b5bb84cbef
connect: only start the happy eyeballs timer when needed
The timeout is only used when there is a second address family, for the
delayed eyeballer.

Closes #11939
2023-09-28 10:21:32 +02:00
Daniel Stenberg
a35e2dd69c
tool_operate: free 'gateway' correctly
Pointed out by Coverity. The fix in 93885cf3a8 was incomplete.

Also removed repeated wording in IPFS related error messages.

Closes #11969
2023-09-28 10:14:38 +02:00
Stefan Eissing
0bd9e137e3
lib: move handling of data->req.writer_stack into Curl_client_write()
- move definitions from content_encoding.h to sendf.h
- move create/cleanup/add code into sendf.c
- installed content_encoding writers will always be called
  on Curl_client_write(CLIENTWRITE_BODY)
- Curl_client_cleanup() frees writers and tempbuffers from
  paused transfers, irregardless of protocol

Closes #11908
2023-09-28 10:00:13 +02:00
Loïc Yhuel
d39863d27a
multi: round the timeout up to prevent early wakeups
Curl_timediff rounds down to the millisecond, so curl_multi_perform can
be called too early, then we get a timeout of 0 and call it again.

The code already handled the case of timeouts which expired less than
1ms in the future.  By rounding up, we make sure we will never ask the
platform to wake up too early.

Closes #11938
2023-09-28 09:52:20 +02:00
Daniel Stenberg
5a904a6938
RELEASE-NOTES: spell out that IPFS is via gateway 2023-09-28 09:49:43 +02:00
Daniel Stenberg
915949e89c
RELEASE-NOTES: synced 2023-09-28 09:42:52 +02:00
Daniel Stenberg
c50cbac0f0
tool_operate: avoid strlen() -1 on zero length content from file
Follow-up to 65b563a96a

Closes #11959
2023-09-28 09:24:57 +02:00
Daniel Stenberg
93885cf3a8
tool_operate: fix memory mixups
Switch to plain getenv() from curl_getenv() to avoid the allocation and
having to keep track of which free() or curl_free() that need to be
used.

Coverity found issues and a memory leak.

Follow-up to 65b563a96a

Closes #11959
2023-09-28 09:24:57 +02:00
Viktor Szakats
a7f8d04ee0
curl-functions.m4: fixup recent bad edits
Follow-up to 96c29900bc #11940

Closes #11966
2023-09-27 12:58:49 +00:00
Daniel Stenberg
d14089df01
curl-functions.m4: fix include line
This made the getaddrinfo detection fail, but we did not spot it in the
CI because it graciously falled back to using legacy functions instead!

Follow-up to 96c29900bc (#11940)

Closes #11965
2023-09-27 14:38:42 +02:00