dnsd now opens UDP+TCP sockets and accepts http: DoH requests to obtain
the same, configured answers (records, delays, error codes) as over UDP.
DoH: use `async->queries_ongoing` like all other resolvers instead of
the internal `pending` counter. Fixes waiting for results.
Tests: in pytest, parameterize dnsd tests to use both DNS and DoH.
Closes#22506
And drop:
- Consider OCSP stapling by default
It is a practice that is going out-of-style, so doing this by default now
seems wrong.
- Provide callback for cert verification
We have lots of options already. Let's not do this.
Closes#22504
- convert the method switch() to a simple table
- avoid converting the methods from external to internal numbers, they were
the same anyway so keep the external ones, just use the old defines.
- fix range check. It wrongly used the method numbers as bitmask, which made
the check not work previously. Also error on OOM.
- Dropped the session-id check. It too wrongly did a bitmask check which was
wrong and never worked. When fixed, it broke test cases so I dropped the
entire check.
- split out rtsp_setup_request() from rtsp_do()
- replace the httpversion variable with a define
Closes#22505
- makes test names less complicated
- makes them less likely to wrap lines when using narrow terminals
- runtests now returns error for the test if the name is longer
- replace the "..." with a singe space
Closes#22492
On Windows, the init code calls `SetConsoleCtrlHandler()`, and before
this patch also set handlers for all Unixy signals. Of these, `SIGBREAK`
(used on Windows-only), `SIGINT`, `SIGABRT` and `SIGTERM` were also
setting up a `SetConsoleCtrlHandler()`, in addition to the call made
directly. (The rest, `SIGHUP`, `SIGPIPE`, `SIGALRM` are either missing
the macros, or ignored by `signal()` on Windows.)
As per WINE sources, `SetConsolCtrlHandler(<h>, TRUE)` calls are
additive, which means the test server set up two console ctrl handlers.
Then the ctrl handler set directly (`ctrl_event_handler()`), was
triggering the other signal handler via `raise()`, for the 'initiate
exit' logic, which in turn triggered exiting a wait within `select_ws()`
and other loops. The Windows window handler also made use of the
`SIGTERM` event to initiate exit via `raise()` and the second signal
handler.
To simplify, de-duplicate the ctrl handlers by dropping `signal()` calls
and keeping the direct Win32 call with `ctrl_event_handler()` doing all
the signal handling on Windows. Break out the 'initiate exit' logic into
a function and call it from both Unix and Windows signal/ctrl/window
handlers. Also drop calling `raise()` on exit, because it's a no-op
without a `signal()` pair.
Also:
- drop logging the actual ctrl type number, replace with just logging
whether we handled the event, in `ctrl_event_handler()`. To avoid
using non-signal-safe functions (e.g. `fprintf()`) from the handler.
- also replace `logmsg()` with `WriteFile()` to prevent regressions.
Ref: #22045
- replace `logmsg()` with `WriteFile()` in `main_window_proc()`.
- fix to forward ctrl handling to the OS in the rare case of failed
`exit_event` initialization on startup. To swap a possible hang
(within `WaitForMultipleObjectsEx()`) with an ungraceful shutdown.
- add support for an 'exit message' string, set by signal/ctrl handlers,
and log it on app exit. To avoid the need to deal with logging within
the handlers, yet have a static trace message about the event.
Complementing the already logged signal number.
- drop stderr trace message from `exit_signal_handler()` in favor of an
exit message. runtests triggers it frequantly, which added much noise
to stderr. As a bonus, this also allows dropping the compiler warning
suppression.
Reported-by: Stefan Eissing
Bug: https://github.com/curl/curl/pull/22487#issuecomment-5204092974
Follow-up to 3aae64e4fb#22507
Refs:
https://learn.microsoft.com/windows/console/setconsolectrlhandlerhttps://learn.microsoft.com/windows/console/registering-a-control-handler-functionhttps://learn.microsoft.com/cpp/c-runtime-library/reference/raisehttps://learn.microsoft.com/cpp/c-runtime-library/reference/signalhttps://gitlab.winehq.org/wine/wine/-/blob/wine-11.14/dlls/kernelbase/console.c#L1517-1526d6e817a4cc/misc/signal.cpp (L286-L348)
Follow-up to fe28fcf04c7dc8a981fa0e058776c0#5260Closes#22487
In year 2020 the Unixy signal handler received a `logmsg()` call to log
the signal number, but at the same time it already saved it to a global
variable and logged it on exit, meaning this extra `logmsg()` was
redundant. Because `logmsg()` is not signal-safe, this call was replaced
in 2025 with signal-safe logging, but without the signal number, while
also adding complexity, spent on trying to open the log file and handle
errors. All for nothing, because the signal number was logged all along.
This patch removes all this, and simplifies it to a single, signal-safe
`write()` to STDERR to say that the signal handler triggered. This is
also non-critical, but may help debugging.
Also: point the POSIX documentation to the 2004 revision, which has a
shorter list of safe functions. (was: 2018)
Follow-up to e95f509c66#16852
Follow-up to 9869f6dc5a#5218Closes#22507
To share more common code between servers, and to log the same set of
information for all of them.
Also:
- move server unix socket to global variable.
Follow-up to d1eca3861c#22501
Follow-up to 1637bbc9ce#22498Closes#22503
To sync with the rest of code which already handled `got_exit_signal`
and did the restoration on exit. Also syncing with rest of servers.
Also: turn off `keep_sigalrm` to sync with most servers.
Closes#22499
Replace `ipv_inuse` and `use_ipv6` with `socket_type` and
`socket_domain` (where missing) to avoid dupliicate globals with
overlapping purposes. The replacement variables also support Unix
sockets.
Also:
- simplify/reduce IPv6 guards.
- socksd: fix to reset `socket_domain` for `--ipv4` option.
Closes#22498
Before this patch modern systems used `sigaction()` and `SA_RESTART` to
install signal handlers, but the signal handler function itself still
made a call to the legacy `signal()` function to re-register itself
before returning.
Re-registering the handler is not necessary with `sigaction()`. It's
also undesired to use the legacy API when the modern one is available.
Fix by guarding off this call in builds that support the modern API.
Follow-up to 3fb6e5a010#6529
Follow-up to 18cbb4d7d6Closes#22497
Torture jobs are arguably the most flaky nowadays. Make a blind try to
see if re-enabling taskkill makes an observable improvement for torture.
Follow-up to 208b87744e#21039
Follow-up to f450f3801b#19897
Follow-up to 2701ac6a4d#19421Closes#22495
Historically servers used the deprecated `siginterrupt()` function to
configure restart behavior on specific signals. It accepts a flag, where
1 means to remove the `SA_RESTART` option, and 0 means to enable it.
In year 2021 3fb6e5a010 introduced the
modern alternative to the codebase, replacing `siginterrupt()` with
`sigaction()`. After this patch, supporting, modern, systems reacted on
the same flag, but, by accident, set the `SA_RESTART` bit when flag is
1, and did not set it when 0. This reversed the previous behavior, and
the one still used on the `siginterrupt()` legacy codepath.
Fix it by revesring the `SA_RESTART` logic for the `sigaction()`
codepath, syncing it with the pre-existing behavior.
I find it odd this did not cause any perceivable issue for 5 years, even
though it's the active one in most Unix envs.
Spotted by GitHub Code Quality, though suggesting to fix
`siginterrupt()` calls. But looking into the history, those were correct
all along.
Refs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/siginterrupt.htmlhttps://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.htmlhttps://www.man7.org/linux/man-pages/man3/siginterrupt.3.htmlhttps://www.man7.org/linux/man-pages/man2/sigaction.2.html
Follow-up to 3fb6e5a010#6529Closes#22037
The necessary cryptography API is provided by nettle 3.1+, via its
'hogweed' library. The minimum GnuTLS version required by curl is 3.6.5,
which requires nettle 3.4.1+, so the API is always available.
Also:
- autotools: detect and use nettle's hogweed library.
- cmake/FindNettle: add support for the hogweed library.
- GHA/http3-linux: enable in the autotools/cmake GnuTLS jobs.
Ref: 4353ea025aCloses#22456
These functions were previously untested in the test suite. This is just
a set of basic invokes to make sure they work. The core of these
functions is identical and is tested already.
- curl_mvfprintf
- curl_mvprintf
- curl_mvsnprintf
- curl_mvsprintf
- curl_mvaprintf
Closes#22472
The expire timers
- DNS_PER_NAME
- DNS_PER_NAME2
- HAPPY_EYEBALLS_DNS
are unused since we changed our happy eyeballing and handling of partial
resolve results.
Closes#22468
- update `actions/checkout` from 7.0.0 to 7.0.1
- update `actions/labeler` from 6.1.0 to 7.0.0
- update `github/codeql-action/analyze` from 4.36.2 to 4.37.3
- update `github/codeql-action/init` from 4.36.2 to 4.37.3
- update `cryptography` from 48.0.1 to 49.0.0
- update `filelock` from 3.29.0 to 3.32.0
- update `impacket` from 0.13.0 to 0.13.1
- update `pytest` from 9.0.3 to 9.1.1
- update `websockets` from 16.0 to 16.1.1
Closes#22458Closes#22459
Sync fallback logic with other crypto algos to:
- allow falling back to the next backend candidate when wolfSSL does not
have ed25519 built in.
- de-duplicate fallback code.
Follow-up to a55731050e#22386#21239Closes#22450
When sending with sendmsg_x(), fix handling of last gso chunk being
smaller. Handle partial results correctly. Ignore SOCKEMSGSIZE by
reporting success which drops PMTUD probes into the void.
Closes#22429
- docs/cmdline-opts/.gitignore: also ignore `manpage.tmp.*`.
Follow-up to a55731050e#22386#21239
- ./.gitignore: drop obsolete entries.
Follow-up to 4f38db1d28#1923Closes#22445