From ec75d1e343da744c8e033f62a4f82fea4a717539 Mon Sep 17 00:00:00 2001 From: John Dickinson Date: Tue, 6 Nov 2012 15:13:01 -0800 Subject: [PATCH] add OPTIONS to proxy_logging configs and docs Change-Id: I77e1d7fdcf217826402beeb7d583e3c7279c416c --- doc/source/admin_guide.rst | 6 +++--- etc/proxy-server.conf-sample | 2 +- swift/common/middleware/proxy_logging.py | 2 +- test/unit/common/middleware/test_proxy_logging.py | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/source/admin_guide.rst b/doc/source/admin_guide.rst index 401693c043..fcc50a42c0 100644 --- a/doc/source/admin_guide.rst +++ b/doc/source/admin_guide.rst @@ -794,9 +794,9 @@ Metrics for `proxy-logging` middleware (in the table, `` is either the proxy-server controller responsible for the request: "account", "container", "object", or the string "SOS" if the request came from the `Swift Origin Server`_ middleware. The `` portion will be one of "GET", "HEAD", "POST", "PUT", -"DELETE", "COPY", or "BAD_METHOD". The list of valid HTTP methods is -configurable via the `log_statsd_valid_http_methods` config variable and the -default setting yields the above behavior. +"DELETE", "COPY", "OPTIONS", or "BAD_METHOD". The list of valid HTTP methods +is configurable via the `log_statsd_valid_http_methods` config variable and +the default setting yields the above behavior. .. _Swift Origin Server: https://github.com/dpgoetz/sos diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample index 7b8135c2fe..5b9080bbd4 100644 --- a/etc/proxy-server.conf-sample +++ b/etc/proxy-server.conf-sample @@ -330,4 +330,4 @@ use = egg:swift#proxy_logging # access_log_headers = False # What HTTP methods are allowed for StatsD logging (comma-sep); request methods # not in this list will have "BAD_METHOD" for the portion of the metric. -# log_statsd_valid_http_methods = GET,HEAD,POST,PUT,DELETE,COPY +# log_statsd_valid_http_methods = GET,HEAD,POST,PUT,DELETE,COPY,OPTIONS diff --git a/swift/common/middleware/proxy_logging.py b/swift/common/middleware/proxy_logging.py index 4a1bf7ea9b..3cc21b4783 100644 --- a/swift/common/middleware/proxy_logging.py +++ b/swift/common/middleware/proxy_logging.py @@ -100,7 +100,7 @@ class ProxyLoggingMiddleware(object): self.valid_methods = conf.get( 'access_log_statsd_valid_http_methods', conf.get('log_statsd_valid_http_methods', - 'GET,HEAD,POST,PUT,DELETE,COPY')) + 'GET,HEAD,POST,PUT,DELETE,COPY,OPTIONS')) self.valid_methods = [m.strip().upper() for m in self.valid_methods.split(',') if m.strip()] access_log_conf = {} diff --git a/test/unit/common/middleware/test_proxy_logging.py b/test/unit/common/middleware/test_proxy_logging.py index b3011d5643..ceee8689b0 100644 --- a/test/unit/common/middleware/test_proxy_logging.py +++ b/test/unit/common/middleware/test_proxy_logging.py @@ -146,6 +146,7 @@ class TestProxyLogging(unittest.TestCase): 'HEAD': 'HEAD', 'POST': 'POST', 'DELETE': 'DELETE', + 'OPTIONS': 'OPTIONS', } for method, exp_method in method_map.iteritems(): app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {})