summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-09-09 13:05:51 +1000
committerJeremy Kerr <jk@ozlabs.org>2008-09-09 13:11:12 +1000
commitf0d09c7ad846a02c4d5d99bfe412b0ba35164150 (patch)
tree1125baf6ede8679755361adad465d7bb39a15fdf /apps
parent13f4232358785f4ca89ce1c4605a4b01db1940ef (diff)
downloadpatchwork-f0d09c7ad846a02c4d5d99bfe412b0ba35164150.tar.bz2
patchwork-f0d09c7ad846a02c4d5d99bfe412b0ba35164150.tar.xz
Pass Authorization headers in fastcgi application
By default, mod_fcgi doens't allow the Authorization header, so enable -pass-header, and handle the different header name in the xmlrpc view Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/patchwork/views/xmlrpc.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/patchwork/views/xmlrpc.py b/apps/patchwork/views/xmlrpc.py
index f493cf7..f7a8dac 100644
--- a/apps/patchwork/views/xmlrpc.py
+++ b/apps/patchwork/views/xmlrpc.py
@@ -51,10 +51,18 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher):
def _user_for_request(self, request):
- if not request.META.has_key('HTTP_AUTHORIZATION'):
+ auth_header = None
+
+ if request.META.has_key('HTTP_AUTHORIZATION'):
+ auth_header = request.META.get('HTTP_AUTHORIZATION')
+ elif request.META.has_key('Authorization'):
+ auth_header = request.META.get('Authorization')
+
+ if auth_header is None or auth_header == '':
raise Exception("No authentication credentials given")
- str = request.META.get('HTTP_AUTHORIZATION').strip()
+ str = auth_header.strip()
+
if not str.startswith('Basic '):
raise Exception("Authentication scheme not supported")