## 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.3 KiB
Vendored
Generated
c, SPDX-License-Identifier, Title, Section, Source, See-also, Protocol, Added-in
| c | SPDX-License-Identifier | Title | Section | Source | See-also | Protocol | Added-in | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. | curl | curl_easy_header | 3 | libcurl |
|
|
7.83.0 |
NAME
curl_easy_header - get an HTTP header
SYNOPSIS
#include <curl/curl.h>
CURLHcode curl_easy_header(CURL *easy,
const char *name,
size_t nameindex,
unsigned int origin,
int request,
struct curl_header **hout);
DESCRIPTION
curl_easy_header(3) returns a pointer to a "curl_header" struct in hout with data for the HTTP response header name. The case insensitive null-terminated header name should be specified without colon.
nameindex 0 means asking for the first instance of the header. If the returned header struct has amount set larger than 1, it means there are more instances of the same header name available to get. Asking for a too big index makes CURLHE_BADINDEX get returned.
The origin argument is for specifying which headers to receive, as a single HTTP transfer might provide headers from several different places and they may then have different importance to the user and headers using the same name might be used. The origin is a bitmask for what header sources you want. See the descriptions below.
The request argument tells libcurl from which request you want headers from. A single transfer might consist of a series of HTTP requests and this argument lets you specify which particular individual request you want the headers from. 0 being the first request and then the number increases for further redirects or when multi-state authentication is used. Passing in -1 is a shortcut to "the last" request in the series, independently of the actual amount of requests used.
libcurl stores and provides the actually used "correct" headers. If for example two headers with the same name arrive and the latter overrides the former, then only the latter is provided. If the first header survives the second, then only the first one is provided. An application using this API does not have to bother about multiple headers used wrongly.
The memory for the returned struct is associated with the easy handle and subsequent calls to curl_easy_header(3) clobber the struct used in the previous calls for the same easy handle. The application needs to copy the data if it wants to keep it around. The memory used for the struct gets freed with calling curl_easy_cleanup(3) of the easy handle.
The first line in an HTTP response is called the status line. It is not considered a header by this function. Headers are the "name: value" lines following the status.
This function can be used before (all) headers have been received and is fine to call from within libcurl callbacks. It returns the state of the headers at the time it is called.
The header struct
struct curl_header {
char *name;
char *value;
size_t amount;
size_t index;
unsigned int origin;
void *anchor;
};
The data name field points to, is the same as the requested name, but might have a different case.
The data value field points to, comes exactly as delivered over the
network but with leading and trailing whitespace and newlines stripped
off. The value data is null-terminated. For legacy HTTP/1 "folded headers",
this API provides the full single value in an unfolded manner with a single
whitespace between the lines.
amount is how many headers using this name that exist, within the origin and request scope asked for.
index is the zero based entry number of this particular header, which in case this header was used more than once in the requested scope can be larger than 0 but is always less than amount.
The origin field in the "curl_header" struct has one of the origin bits set, indicating where from the header originates. At the time of this writing, there are 5 bits with defined use. The undocumented 27 remaining bits are reserved for future use and must not be assumed to have any particular value.
anchor is a private handle used by libcurl internals. Do not modify.
ORIGINS
CURLH_HEADER
The header arrived as a header from the server.
CURLH_TRAILER
The header arrived as a trailer. A header that arrives after the body.
CURLH_CONNECT
The header arrived in a CONNECT response. A CONNECT request is being done to setup a transfer "through" an HTTP(S) proxy.
CURLH_1XX
The header arrived in an HTTP 1xx response. A 1xx response is an "intermediate" response that might happen before the "real" response.
CURLH_PSEUDO
The header is an HTTP/2 or HTTP/3 pseudo header
%PROTOCOLS%
EXAMPLE
int main(void)
{
struct curl_header *type;
CURL *curl = curl_easy_init();
if(curl) {
CURLHcode h;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_perform(curl);
h = curl_easy_header(curl, "Content-Type", 0, CURLH_HEADER, -1, &type);
curl_easy_cleanup(curl);
}
}
%AVAILABILITY%
RETURN VALUE
This function returns a CURLHcode indicating success or error. CURLHE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).