summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httpservers.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2011-01-22 13:13:05 (GMT)
committerArmin Ronacher <armin.ronacher@active-4.com>2011-01-22 13:13:05 (GMT)
commit8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4 (patch)
tree85053ad58fdc9fd916611a6d3b9cc4942feeeb23 /Lib/test/test_httpservers.py
parent137e0f0a2218479232405a4e826074148f735666 (diff)
downloadcpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.zip
cpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.tar.gz
cpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r--Lib/test/test_httpservers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index e42038a..2cc94a9 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -97,6 +97,11 @@ class BaseHTTPServerTestCase(BaseTestCase):
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 @@ class BaseHTTPServerTestCase(BaseTestCase):
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):