From ae129bf5e8c918efd8ee66279f98ee85e7c97b24 Mon Sep 17 00:00:00 2001 From: Kota Tsuyuzaki Date: Fri, 15 May 2015 06:44:12 -0700 Subject: [PATCH] eventlet.posthook related code needn't anymore In the past, older Swift seemed to use eventlet.posthooks scheme for the logging on proxy with posthooklogger method. However, for now, Swift attaches no method to eventlet.posthooks everywhere so we don't have to maintain the posthooks anymore. Change-Id: Ie63941a202d448532d980252a4d25575f8edab9c --- swift/common/wsgi.py | 4 ++-- swift/proxy/controllers/obj.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py index 3a75e7197f..e7504355b6 100644 --- a/swift/common/wsgi.py +++ b/swift/common/wsgi.py @@ -1084,8 +1084,8 @@ def make_env(env, method=None, path=None, agent='Swift', query_string=None, :returns: Fresh WSGI environment. """ newenv = {} - for name in ('eventlet.posthooks', 'HTTP_USER_AGENT', 'HTTP_HOST', - 'PATH_INFO', 'QUERY_STRING', 'REMOTE_USER', 'REQUEST_METHOD', + for name in ('HTTP_USER_AGENT', 'HTTP_HOST', 'PATH_INFO', + 'QUERY_STRING', 'REMOTE_USER', 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT', 'HTTP_ORIGIN', 'HTTP_ACCESS_CONTROL_REQUEST_METHOD', 'SERVER_PROTOCOL', 'swift.cache', 'swift.source', diff --git a/swift/proxy/controllers/obj.py b/swift/proxy/controllers/obj.py index 9633c4b271..ac45324f87 100644 --- a/swift/proxy/controllers/obj.py +++ b/swift/proxy/controllers/obj.py @@ -818,6 +818,13 @@ class BaseObjectController(Controller): self.object_name = dest_object # re-write the existing request as a PUT instead of creating a new one # since this one is already attached to the posthooklogger + # TODO: Swift now has proxy-logging middleware instead of + # posthooklogger used in before. i.e. we don't have to + # keep the code depends on evnetlet.posthooks sequence, IMHO. + # However, creating a new sub request might + # cause the possibility to hide some bugs behindes the request + # so that we should discuss whichi is suitable (new-sub-request + # vs re-write-existing-request) for Swift. [kota_] req.method = 'PUT' req.path_info = '/v1/%s/%s/%s' % \ (dest_account, dest_container, dest_object)