File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1834,6 +1834,24 @@ mod tests {
18341834 }
18351835 }
18361836
1837+ /// Check all subset permutations of a partial request line with no headers
1838+ #[ test]
1839+ fn partial_permutations ( ) {
1840+ let req_str = "GET / HTTP/1.1\r \n \r \n " ;
1841+ let mut headers = [ EMPTY_HEADER ; NUM_OF_HEADERS ] ;
1842+ let mut req = Request :: new ( & mut headers[ ..] ) ;
1843+ for i in 0 ..req_str. len ( ) {
1844+ let status = req. parse ( req_str[ ..i] . as_bytes ( ) ) ;
1845+ assert_eq ! (
1846+ status,
1847+ Ok ( Status :: Partial ) ,
1848+ "partial request line should return partial. \
1849+ Portion which failed: '{seg}' (below {i})",
1850+ seg = & req_str[ ..i]
1851+ ) ;
1852+ }
1853+ }
1854+
18371855 static RESPONSE_WITH_WHITESPACE_BETWEEN_HEADER_NAME_AND_COLON : & [ u8 ] =
18381856 b"HTTP/1.1 200 OK\r \n Access-Control-Allow-Credentials : true\r \n Bread: baguette\r \n \r \n " ;
18391857
You can’t perform that action at this time.
0 commit comments