@@ -18,6 +18,12 @@ def test_normalize_and_validate():
1818 assert "foo bar" in str (excinfo .value )
1919 with pytest .raises (LocalProtocolError ):
2020 normalize_and_validate ([(b"foo\x00 bar" , b"baz" )])
21+ # Not even 8-bit characters:
22+ with pytest .raises (LocalProtocolError ):
23+ normalize_and_validate ([(b"foo\xff bar" , b"baz" )])
24+ # And not even the control characters we allow in values:
25+ with pytest .raises (LocalProtocolError ):
26+ normalize_and_validate ([(b"foo\x01 bar" , b"baz" )])
2127
2228 # no return or NUL characters in values
2329 with pytest .raises (LocalProtocolError ) as excinfo :
@@ -29,7 +35,13 @@ def test_normalize_and_validate():
2935 normalize_and_validate ([("foo" , "bar\x00 baz" )])
3036 # no leading/trailing whitespace
3137 with pytest .raises (LocalProtocolError ):
32- normalize_and_validate ([("foo" , " barbaz " )])
38+ normalize_and_validate ([("foo" , "barbaz " )])
39+ with pytest .raises (LocalProtocolError ):
40+ normalize_and_validate ([("foo" , " barbaz" )])
41+ with pytest .raises (LocalProtocolError ):
42+ normalize_and_validate ([("foo" , "barbaz\t " )])
43+ with pytest .raises (LocalProtocolError ):
44+ normalize_and_validate ([("foo" , "\t barbaz" )])
3345
3446 # content-length
3547 assert (normalize_and_validate ([("Content-Length" , "1" )])
0 commit comments