mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
137e0f0a22
commit
8d96d77f9a
3 changed files with 16 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue