From 99b2aa0decc49c34694b3ae96dd4455c4c2e8ce1 Mon Sep 17 00:00:00 2001 From: David Goetz Date: Wed, 14 Dec 2011 14:37:22 -0800 Subject: [PATCH] client HEAD headers and swift source in logs Change-Id: Ic5e3b6d333f94da971bf3e0ae4cdd6a9689c7f1c --- swift/common/client.py | 7 +++++-- swift/proxy/server.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/swift/common/client.py b/swift/common/client.py index 995b7040ac..fd957364ed 100644 --- a/swift/common/client.py +++ b/swift/common/client.py @@ -343,7 +343,7 @@ def get_container(url, token, container, marker=None, limit=None, return resp_headers, json_loads(resp.read()) -def head_container(url, token, container, http_conn=None): +def head_container(url, token, container, http_conn=None, headers=None): """ Get container stats. @@ -361,7 +361,10 @@ def head_container(url, token, container, http_conn=None): else: parsed, conn = http_connection(url) path = '%s/%s' % (parsed.path, quote(container)) - conn.request('HEAD', path, '', {'X-Auth-Token': token}) + req_headers = {'X-Auth-Token': token} + if headers: + req_headers.update(headers) + conn.request('HEAD', path, '', req_headers) resp = conn.getresponse() resp.read() if resp.status < 200 or resp.status >= 300: diff --git a/swift/proxy/server.py b/swift/proxy/server.py index 9ba5807799..05f207c872 100644 --- a/swift/proxy/server.py +++ b/swift/proxy/server.py @@ -1904,6 +1904,7 @@ class Application(BaseApplication): req.environ.get('swift.trans_id', '-'), logged_headers or '-', trans_time, + req.environ.get('swift.source', '-'), ))) # done with this transaction self.access_logger.txn_id = None