pub struct Spec {Show 15 fields
pub auth_b64: Option<String>,
pub partial_first_put: Option<usize>,
pub cut_first_get: Option<(usize, bool)>,
pub drip: Option<Drip>,
pub sizeless: bool,
pub rate_first: Option<(usize, u64)>,
pub flaky_first: Option<u32>,
pub pause_first_503: Option<u64>,
pub ignore_range: bool,
pub markerless: bool,
pub foreign_marker: bool,
pub read_only: bool,
pub redirect: Option<String>,
pub drop_connection: bool,
pub freeze_upload: bool,
}Expand description
The composable behavior of one hosted instance.
Fields§
§auth_b64: Option<String>Basic-auth gate: the expected Authorization token, base64 of user:pass.
partial_first_put: Option<usize>Cut the first PUT per path after this many body bytes.
cut_first_get: Option<(usize, bool)>Cut the first success GET per path: (body bytes, lie about Content-Length).
drip: Option<Drip>Answer GET/HEAD bodies in delayed chunks.
sizeless: boolSuccess GET/HEAD answers hide Content-Length.
rate_first: Option<(usize, u64)>The first N requests per path answer 429 with a Retry-After of this many seconds.
flaky_first: Option<u32>The first N requests per path answer 503.
pause_first_503: Option<u64>The first request per path answers 503 with a Retry-After of this many seconds.
ignore_range: boolRefuse every ranged GET with the whole body (200).
markerless: boolDrop markers instead of storing them.
foreign_marker: boolReplace marker digests with zeros.
read_only: boolRefuse every DELETE.
redirect: Option<String>Redirect reads to this path with an empty 301.
drop_connection: boolReset the first request per path.
freeze_upload: boolHold PUT connections without reading or answering.
Implementations§
Source§impl Spec
impl Spec
Sourcepub fn with_auth(self, user: &str, pass: &str) -> Self
pub fn with_auth(self, user: &str, pass: &str) -> Self
A Basic-auth gate from plain credentials.
Sourcepub fn with_partial_put(self, bytes: usize) -> Self
pub fn with_partial_put(self, bytes: usize) -> Self
Cut the first PUT per path after bytes body bytes.
Sourcepub fn with_cut_body(self, bytes: usize, fake_length: bool) -> Self
pub fn with_cut_body(self, bytes: usize, fake_length: bool) -> Self
Cut the first success GET per path after bytes body bytes, optionally lying about Content-Length.
Sourcepub fn with_drip(self, delay_ms: u64, chunk_size: usize) -> Self
pub fn with_drip(self, delay_ms: u64, chunk_size: usize) -> Self
Serve GET/HEAD bodies in delayed chunks.
Sourcepub fn with_sizeless(self) -> Self
pub fn with_sizeless(self) -> Self
Hide Content-Length on success GET/HEAD answers.
Sourcepub fn with_rate_limit(self, n: usize, retry_after_secs: u64) -> Self
pub fn with_rate_limit(self, n: usize, retry_after_secs: u64) -> Self
Answer the first n requests per path with 429 and this Retry-After.
Sourcepub fn with_flaky(self, n: u32) -> Self
pub fn with_flaky(self, n: u32) -> Self
Answer the first n requests per path with 503.
Sourcepub fn with_retry_after_503(self, retry_after_secs: u64) -> Self
pub fn with_retry_after_503(self, retry_after_secs: u64) -> Self
Answer the first request per path with 503 and this Retry-After.
Sourcepub fn with_ignore_range(self) -> Self
pub fn with_ignore_range(self) -> Self
Answer every ranged GET with the whole body.
Sourcepub fn with_markerless(self) -> Self
pub fn with_markerless(self) -> Self
Drop .sha256 PUTs instead of storing them.
Sourcepub fn with_foreign_marker(self) -> Self
pub fn with_foreign_marker(self) -> Self
Zero out every stored marker’s digest.
Sourcepub fn with_read_only(self) -> Self
pub fn with_read_only(self) -> Self
Refuse every DELETE with 403.
Sourcepub fn with_redirect(self, location_path: &str) -> Self
pub fn with_redirect(self, location_path: &str) -> Self
Redirect every read to this path with an empty 301.
Sourcepub fn with_drop_connection(self) -> Self
pub fn with_drop_connection(self) -> Self
Reset the first request per path right after its head.
Sourcepub fn with_freeze_upload(self) -> Self
pub fn with_freeze_upload(self) -> Self
Hold PUT connections without reading or answering.