Skip to content

Commit 964610f

Browse files
committed
Rename Header check -> Head check
1 parent d98f59d commit 964610f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::str::FromStr;
1616

1717
use crate::chunked::ChunkedDecoder;
1818
use crate::date::fmt_http_date;
19-
use crate::{MAX_HEADERS, MAX_HEADER_LENGTH};
19+
use crate::{MAX_HEADERS, MAX_HEAD_LENGTH};
2020

2121
/// An HTTP encoder.
2222
#[doc(hidden)]
@@ -146,10 +146,10 @@ where
146146
// No more bytes are yielded from the stream.
147147
assert!(bytes_read != 0, "Empty response"); // TODO: ensure?
148148

149-
// Prevent CWE-400 DDOS with Large HTTP Headers.
149+
// Prevent CWE-400 DDOS with large HTTP Headers.
150150
ensure!(
151-
buf.len() < MAX_HEADER_LENGTH,
152-
"Header byte length limit exceeded"
151+
buf.len() < MAX_HEAD_LENGTH,
152+
"Head byte length limit exceeded"
153153
);
154154

155155
// We've hit the end delimiter of the stream.

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999
/// The maximum amount of headers parsed on the server.
100100
const MAX_HEADERS: usize = 128;
101101

102-
/// The maximum length of the headers we'll try and parse.
102+
/// The maximum length of the head section we'll try to parse.
103103
/// See: https://nodejs.org/en/blog/vulnerability/november-2018-security-releases/#denial-of-service-with-large-http-headers-cve-2018-12121
104-
const MAX_HEADER_LENGTH: usize = 8 * 1024;
104+
const MAX_HEAD_LENGTH: usize = 8 * 1024;
105105

106106
mod chunked;
107107
mod date;

src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use http_types::{Body, Method, Request, Response};
1616

1717
use crate::chunked::ChunkedDecoder;
1818
use crate::date::fmt_http_date;
19-
use crate::{MAX_HEADERS, MAX_HEADER_LENGTH};
19+
use crate::{MAX_HEADERS, MAX_HEAD_LENGTH};
2020

2121
const CR: u8 = b'\r';
2222
const LF: u8 = b'\n';
@@ -353,10 +353,10 @@ where
353353
return Ok(None);
354354
}
355355

356-
// Prevent CWE-400 DDOS with Large HTTP Headers.
356+
// Prevent CWE-400 DDOS with large HTTP Headers.
357357
ensure!(
358-
buf.len() < MAX_HEADER_LENGTH,
359-
"Header byte length limit exceeded"
358+
buf.len() < MAX_HEAD_LENGTH,
359+
"Head byte length limit exceeded"
360360
);
361361

362362
// We've hit the end delimiter of the stream.

0 commit comments

Comments
 (0)