Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jp4g committed Nov 30, 2024
1 parent 3d976c8 commit ddd35f8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/src/headers/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{CR, LF, Sequence};
pub mod body_hash;
pub mod email_address;


/**
* Constrain a sequence in a header to be within the correct bounds
*
Expand All @@ -14,9 +13,8 @@ pub mod email_address;
* @param header_field_sequence - The sequence of the header field
* @param header_field_name - The name of the header field
*/
fn check_header_field_bounds<let MAX_HEADER_LENGTH: u32, let MAX_HEADER_FIELD_LENGTH: u32, let HEADER_FIELD_NAME_LENGTH: u32>
(
header: BoundedVec<u8, MAX_HEADER_LENGTH>,
fn check_header_field_bounds<let MAX_HEADER_LENGTH: u32, let MAX_HEADER_FIELD_LENGTH: u32, let HEADER_FIELD_NAME_LENGTH: u32>(
header: BoundedVec<u8, MAX_HEADER_LENGTH>,
header_field_sequence: Sequence,
header_field_name: [u8; HEADER_FIELD_NAME_LENGTH],
) {
Expand Down Expand Up @@ -71,7 +69,11 @@ pub fn constrain_header_field<let MAX_HEADER_LENGTH: u32, let MAX_HEADER_FIELD_L
header_field_name: [u8; HEADER_FIELD_NAME_LENGTH],
) {
// constrain beginning of header field
check_header_field_bounds::<MAX_HEADER_LENGTH, MAX_HEADER_FIELD_LENGTH, HEADER_FIELD_NAME_LENGTH>(header, header_field_sequence, header_field_name);
check_header_field_bounds::<MAX_HEADER_LENGTH, MAX_HEADER_FIELD_LENGTH, HEADER_FIELD_NAME_LENGTH>(
header,
header_field_sequence,
header_field_name,
);

// check the header field is uninterrupted
let start_index = header_field_sequence.index + HEADER_FIELD_NAME_LENGTH + 1;
Expand All @@ -93,7 +95,11 @@ pub fn constrain_header_field_detect_last_angle_bracket<let MAX_HEADER_LENGTH: u
header_field_name: [u8; HEADER_FIELD_NAME_LENGTH],
) -> u32 {
// constrain beginning of header field
check_header_field_bounds::<MAX_HEADER_LENGTH, MAX_HEADER_FIELD_LENGTH, HEADER_FIELD_NAME_LENGTH>(header, header_field_sequence, header_field_name);
check_header_field_bounds::<MAX_HEADER_LENGTH, MAX_HEADER_FIELD_LENGTH, HEADER_FIELD_NAME_LENGTH>(
header,
header_field_sequence,
header_field_name,
);

// check the header field is uninterrupted
let mut last_angle_bracket = 0;
Expand Down

0 comments on commit ddd35f8

Please sign in to comment.