File tree 1 file changed +14
-14
lines changed
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,21 @@ cfg_server! {
29
29
/// Default initial stream window size defined in HTTP2 spec.
30
30
pub ( crate ) const SPEC_WINDOW_SIZE : u32 = 65_535 ;
31
31
32
+ // List of connection headers from:
33
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
34
+ //
35
+ // TE headers are allowed in HTTP/2 requests as long as the value is "trailers", so they're
36
+ // tested separately.
37
+ const CONNECTION_HEADERS : [ HeaderName ; 5 ] = [
38
+ HeaderName :: from_static ( "keep-alive" ) ,
39
+ HeaderName :: from_static ( "proxy-connection" ) ,
40
+ TRAILER ,
41
+ TRANSFER_ENCODING ,
42
+ UPGRADE ,
43
+ ] ;
44
+
32
45
fn strip_connection_headers ( headers : & mut HeaderMap , is_request : bool ) {
33
- // List of connection headers from:
34
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
35
- //
36
- // TE headers are allowed in HTTP/2 requests as long as the value is "trailers", so they're
37
- // tested separately.
38
- let connection_headers = [
39
- HeaderName :: from_lowercase ( b"keep-alive" ) . unwrap ( ) ,
40
- HeaderName :: from_lowercase ( b"proxy-connection" ) . unwrap ( ) ,
41
- TRAILER ,
42
- TRANSFER_ENCODING ,
43
- UPGRADE ,
44
- ] ;
45
-
46
- for header in connection_headers. iter ( ) {
46
+ for header in & CONNECTION_HEADERS {
47
47
if headers. remove ( header) . is_some ( ) {
48
48
warn ! ( "Connection header illegal in HTTP/2: {}" , header. as_str( ) ) ;
49
49
}
You can’t perform that action at this time.
0 commit comments