Commit 9af292c3 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix inadvertent use of shared objects

Fix inadvertent use of shared objects in synnefo/lib/astakos.py and
pithos/api/delegate.py, since current use is racy when running multiple
requests under gunicorn. Create a private, per-request copy instead.
parent 636c8684
...@@ -64,11 +64,13 @@ def retry(howmany): ...@@ -64,11 +64,13 @@ def retry(howmany):
return execute return execute
def call(token, url, headers={}, body=None, method='GET'): def call(token, url, headers=None, body=None, method='GET'):
p = urlparse(url) p = urlparse(url)
kwargs = {} kwargs = {}
kwargs['headers'] = headers if headers is None:
headers = {}
kwargs["headers"] = headers
kwargs['headers']['X-Auth-Token'] = token kwargs['headers']['X-Auth-Token'] = token
if body: if body:
kwargs['body'] = body kwargs['body'] = body
......
...@@ -67,11 +67,13 @@ def delegate_to_login_service(request): ...@@ -67,11 +67,13 @@ def delegate_to_login_service(request):
return HttpResponseRedirect(uri) return HttpResponseRedirect(uri)
def proxy(request, url, headers={}, body=None): def proxy(request, url, headers=None, body=None):
p = urlparse(url) p = urlparse(url)
kwargs = {} kwargs = {}
kwargs['headers'] = headers if headers is None:
headers = {}
kwargs["headers"] = headers
kwargs['headers'].update(request.META) kwargs['headers'].update(request.META)
kwargs['body'] = body kwargs['body'] = body
kwargs['headers'].setdefault('content-type', 'application/json') kwargs['headers'].setdefault('content-type', 'application/json')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment