Conflicts: crates/fetch/src/tests.rs crates/segment/src/fetch.rs Ported in this merge: FileSpec keeps this PR's pinned sizes and sha with main's `max: 4 << 20`; tests are a union. Also addresses CodeRabbit's three test findings: the mirror path goes through the defaults instead of being split on spaces or commas, temp dirs are removed at the end of each test, and the percent/space tests build their paths from temp_dir() so they hold on Windows. fetch and segment tests and clippy pass locally.
lightcraft-fetch
Native model downloads in pure Rust (L0, Apache-2.0): HTTP/1.1 over std sockets and rustls with the RustCrypto provider, without ring, aws-lc, C or assembly build dependencies. The wasm32 crate is empty.
Call download with bounded file specifications and ordered mirrors, or download_url for an exact catalog URL (including its query). Each file has a local filename independent of the URL, a size cap and optional pinned size/SHA-256. Transfers resume pinned .part files, verify before renaming, report progress and check cancellation during reads. Run on a worker thread. No proxy support; DNS resolution uses the platform resolver. Tokens are off by default and never forwarded to a different redirect host. A redirect from https to http is refused.
Tests use local synthetic HTTP servers for redirects, resume, truncation, cancellation, stalls, hashes, size limits and hostile specifications; they make no internet requests.