Deleted
Added
test_http_header.py (720:44137449296a) | test_http_header.py (738:d2119ce8a39d) |
---|---|
1import unittest 2import unit 3 4class TestUnitHTTPHeader(unit.TestUnitApplicationPython): 5 6 def setUpClass(): 7 unit.TestUnit().check_modules('python') 8 --- 69 unchanged lines hidden (view full) --- 78 resp = self.get(headers={ 79 'Custom-Header': '(),/:;<=>?@[\]{}\t !#$%&\'*+-.^_`|~' 80 }) 81 82 self.assertEqual(resp['status'], 200, 'value chars status') 83 self.assertEqual(resp['headers']['Custom-Header'], 84 '(),/:;<=>?@[\]{}\t !#$%&\'*+-.^_`|~', 'value chars custom header') 85 | 1import unittest 2import unit 3 4class TestUnitHTTPHeader(unit.TestUnitApplicationPython): 5 6 def setUpClass(): 7 unit.TestUnit().check_modules('python') 8 --- 69 unchanged lines hidden (view full) --- 78 resp = self.get(headers={ 79 'Custom-Header': '(),/:;<=>?@[\]{}\t !#$%&\'*+-.^_`|~' 80 }) 81 82 self.assertEqual(resp['status'], 200, 'value chars status') 83 self.assertEqual(resp['headers']['Custom-Header'], 84 '(),/:;<=>?@[\]{}\t !#$%&\'*+-.^_`|~', 'value chars custom header') 85 |
86 @unittest.expectedFailure |
|
86 def test_http_header_value_chars_edge(self): 87 self.load('custom_header') 88 | 87 def test_http_header_value_chars_edge(self): 88 self.load('custom_header') 89 |
89 resp = self.get(headers={ 90 'Custom-Header': '\x20\xFF' 91 }) | 90 resp = self.http(b"""GET / HTTP/1.1 91Host: localhost 92Custom-Header: \x20\xFF 93Connection: close |
92 | 94 |
95""", raw=True, encoding='latin1') 96 |
|
93 self.assertEqual(resp['status'], 200, 'value chars edge status') 94 self.assertEqual(resp['headers']['Custom-Header'], '\xFF', 95 'value chars edge') 96 97 def test_http_header_value_chars_below(self): 98 self.load('custom_header') 99 | 97 self.assertEqual(resp['status'], 200, 'value chars edge status') 98 self.assertEqual(resp['headers']['Custom-Header'], '\xFF', 99 'value chars edge') 100 101 def test_http_header_value_chars_below(self): 102 self.load('custom_header') 103 |
100 resp = self.get(headers={ 101 'Custom-Header': '\x1F' 102 }) | 104 resp = self.http(b"""GET / HTTP/1.1 105Host: localhost 106Custom-Header: \x1F 107Connection: close |
103 | 108 |
109""", raw=True) 110 |
|
104 self.assertEqual(resp['status'], 400, 'value chars below') 105 106 def test_http_header_field_leading_sp(self): 107 self.load('empty') 108 109 resp = self.get(headers={ 110 ' Custom-Header': 'blah' 111 }) --- 32 unchanged lines hidden --- | 111 self.assertEqual(resp['status'], 400, 'value chars below') 112 113 def test_http_header_field_leading_sp(self): 114 self.load('empty') 115 116 resp = self.get(headers={ 117 ' Custom-Header': 'blah' 118 }) --- 32 unchanged lines hidden --- |