Enable HTTP/2, connection reuse, and improve download parallelism#371
Open
aruiz wants to merge 3 commits intorpm-software-management:masterfrom
Open
Enable HTTP/2, connection reuse, and improve download parallelism#371aruiz wants to merge 3 commits intorpm-software-management:masterfrom
aruiz wants to merge 3 commits intorpm-software-management:masterfrom
Conversation
added 3 commits
March 30, 2026 02:28
Set CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_2TLS in the default curl easy handle factory so all transfers attempt HTTP/2 over TLS with transparent fallback to HTTP/1.1. This eliminates redundant TLS handshakes when downloading multiple files from the same mirror via HTTP/2 multiplexing. Also expose the setting as a new LRO_HTTPVERSION handle option (with LRI_HTTPVERSION getinfo) so consumers can override per-handle if needed. A new LrHttpVersionType enum provides the valid values. Assisted-by: Claude
Each LrHandle now maintains a CURLSH share handle that pools DNS cache and TCP+TLS connections across all curl easy handles spawned from it. This allows connections to survive across sequential lr_download() calls, avoiding redundant DNS lookups and TLS handshakes when the same handle is used for multiple download passes (e.g. dnf5's sync-check then full-download pattern). A GMutex protects the shared state since curl_share can be accessed concurrently by multiple easy handles within a curl_multi session. Assisted-by: Claude
Raise LRO_MAXPARALLELDOWNLOADS_DEFAULT from 3 to 5 to better utilize HTTP/2 multiplexing and modern server capacity. Fix the parallelism calculation in lr_download() to scan all target handles and use the maximum maxparalleldownloads value, rather than only considering the first target's handle. This prevents a single handle with a conservative setting from bottlenecking a mixed batch of downloads from multiple handles. Assisted-by: Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CURL_HTTP_VERSION_2TLS) with transparent fallback to HTTP/1.1. ExposeLRO_HTTPVERSIONoption as an escape hatch.CURLSHshare handle perLrHandleto pool DNS cache and TCP+TLS connections across sequentiallr_download()calls, avoiding redundant handshakes.lr_download()to use the maximum parallelism across all target handles rather than just the first one.Results
Benchmarked with
dnf5 --setopt=build_cache=0 --refresh makecacheagainst 9 enabled repos (Fedora 41, RPM Fusion, Chrome, VS Code, etc.):No changes required in dnf5 — all improvements take effect transparently.
Disclosure
This changeset was developed with assistance from Claude (Anthropic). Each commit is tagged
Assisted-by: Claude.