@@ -653,6 +653,16 @@ impl<E> Http1Builder<'_, E> {
653
653
Http2Builder { inner : self . inner }
654
654
}
655
655
656
+ /// Set whether the `date` header should be included in HTTP responses.
657
+ ///
658
+ /// Note that including the `date` header is recommended by RFC 7231.
659
+ ///
660
+ /// Default is true.
661
+ pub fn auto_date_header ( & mut self , enabled : bool ) -> & mut Self {
662
+ self . inner . http1 . auto_date_header ( enabled) ;
663
+ self
664
+ }
665
+
656
666
/// Set whether HTTP/1 connections should support half-closures.
657
667
///
658
668
/// Clients can chose to shutdown their write-side while waiting
@@ -685,6 +695,18 @@ impl<E> Http1Builder<'_, E> {
685
695
self
686
696
}
687
697
698
+ /// Set whether HTTP/1 connections will silently ignored malformed header lines.
699
+ ///
700
+ /// If this is enabled and a header line does not start with a valid header
701
+ /// name, or does not include a colon at all, the line will be silently ignored
702
+ /// and no error will be reported.
703
+ ///
704
+ /// Default is false.
705
+ pub fn ignore_invalid_headers ( & mut self , enabled : bool ) -> & mut Self {
706
+ self . inner . http1 . ignore_invalid_headers ( enabled) ;
707
+ self
708
+ }
709
+
688
710
/// Set whether to support preserving original header cases.
689
711
///
690
712
/// Currently, this will record the original cases received, and store them
@@ -861,6 +883,19 @@ impl<E> Http2Builder<'_, E> {
861
883
self
862
884
}
863
885
886
+ /// Configures the maximum number of local reset streams allowed before a GOAWAY will be sent.
887
+ ///
888
+ /// If not set, hyper will use a default, currently of 1024.
889
+ ///
890
+ /// If `None` is supplied, hyper will not apply any limit.
891
+ /// This is not advised, as it can potentially expose servers to DOS vulnerabilities.
892
+ ///
893
+ /// See <https://rustsec.org/advisories/RUSTSEC-2024-0003.html> for more information.
894
+ pub fn max_local_error_reset_streams ( & mut self , max : impl Into < Option < usize > > ) -> & mut Self {
895
+ self . inner . http2 . max_local_error_reset_streams ( max) ;
896
+ self
897
+ }
898
+
864
899
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
865
900
/// stream-level flow control.
866
901
///
@@ -980,6 +1015,16 @@ impl<E> Http2Builder<'_, E> {
980
1015
self
981
1016
}
982
1017
1018
+ /// Set whether the `date` header should be included in HTTP responses.
1019
+ ///
1020
+ /// Note that including the `date` header is recommended by RFC 7231.
1021
+ ///
1022
+ /// Default is true.
1023
+ pub fn auto_date_header ( & mut self , enabled : bool ) -> & mut Self {
1024
+ self . inner . http2 . auto_date_header ( enabled) ;
1025
+ self
1026
+ }
1027
+
983
1028
/// Bind a connection together with a [`Service`].
984
1029
pub async fn serve_connection < I , S , B > ( & self , io : I , service : S ) -> Result < ( ) >
985
1030
where
0 commit comments