add OPTIONS to proxy_logging configs and docs

Change-Id: I77e1d7fdcf217826402beeb7d583e3c7279c416c
This commit is contained in:
John Dickinson 2012-11-06 15:13:01 -08:00
parent d64649d9e7
commit ec75d1e343
4 changed files with 6 additions and 5 deletions

View File

@ -794,9 +794,9 @@ Metrics for `proxy-logging` middleware (in the table, `<type>` 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 `<verb>` 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

View File

@ -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 <verb> 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

View File

@ -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 = {}

View File

@ -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(), {})