Fix auth plugins on Python 3.x

Python 3 does not have a `getheader` method on the header object,
and instead uses just `get`.
This commit is contained in:
Solly Ross 2015-08-25 17:50:22 -04:00
parent cbfe2b3b45
commit 1e894f0d29
1 changed files with 1 additions and 2 deletions

View File

@ -19,7 +19,6 @@ class InvalidOriginError(AuthenticationError):
"Invalid Origin Header: Expected one of " "Invalid Origin Header: Expected one of "
"%s, got '%s'" % (expected, actual)) "%s, got '%s'" % (expected, actual))
class ExpectOrigin(object): class ExpectOrigin(object):
def __init__(self, src=None): def __init__(self, src=None):
if src is None: if src is None:
@ -28,6 +27,6 @@ class ExpectOrigin(object):
self.source = src.split() self.source = src.split()
def authenticate(self, headers, target_host, target_port): def authenticate(self, headers, target_host, target_port):
origin = headers.getheader('Origin', None) origin = headers.get('Origin', None)
if origin is None or origin not in self.source: if origin is None or origin not in self.source:
raise InvalidOriginError(expected=self.source, actual=origin) raise InvalidOriginError(expected=self.source, actual=origin)