#http-parser #content-range

http-content-range

HTTP Content Range response header parser

10 releases

0.2.4 Oct 10, 2025
0.2.3 Jun 8, 2025
0.2.1 Dec 26, 2024
0.2.0 Oct 9, 2024
0.1.1 Feb 15, 2022

#243 in Network programming

Download history 11308/week @ 2025-08-19 11185/week @ 2025-08-26 9962/week @ 2025-09-02 11552/week @ 2025-09-09 9786/week @ 2025-09-16 9757/week @ 2025-09-23 8381/week @ 2025-09-30 11844/week @ 2025-10-07 13090/week @ 2025-10-14 10661/week @ 2025-10-21 12436/week @ 2025-10-28 8314/week @ 2025-11-04 9302/week @ 2025-11-11 10879/week @ 2025-11-18 9776/week @ 2025-11-25 16112/week @ 2025-12-02

47,710 downloads per month
Used in 24 crates (2 directly)

MIT/Apache

15KB
229 lines

http-content-range

GitHub repo crates.io version crate usage docs.rs status crates.io license CI build status Codecov

Tiny Rust lib to decode Content-Range response headers.

use http_content_range::ContentRange;

let value = ContentRange::parse("bytes 42-69/420");

match value.expect("Failed to parse Content-Range") {
    ContentRange::Bytes(r) => {
        println!(
            "First_byte={}, last_byte={}, complete_length={}",
            r.first_byte, r.last_byte, r.complete_length,
        );
    }
    ContentRange::UnboundBytes(r) => {
        println!(
            "First_byte={}, last_byte={}, complete_length is unknown",
            r.first_byte, r.last_byte
        );
    }
    ContentRange::Unsatisfied(r) => {
        println!(
            "Unsatisfied response, complete_length={}",
            r.complete_length
        );
    }
};

Development

  • This project is easier to develop with just, a modern alternative to make. Install it with cargo install just.
  • To get a list of available commands, run just.
  • To run tests, use just test.

Credits

The code was inspired by the rust-http-range crate.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.

No runtime deps