///|
fn main {
// A resumable download: the client replays the Range header with the
// validator it received earlier. When the validator no longer matches,
// the conditional planner returns Ignore (status 200, full body).
let request = @range.parse_range("bytes=1000-1999").unwrap()
for
validator in [
"\"abc123\"", "\"stale-tag\"", "Sun, 06 Nov 1994 08:49:37 GMT",
] {
match @range.parse_if_range(validator) {
Err(error) => println("\{validator} -> \{error.to_string()}")
Ok(if_range) => {
let plan = @range.plan_conditional_range_response(
request,
5_000L,
Some(if_range),
"\"abc123\"",
784_111_777L,
true,
true,
true,
).unwrap()
println("\{validator} -> status \{plan.recommended_status()}")
}
}
}
}