@@ -550,12 +550,34 @@ impl Builder {
550
550
self
551
551
}
552
552
553
- pub ( super ) fn h09_responses ( & mut self , enabled : bool ) -> & mut Builder {
553
+ /// Set whether HTTP/0.9 responses should be tolerated.
554
+ ///
555
+ /// Default is false.
556
+ pub fn http09_responses ( & mut self , enabled : bool ) -> & mut Builder {
554
557
self . h09_responses = enabled;
555
558
self
556
559
}
557
560
558
- pub ( crate ) fn h1_allow_spaces_after_header_name_in_responses (
561
+ /// Set whether HTTP/1 connections will accept spaces between header names
562
+ /// and the colon that follow them in responses.
563
+ ///
564
+ /// You probably don't need this, here is what [RFC 7230 Section 3.2.4.] has
565
+ /// to say about it:
566
+ ///
567
+ /// > No whitespace is allowed between the header field-name and colon. In
568
+ /// > the past, differences in the handling of such whitespace have led to
569
+ /// > security vulnerabilities in request routing and response handling. A
570
+ /// > server MUST reject any received request message that contains
571
+ /// > whitespace between a header field-name and colon with a response code
572
+ /// > of 400 (Bad Request). A proxy MUST remove any such whitespace from a
573
+ /// > response message before forwarding the message downstream.
574
+ ///
575
+ /// Note that this setting does not affect HTTP/2.
576
+ ///
577
+ /// Default is false.
578
+ ///
579
+ /// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4
580
+ pub fn http1_allow_spaces_after_header_name_in_responses (
559
581
& mut self ,
560
582
enabled : bool ,
561
583
) -> & mut Builder {
@@ -564,24 +586,51 @@ impl Builder {
564
586
self
565
587
}
566
588
567
- pub ( super ) fn h1_title_case_headers ( & mut self , enabled : bool ) -> & mut Builder {
589
+ /// Set whether HTTP/1 connections will write header names as title case at
590
+ /// the socket level.
591
+ ///
592
+ /// Note that this setting does not affect HTTP/2.
593
+ ///
594
+ /// Default is false.
595
+ pub fn http1_title_case_headers ( & mut self , enabled : bool ) -> & mut Builder {
568
596
self . h1_title_case_headers = enabled;
569
597
self
570
598
}
571
599
572
- pub ( crate ) fn h1_preserve_header_case ( & mut self , enabled : bool ) -> & mut Builder {
600
+ /// Set whether HTTP/1 connections will write header names as provided
601
+ /// at the socket level.
602
+ ///
603
+ /// Note that this setting does not affect HTTP/2.
604
+ ///
605
+ /// Default is false.
606
+ pub fn http1_preserve_header_case ( & mut self , enabled : bool ) -> & mut Builder {
573
607
self . h1_preserve_header_case = enabled;
574
608
self
575
609
}
576
610
577
- pub ( super ) fn h1_read_buf_exact_size ( & mut self , sz : Option < usize > ) -> & mut Builder {
611
+ /// Sets the exact size of the read buffer to *always* use.
612
+ ///
613
+ /// Note that setting this option unsets the `http1_max_buf_size` option.
614
+ ///
615
+ /// Default is an adaptive read buffer.
616
+ pub fn http1_read_buf_exact_size ( & mut self , sz : Option < usize > ) -> & mut Builder {
578
617
self . h1_read_buf_exact_size = sz;
579
618
self . h1_max_buf_size = None ;
580
619
self
581
620
}
582
621
622
+ /// Set the maximum buffer size for the connection.
623
+ ///
624
+ /// Default is ~400kb.
625
+ ///
626
+ /// Note that setting this option unsets the `http1_read_exact_buf_size` option.
627
+ ///
628
+ /// # Panics
629
+ ///
630
+ /// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
583
631
#[ cfg( feature = "http1" ) ]
584
- pub ( super ) fn h1_max_buf_size ( & mut self , max : usize ) -> & mut Self {
632
+ #[ cfg_attr( docsrs, doc( cfg( feature = "http1" ) ) ) ]
633
+ pub fn http1_max_buf_size ( & mut self , max : usize ) -> & mut Self {
585
634
assert ! (
586
635
max >= proto:: h1:: MINIMUM_MAX_BUFFER_SIZE ,
587
636
"the max_buf_size cannot be smaller than the minimum that h1 specifies."
0 commit comments