diff options
author | Alexandre Antonio Juca <[email protected]> | 2024-03-13 17:24:53 +0000 |
---|---|---|
committer | Yuchen Wu <[email protected]> | 2024-03-22 15:00:42 -0700 |
commit | adba11a07afb8ecd4b74aca765654bd20d95d601 (patch) | |
tree | 971e246ab7084b4b536b754bc735dd88afd64cc6 | |
parent | ff381fc3ebfe16085a95a96ec687cc6378f61d28 (diff) | |
download | pingora-adba11a07afb8ecd4b74aca765654bd20d95d601.tar.gz pingora-adba11a07afb8ecd4b74aca765654bd20d95d601.zip |
Fix typos and grammar issues
Update comment
Co-authored-by: Kevin Guthrie <[email protected]>
Includes-commit: 61a55ae3fa18e11858a33b74f5442ff230aefc4d
Includes-commit: 7da3e13d842085cd7079be990cf41f86ffa780ed
Replicated-from: https://github.com/cloudflare/pingora/pull/128
-rw-r--r-- | .bleep | 2 | ||||
-rw-r--r-- | pingora-http/src/lib.rs | 16 |
2 files changed, 9 insertions, 9 deletions
@@ -1 +1 @@ -62aab35f3ee85a4978de9075877b831e9f185ed2
\ No newline at end of file +cfeea5bcf669335b2ef1fa90b4572d1c52bc2c82
\ No newline at end of file diff --git a/pingora-http/src/lib.rs b/pingora-http/src/lib.rs index 24b648f..681bcfb 100644 --- a/pingora-http/src/lib.rs +++ b/pingora-http/src/lib.rs @@ -169,7 +169,7 @@ impl RequestHeader { /// Insert the header name and value to `self`. /// /// Different from [Self::append_header()], this method will replace all other existing headers - /// under the same name (case insensitive). + /// under the same name (case-insensitive). pub fn insert_header( &mut self, name: impl IntoCaseHeaderName, @@ -476,7 +476,7 @@ fn clone_resp_parts(me: &RespParts) -> RespParts { // This function returns an upper bound on the size of the header map used inside the http crate. // As of version 0.2, there is a limit of 1 << 15 (32,768) items inside the map. There is an -// assertion against this size inside the crate so we want to avoid panicking by not exceeding this +// assertion against this size inside the crate, so we want to avoid panicking by not exceeding this // upper bound. fn http_header_map_upper_bound(size_hint: Option<usize>) -> usize { // Even though the crate has 1 << 15 as the max size, calls to `with_capacity` invoke a @@ -484,13 +484,13 @@ fn http_header_map_upper_bound(size_hint: Option<usize>) -> usize { // // See https://github.com/hyperium/http/blob/34a9d6bdab027948d6dea3b36d994f9cbaf96f75/src/header/map.rs#L3220 // - // Therefore we set our max size to be even lower so we guarantee ourselves we won't hit that + // Therefore we set our max size to be even lower, so we guarantee ourselves we won't hit that // upper bound in the crate. Any way you cut it, 4,096 headers is insane. const PINGORA_MAX_HEADER_COUNT: usize = 4096; const INIT_HEADER_SIZE: usize = 8; - // We select the size hint or the max size here such that we pick a value substantially lower - // 1 << 15 with room to grow the header map. + // We select the size hint or the max size here, ensuring that we pick a value substantially lower + // than 1 << 15 with room to grow the header map. std::cmp::min( size_hint.unwrap_or(INIT_HEADER_SIZE), PINGORA_MAX_HEADER_COUNT, @@ -509,7 +509,7 @@ fn append_header_value<T>( .as_slice() .try_into() .or_err(InvalidHTTPHeader, "invalid header name")?; - // storage the original case in the map + // store the original case in the map if let Some(name_map) = name_map { name_map.append(header_name.clone(), case_header_name); } @@ -530,7 +530,7 @@ fn insert_header_value<T>( .try_into() .or_err(InvalidHTTPHeader, "invalid header name")?; if let Some(name_map) = name_map { - // storage the original case in the map + // store the original case in the map name_map.insert(header_name.clone(), case_header_name); } value_map.insert(header_name, value); @@ -562,7 +562,7 @@ fn header_to_h1_wire(key_map: Option<&CaseMap>, value_map: &HMap, buf: &mut impl let iter = key_map.iter().zip(value_map.iter()); for ((header, case_header), (header2, val)) in iter { if header != header2 { - // in case the header iter order changes in further version of HMap + // in case the header iteration order changes in future versions of HMap panic!("header iter mismatch {}, {}", header, header2) } buf.put_slice(case_header.as_slice()); |