Requests and downloads build their curl options through different helpers, and they disagree on http_version:
- Downloads (
download_file() etc.) go through update_async_timeouts(), which sets http_version (default default_http_version(): HTTP/1.1 on macOS/Linux, NONE on Windows).
- Requests (
http_get(), http_post(), http_head()) go through get_default_curl_options(), which sets timeout/connecttimeout/cainfo but never http_version.
So plain requests always use libcurl's default (HTTP/2), on every platform, and neither PKGCACHE_HTTP_VERSION nor async_http_http_version reaches them, there is no way to pin a request to HTTP/1.1.
This bites API queries that flake over HTTP/2 (connection reset / GOAWAY) on some client stacks. A concrete case: pkgdepends' GitHub GraphQL query (api.github.com/graphql via http_post()) fails at the transport level with no HTTP-version knob to work around it, while downloads to the same host are pinned to HTTP/1.1 and fare better.
Note: default_http_version() returns NONE (HTTP/2) on Windows, so honoring http_version on the request path alone would still leave Windows on HTTP/2 unless the Windows default is also revisited or callers can force HTTP/1.1 explicitly.
following r-lib/actions#1091
Requests and downloads build their curl options through different helpers, and they disagree on
http_version:download_file()etc.) go throughupdate_async_timeouts(), which setshttp_version(defaultdefault_http_version(): HTTP/1.1 on macOS/Linux,NONEon Windows).http_get(),http_post(),http_head()) go throughget_default_curl_options(), which setstimeout/connecttimeout/cainfobut neverhttp_version.So plain requests always use libcurl's default (HTTP/2), on every platform, and neither
PKGCACHE_HTTP_VERSIONnorasync_http_http_versionreaches them, there is no way to pin a request to HTTP/1.1.This bites API queries that flake over HTTP/2 (connection reset /
GOAWAY) on some client stacks. A concrete case: pkgdepends' GitHub GraphQL query (api.github.com/graphqlviahttp_post()) fails at the transport level with no HTTP-version knob to work around it, while downloads to the same host are pinned to HTTP/1.1 and fare better.Note:
default_http_version()returnsNONE(HTTP/2) on Windows, so honoringhttp_versionon the request path alone would still leave Windows on HTTP/2 unless the Windows default is also revisited or callers can force HTTP/1.1 explicitly.following r-lib/actions#1091