From b782139273b321745b0193449a416da5903157d3 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Thu, 22 Sep 2016 12:08:30 +0300 Subject: [PATCH] Fix broken upper-casing in wsgi support #1197 --- CHANGES.rst | 7 ++----- aiohttp/wsgi.py | 1 + tests/test_wsgi.py | 6 ++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8dce3e768da..3e51369a93f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ CHANGES ======= -1.0.2 (XXXX-XX-XX) +1.0.2 (2016-09-22) ------------------ - Make CookieJar compatible with 32-bit systems #1188 @@ -10,11 +10,8 @@ CHANGES - Fix `CookieJar` ctor when called with `loop=None` #1203 -- +- Fix broken upper-casing in wsgi support #1197 -- - -- 1.0.1 (2016-09-16) ------------------ diff --git a/aiohttp/wsgi.py b/aiohttp/wsgi.py index 298873f8b4a..251c044acea 100644 --- a/aiohttp/wsgi.py +++ b/aiohttp/wsgi.py @@ -65,6 +65,7 @@ def create_wsgi_environ(self, message, payload): script_name = self.SCRIPT_NAME for hdr_name, hdr_value in message.headers.items(): + hdr_name = hdr_name.upper() if hdr_name == 'SCRIPT_NAME': script_name = hdr_value elif hdr_name == 'CONTENT-TYPE': diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index 76dfb5d9048..5ebce0b4ade 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -6,8 +6,9 @@ import unittest from unittest import mock +import multidict import aiohttp -from aiohttp import helpers, multidict, protocol, wsgi +from aiohttp import helpers, protocol, wsgi class TestHttpWsgiServerProtocol(unittest.TestCase): @@ -26,7 +27,7 @@ def setUp(self): ('1.2.3.4', 1234), ('2.3.4.5', 80)] - self.headers = multidict.MultiDict({"HOST": "python.org"}) + self.headers = multidict.CIMultiDict({"HOST": "python.org"}) self.raw_headers = [(b"HOST", b"python.org")] self.message = protocol.RawRequestMessage( 'GET', '/path', (1, 0), self.headers, self.raw_headers, @@ -73,6 +74,7 @@ def test_environ_headers(self): ('X_TEST', '123'), ('X_TEST', '456'))) environ = self._make_one() + print(environ) self.assertEqual(environ['CONTENT_TYPE'], 'text/plain') self.assertEqual(environ['CONTENT_LENGTH'], '209') self.assertEqual(environ['HTTP_X_TEST'], '123,456')