Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove AUTHORIZATION header #649

Merged
merged 1 commit into from
Dec 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions aiohttp/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ def create_wsgi_environ(self, message, payload):
script_name = self.SCRIPT_NAME

for hdr_name, hdr_value in message.headers.items():
if hdr_name == 'AUTHORIZATION':
continue
elif hdr_name == 'SCRIPT_NAME':
if hdr_name == 'SCRIPT_NAME':
script_name = hdr_value
elif hdr_name == 'CONTENT-TYPE':
environ['CONTENT_TYPE'] = hdr_value
Expand Down
11 changes: 6 additions & 5 deletions tests/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,15 @@ def test_dont_unquote_environ_path_info(self):
environ = self._make_one()
self.assertEqual(environ['PATH_INFO'], path)

def test_not_add_authorization(self):
self.headers.extend({'AUTHORIZATION': 'spam',
'X-CUSTOM-HEADER': 'eggs'})
def test_authorization(self):
# This header should be removed according to CGI/1.1 and WSGI but
# in our case basic auth is not handled by server, so should
# not be removed
self.headers.extend({'AUTHORIZATION': 'spam'})
self.message = protocol.RawRequestMessage(
'GET', '/', (1, 1), self.headers, True, 'deflate')
environ = self._make_one()
self.assertEqual('eggs', environ['HTTP_X_CUSTOM_HEADER'])
self.assertFalse('AUTHORIZATION' in environ)
self.assertEqual('spam', environ['HTTP_AUTHORIZATION'])

def test_http_1_0_no_host(self):
headers = multidict.MultiDict({})
Expand Down