## Problem Windows builds break with a current local toolchain (Scoop LLVM 22.1.8, CMake 4.4.0, VS 2026), in two independent ways: 1. The build stops at curl's deliberate guard: `#error "no non-blocking method was found/used/set"` in `third-party/curl/lib/nonblock.c`. 2. From the second configure onward, `cmake --build` re-runs CMake in an endless loop (observed 42 consecutive reconfigure cycles in a single build). Likely the same mechanism behind the "endlessly building" VS 2026 note in `docs/setup/dev/vs.md`. ## Root cause 1. `third-party/curl/CMake/CurlTests.c` passes `int *` to `ioctlsocket()`, whose third parameter is `u_long *`. Clang 22 promotes `-Wincompatible-pointer-types` to a hard error in C, so the `HAVE_IOCTLSOCKET_FIONBIO` try_compile silently fails and `curl_config.h` never defines it. Upstream CI does not see this because the windows-2022 runner image ships an older LLVM. GCC 14 promotes the same warning to a hard error, which is very likely the `CurlTests.c.obj` failure reported from MSYS2 in open-goal/jak-project#3551. Upstream curl hit the identical problem with GCC 14 and fixed the probe in curl 8.8.0 (curl/curl#13578). 2. The root CMakeLists copies the build tree's `compile_commands.json` into `<src>/build/` for clangd using `configure_file()`, which registers its input as a configure dependency. CMake rewrites `compile_commands.json` late in every generation, after `CTestTestfile.cmake` and `cmake_install.cmake` (outputs of the same Ninja regen rule), so once the dependency is registered the rule is deterministically dirty and every `ninja` invocation re-runs CMake. A pristine first configure is safe (the file does not exist yet, so the `if(EXISTS ...)` guard skips the copy), which is why the loop looks machine- or IDE-specific. ## Fix 1. Per review, re-vendor `third-party/curl` at the `curl-8_21_0` tag (previously `curl-8_3_0`), which carries the upstream probe fix plus two years of upstream development; `vendor.yaml` updated to match. Adjustments the version jump forced: - curl 8.15 removed the native macOS Secure Transport backend (`CURL_USE_SECTRANSP`), so macOS now builds curl against OpenSSL like Linux. The two macOS workflows install Homebrew `openssl@3` and export `OPENSSL_ROOT_DIR` (keg-only), and the macOS setup docs gained the same two lines. - `CURL_BROTLI` / `CURL_ZSTD` switched to AUTO-detection in curl 8.10; pinned OFF to keep the previous no-compression behavior and avoid silently linking whatever the CI images happen to have. - curl's new top-level `BUILD_EXAMPLES` cache option (default ON) leaked into discord-rpc's identically named option and broke configure at a nonexistent `examples/send-presence` directory; pinned OFF ahead of the third-party subdirectories. The diff is dominated by the mechanical tag-tree swap under `third-party/curl` (linguist-vendored, collapsed in review). The hand-written changes are `CMakeLists.txt`, the two macOS workflows, `docs/setup/system/macos.md`, and `vendor.yaml`. 2. Swap `configure_file()` for `file(COPY ...)`: the same clangd copy with no configure dependency registered. (`file(COPY_FILE ... ONLY_IF_DIFFERENT)` would be cleaner still but requires CMake 3.21, above the declared `cmake_minimum_required(VERSION 3.10)`.) ## Test plan - [x] Fresh `cmake --preset Release-windows-clang` (LLVM 22, no cache seeding) completes and logs `Enabled SSL backends: Schannel`; the FIONBIO probe passes without the previous `#error` - [x] Full Windows Release build from scratch in the branch worktree (all 1422 targets) - [x] goalc-test suite: 1509 passed, 0 failed - [x] Second consecutive configure with `compile_commands.json` present: the regen rule in `build.ninja` has no `compile_commands.json` input; `<src>/build/compile_commands.json` is still refreshed for clangd - [x] Repeated `ninja` invocations after a full build no longer re-run CMake - [x] macOS Intel and ARM CI green (first exercise of the OpenSSL backend switch) --- I work off a self-hosted forge, so this GitHub account is quiet; the configure logs and ninja dirty-node traces from the investigation are available if anyone wants the raw data. (AI-assisted)
5.2 KiB
Vendored
Generated
curl peers
A peer in curl internals is represented by a struct Curl_peer. It has the following members:
scheme: astruct Curl_schemeof the URL schemes known to curluser_hostname: the hostname as supplied by the user/applicationhostname: a normalized version ofuser_hostnameport: the network portipv6: ifhostnameis an IPv6 addressunix_socket: ifhostnameis a path to aunix domain socketuser_ipv6zone: user supplied IPv6 zone name orNULLipv6scope_id: IPv6 address scope or 0abstract: (ifunix_socket) if the socket is abstract
A peer, in short, is a communication endpoint.
peers and transfers
The peer a transfer, e.g. easy handle, works against is determined at the
start of each request. It is kept in data->state.origin. For the first
request done in a curl_easy_perform() or equivalent, this origin is
linked to data->state.initial_origin. This allows checks if properties
of data->set.* should apply to a request or not.
data->state.origin is relevant for cookie processing, signing requests
and other request/response based processing.
peers and connections
A network connection always goes somewhere. That somewhere is called
the origin of the connection (e.g. the source of responses/downloads).
It is kept in conn->origin and is always present in a connection.
The origin is logical endpoint a connection talks to. In most
configurations it is the same as data->state.origin (see proxies below).
For most connections, the origin is connected to directly. It
can be directed to another peer, however.
connect-to
With the command line option --connect-to or the libcurl option
CURLOPT_CONNECT_TO, a connection can be told to make the network connection
to another endpoint while keeping the origin unchanged.
This other endpoint is also a peer and is available as conn->via_peer.
This may be a peer for a different hostname and port or it may be a
unix domain socket.
proxies
When a connection uses a proxy, the endpoint for contacting the proxy server
is also represented as a peer and is kept at conn->socks_proxy.peer and/or
conn->http_proxy.peer. SOCKS proxies always come first, so a connection
might connect as:
1. curl -------------------------------------------> conn->origin
2. curl -------------------------------------------> conn->via_peer (acting as conn->origin)
3. curl --> socks_proxy.peer ----------------------> conn->via_peer/origin
4. curl -----------------------> http_proxy.peer --> conn->via_peer/origin
5. curl --> socks_proxy.peer --> http_proxy.peer --> conn->via_peer/origin
A conn->(socks|http)_proxy.peer is only ever present when the proxy
is in use and NULL otherwise.
SOCKS proxies are always used for tunneling, either to the origin or the HTTP proxy. They operate in a connection filter.
HTTP proxies can operate in two modes: tunneling or forwarding. When tunneling,
they also operate in a connection filter. In forwarding mode however, they
become the origin the connection talks to.
Therefore, connections that talk to a forwarding HTTP proxy have conn->origin
set to conn->http_proxy.peer and conn->bits.origin_is_proxy is set.
The connection filter SETUP, that assembles the filters for a connection,
figures out which peer to pass to which filter in order to make it all work.
The individual filters get passed a specific peer and do not need be concerned
with the whole chain.
For example, IP connection goes to origin(1), via_peer(2),
socks_proxy.peer(3+5), http_proxy.peer(4) and that is the peer that gets
passed to the DNS and HAPPY-EYEBALLS filters.
TLS
TLS filters' task is to verify the peer they talk to (unless that is
switched off). They either talk to the conn->origin or the
conn->http_proxy.peer (SOCKS does not have TLS). The conn->via_peer is
irrelevant. A via_peer endpoint needs to present a certificate matching
conn->origin or the connect must fail.
unix domain sockets
Peers that represent a unix domain socket may be used in two places:
via_peer: curl can connect to anoriginserver viaunix domain sockets. This disables any proxy settings a transfer might carry.socks_proxy.peer: aSOCKSproxy may be contacted over aunix domain socket.
It is not supported to contact an http proxy over unix domain sockets.
peers and credentials
There have been several vulnerabilities by leaking credentials in requests
where they should not appear. In future work we plan to tie credentials to
peers and use them only when their peer still matches the current
connection use.
peers internals
A struct Curl_peer is allocated with space of the user_hostname.
Only when the user supplied value needs conversions (removing [] or
IDN encoding) is hostname an extra allocation. This keeps the number
of allocations the same as before.
A Curl_peer is not expected to be modified after it has been created.
However, each Curl_peer has a reference counter. Code needs to use
Curl_peer_link() and Curl_peer_unlink() to keep/release references.
This makes it safe and cheap to keep references to peers in connections
and filters.