Skip to content

Commit a1803c0

Browse files
LPardueseanmonstar
authored andcommitted
Add awareness of HTTP/3 (#294)
1 parent 1c36a3b commit a1803c0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/header/name.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ const HEADER_CHARS: [u8; 256] = [
10121012
0, 0, 0, 0, 0, 0 // 25x
10131013
];
10141014

1015+
/// Valid header name characters for HTTP/2.0 and HTTP/3.0
10151016
const HEADER_CHARS_H2: [u8; 256] = [
10161017
// 0 1 2 3 4 5 6 7 8 9
10171018
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // x
@@ -1690,8 +1691,8 @@ impl HeaderName {
16901691
/// Converts a slice of bytes to an HTTP header name.
16911692
///
16921693
/// This function expects the input to only contain lowercase characters.
1693-
/// This is useful when decoding HTTP/2.0 headers. The HTTP/2.0
1694-
/// specification requires that all headers be represented in lower case.
1694+
/// This is useful when decoding HTTP/2.0 or HTTP/3.0 headers. Both
1695+
/// require that all headers be represented in lower case.
16951696
///
16961697
/// # Examples
16971698
///

src/status.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ impl StatusCode {
138138
/// The reason phrase is defined as being exclusively for human readers. You should avoid
139139
/// deriving any meaning from it at all costs.
140140
///
141-
/// Bear in mind also that in HTTP/2.0 the reason phrase is abolished from transmission, and so
142-
/// this canonical reason phrase really is the only reason phrase you’ll find.
141+
/// Bear in mind also that in HTTP/2.0 and HTTP/3.0 the reason phrase is abolished from
142+
/// transmission, and so this canonical reason phrase really is the only reason phrase you’ll
143+
/// find.
143144
///
144145
/// # Example
145146
///

src/version.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ impl Version {
3737

3838
/// `HTTP/2.0`
3939
pub const HTTP_2: Version = Version(Http::H2);
40+
41+
/// `HTTP/3.0`
42+
pub const HTTP_3: Version = Version(Http::H3);
4043
}
4144

4245
#[derive(PartialEq, PartialOrd, Copy, Clone, Eq, Ord, Hash)]
@@ -45,6 +48,7 @@ enum Http {
4548
Http10,
4649
Http11,
4750
H2,
51+
H3,
4852
}
4953

5054
impl Default for Version {
@@ -63,6 +67,7 @@ impl fmt::Debug for Version {
6367
Http10 => "HTTP/1.0",
6468
Http11 => "HTTP/1.1",
6569
H2 => "HTTP/2.0",
70+
H3 => "HTTP/3.0",
6671
})
6772
}
6873
}

0 commit comments

Comments
 (0)