Skip to content

feat: replace curl with libcurl, add mirror URL support and TUI download progress#200

Merged
Sunrisepeak merged 6 commits intomainfrom
feat/libcurl-download
Mar 8, 2026
Merged

feat: replace curl with libcurl, add mirror URL support and TUI download progress#200
Sunrisepeak merged 6 commits intomainfrom
feat/libcurl-download

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • libcurl integration: Replace all curl subprocess calls with libcurl C API via new core/curl.cppm module, enabling real-time per-task download progress callbacks
  • TUI progress display: Add live-refreshing terminal progress bars (ANSI escape redraws every 200ms) for both single and parallel downloads, showing [>>] name [########----] 45.7%
  • Mirror URL support: Parse url = { GLOBAL = "...", CN = "..." } table format in xpm definitions, select preferred mirror, use remaining as fallback URLs
  • Bump mcpplibs-xpkg to 0.0.28: Adds mirrors field to PlatformResource struct

Changed Files

File Change
core/curl.cppm New — libcurl wrapper: download_file(), probe_latency(), fetch_to_file()
core/xim/downloader.cppm Replace curl subprocess with curl::download_file(), add TUI refresh thread
core/config.cppm Replace curl HEAD probe with curl::probe_latency()
core/xim/commands.cppm Replace curl download with curl::fetch_to_file()
core/xim/installer.cppm Handle url table/mirrors, mirror selection + fallback URLs
xmake.lua Add libcurl 8.11.0, bump mcpplibs-xpkg to 0.0.28

Test plan

  • 104 unit tests pass
  • xlings install mdbook musl-gcc — verify TUI progress bars display correctly
  • Single package install — verify progress bar works for 1 task
  • Mirror selection with --mirror CN — verify CN URL used as primary

🤖 Generated with Claude Code

Sunrisepeak and others added 4 commits March 9, 2026 05:47
…d TUI download progress

- Add core/curl.cppm module wrapping libcurl C API (download_file, probe_latency, fetch_to_file)
- Replace all curl command invocations with libcurl calls (downloader, config, commands)
- Add real-time TUI progress display for parallel downloads using ANSI escape redraws
- Support url table format { GLOBAL = "...", CN = "..." } in xpm package definitions
- Select preferred mirror from DownloaderConfig, remaining mirrors become fallback URLs
- Bump mcpplibs-xpkg to 0.0.28 (adds mirrors field to PlatformResource)
- Add libcurl 8.11.0 dependency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace libcurl dependency with a lightweight tinyhttps module built on
mbedTLS + raw POSIX sockets, enabling fully static musl-libc builds with
zero glibc dependency. Same public API (download_file, probe_latency,
fetch_to_file) - only internal implementation changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The XLINGS_RES e2e test asserts the resolved mirror URL appears in
install output. Add log line showing the download URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Sunrisepeak
Copy link
Copy Markdown
Member Author

use tinyhtpps.cppm replace curl.cppm

Sunrisepeak and others added 2 commits March 9, 2026 06:40
- mbedTLS 3.x requires psa_crypto_init() before TLS operations,
  otherwise handshake fails with "internal error in lower-level module"
- Windows requires WSAStartup before any Winsock socket operations
- Use std::call_once for thread-safe lazy initialization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mbedTLS 3.6.1 TLS 1.3 key derivation fails with internal error in
static builds (handshake parses all messages but final key derivation
step fails). Force TLS 1.2 which works reliably. Also pin mbedtls
version to 3.6.1 in xmake.lua.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Sunrisepeak Sunrisepeak merged commit 6bdbde4 into main Mar 8, 2026
3 checks passed
@Sunrisepeak Sunrisepeak deleted the feat/libcurl-download branch March 8, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant