@@ -891,11 +891,38 @@ fn parse_code(bytes: &mut Bytes<'_>) -> Result<u16> {
891891///            ][..])))); 
892892/// ``` 
893893pub  fn  parse_headers < ' b :  ' h ,  ' h > ( 
894+     src :  & ' b  [ u8 ] , 
895+     dst :  & ' h  mut  [ Header < ' b > ] , 
896+ )  -> Result < ( usize ,  & ' h  [ Header < ' b > ] ) >  { 
897+     parse_headers_with_config ( src,  dst,  & ParserConfig :: default ( ) ) 
898+ } 
899+ 
900+ /// Parse a buffer of bytes as headers with a specified configuration. 
901+ /// 
902+ /// The return value, if complete and successful, includes the index of the 
903+ /// buffer that parsing stopped at, and a sliced reference to the parsed 
904+ /// headers. The length of the slice will be equal to the number of properly 
905+ /// parsed headers. 
906+ /// 
907+ /// # Example 
908+ /// 
909+ /// ``` 
910+ /// let buf = b"Host: foo.bar\nAccept: */*\n\nblah blah"; 
911+ /// let mut headers = [httparse::EMPTY_HEADER; 4]; 
912+ /// assert_eq!(httparse::parse_headers_with_config(buf, &mut headers, &httparse::ParserConfig::default()), 
913+ ///            Ok(httparse::Status::Complete((27, &[ 
914+ ///                httparse::Header { name: "Host", value: b"foo.bar" }, 
915+ ///                httparse::Header { name: "Accept", value: b"*/*" } 
916+ ///            ][..])))); 
917+ /// ``` 
918+ #[ inline]  
919+ pub  fn  parse_headers_with_config < ' b :  ' h ,  ' h > ( 
894920    src :  & ' b  [ u8 ] , 
895921    mut  dst :  & ' h  mut  [ Header < ' b > ] , 
922+     config :  & ParserConfig , 
896923)  -> Result < ( usize ,  & ' h  [ Header < ' b > ] ) >  { 
897924    let  mut  iter = Bytes :: new ( src) ; 
898-     let  pos = complete ! ( parse_headers_iter( & mut  dst,  & mut  iter,  & ParserConfig :: default ( ) ) ) ; 
925+     let  pos = complete ! ( parse_headers_iter( & mut  dst,  & mut  iter,  config ) ) ; 
899926    Ok ( Status :: Complete ( ( pos,  dst) ) ) 
900927} 
901928
0 commit comments