Skip to content

Commit 121cc6d

Browse files
LPardueseanmonstar
authored andcommitted
Add awareness of HTTP/3 (#294)
1 parent 0255a9c commit 121cc6d

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
@@ -1013,6 +1013,7 @@ const HEADER_CHARS: [u8; 256] = [
10131013
0, 0, 0, 0, 0, 0 // 25x
10141014
];
10151015

1016+
/// Valid header name characters for HTTP/2.0 and HTTP/3.0
10161017
const HEADER_CHARS_H2: [u8; 256] = [
10171018
// 0 1 2 3 4 5 6 7 8 9
10181019
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // x
@@ -1563,8 +1564,8 @@ impl HeaderName {
15631564
/// Converts a slice of bytes to an HTTP header name.
15641565
///
15651566
/// This function expects the input to only contain lowercase characters.
1566-
/// This is useful when decoding HTTP/2.0 headers. The HTTP/2.0
1567-
/// specification requires that all headers be represented in lower case.
1567+
/// This is useful when decoding HTTP/2.0 or HTTP/3.0 headers. Both
1568+
/// require that all headers be represented in lower case.
15681569
///
15691570
/// # Examples
15701571
///

src/status.rs

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

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)