Skip to content

Commit

Permalink
Merge pull request #758 from mozilla-services/feat/757
Browse files Browse the repository at this point in the history
add debug_client check to BsoBodies for batch operations.
  • Loading branch information
pjenvey authored Aug 3, 2020
2 parents 76f3281 + 1370df9 commit c1c23a7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/web/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,34 @@ impl FromRequest for BsoBodies {
));
}
};

// ### debug_client
if let Some(uids) = &state.limits.debug_client {
for uid in uids.split(',') {
debug!("### checking uaid: {:?}", &uid);
match u64::from_str(uid.trim()) {
Ok(v) => {
if v == HawkIdentifier::uid_from_path(req.uri(), None).unwrap_or(0) {
debug!("### returning quota exceeded.");
error!("Returning over quota for {:?}", v);
return Box::pin(future::err(
ValidationErrorKind::FromDetails(
"size-limit-exceeded".to_owned(),
RequestErrorLocation::Unknown,
Some("size-limit-exceeded".to_owned()),
None,
)
.into(),
));
}
}
Err(_) => {
debug!("{:?} is not a u64", uid);
}
};
}
}

let max_payload_size = state.limits.max_record_payload_bytes as usize;
let max_post_bytes = state.limits.max_post_bytes as usize;

Expand Down

0 comments on commit c1c23a7

Please sign in to comment.