Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_httpservers.py @ 67719:30c91342b6ae
Issue #10980: encode headers with latin1 instead of ASCII in the HTTP server.
This makes the implementation of PEP 3333 compliant servers on top of
BaseHTTPServer possible.
| author | Armin Ronacher <armin.ronacher@active-4.com> |
|---|---|
| date | Sat, 22 Jan 2011 13:13:05 +0000 |
| parents | 5aa433a277f9 |
| children | b3cadf5cf742 |
line wrap: on
line diff
--- a/Lib/test/test_httpservers.py Sat Jan 22 10:33:01 2011 +0000 +++ b/Lib/test/test_httpservers.py Sat Jan 22 13:13:05 2011 +0000 @@ -97,6 +97,11 @@ self.send_header('Connection', 'close') self.end_headers() + def do_LATINONEHEADER(self): + self.send_response(999) + self.send_header('X-Special', 'Dängerous Mind') + self.end_headers() + def setUp(self): BaseTestCase.setUp(self) self.con = http.client.HTTPConnection('localhost', self.PORT) @@ -194,6 +199,11 @@ res = self.con.getresponse() self.assertEqual(res.status, 999) + def test_latin1_header(self): + self.con.request('LATINONEHEADER', '/') + res = self.con.getresponse() + self.assertEqual(res.getheader('X-Special'), 'Dängerous Mind') + class SimpleHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler):
