@@ -18,6 +18,12 @@ def test_normalize_and_validate():
18
18
assert "foo bar" in str (excinfo .value )
19
19
with pytest .raises (LocalProtocolError ):
20
20
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" )])
21
27
22
28
# no return or NUL characters in values
23
29
with pytest .raises (LocalProtocolError ) as excinfo :
@@ -29,7 +35,13 @@ def test_normalize_and_validate():
29
35
normalize_and_validate ([("foo" , "bar\x00 baz" )])
30
36
# no leading/trailing whitespace
31
37
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" )])
33
45
34
46
# content-length
35
47
assert (normalize_and_validate ([("Content-Length" , "1" )])
0 commit comments