MCPcopy Create free account
hub / github.com/Firstyear/opensuse-proxy-cache / send_headers

Function send_headers

opensuse-proxy-cache/src/main.rs:425–446  ·  view source on GitHub ↗
(range: Option<(u64, Option<u64>)>)

Source from the content-addressed store, hash-verified

423}
424
425fn send_headers(range: Option<(u64, Option<u64>)>) -> HeaderMap {
426 let mut h = HeaderMap::new();
427 h.append("user-agent", "opensuse-proxy-cache".try_into().unwrap());
428 // h.append("x-ospc-uuid", tracing_forest::id().to_string());
429 h.append(
430 "x-zypp-anonymousid",
431 "dd27909d-1c87-4640-b006-ef604d302f92".try_into().unwrap(),
432 );
433
434 if let Some((lower, maybe_upper)) = range {
435 if let Some(upper) = maybe_upper {
436 h.append(
437 "range",
438 format!("bytes={}-{}", lower, upper).try_into().unwrap(),
439 );
440 } else {
441 h.append("range", format!("bytes={}-", lower).try_into().unwrap());
442 }
443 };
444
445 h
446}
447
448fn filter_headers(headers: &HeaderMap, metadata: bool) -> HeaderMap {
449 debug!(?headers);

Callers 4

streamFunction · 0.85
missFunction · 0.85
prefetch_dl_taskFunction · 0.85
refreshFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected