Fix fd leak from get_logger() in python 2.6

Calling get_logger({}) instantiates a logging.handlers.SyslogHandler,
which opens and keeps a socket around (either /dev/log or UDP or
whatever; not important).

Under Python 2.6, all logging handlers instantiated anywhere at all
will live for the entire lifetime of the program; they get stored in
logging._handlerList and logging._handlers. Python 2.7 is very
similar, but uses weakrefs instead of strong references in those
module-level variables, so logging handlers can actually get cleaned
up prior to program exit.

The net effect is that any program that calls get_logger() more than a
fixed number of times will leak file descriptors under Python 2.6.

This commit throws encapsulation out the window and, under 2.6 only,
replaces strong references with weakrefs in logging._handlerList and
logging._handlers, thus avoiding the leak.

Change-Id: I5dc0d1619c5a4500f892b898afd9e3668ec0ee7c
Allow multiple storage_domain in cname_lookup.

Implements: blueprint multiple-domains-in-domain-remap
Change-Id: Ia647f6777717e9ff4955ea66b29f072ac03d2785
Limit logged headers in proxy_logging middleware

Currently all headers are logged if access_log_headers are enabled in
proxy_logging middleware. By adding the option access_log_headers_only
it is now possible to limit the logged headers to the given header values.

DocImpact
Change-Id: I0a1e40567c9eddc9bb00dd00373dc6eeb33d347c
Fix account quota mw for handling a bad source path

The copy source must be container/object.
This patch avoids the server to return
an internal server error when user provides
a path without a container.

Change-Id: I8ea4e62b2a00c4b4a1666d30411a6c93a4f848a5
Fixes: bug #1254626
Fix invalid account acl generating 500 response.

Sending an account POST with an X-Account-Access-Control
header value that is valid json but not a valid ACL was
causing a 500 Internal Error if the value did not parse
to a dict due to an exception being raised in tempauth.py.

This patch modifies acl.py to check that the header value
is both json and parses to a dict. The existing
tests are extended to cover these invalid header values.

This patch also enables json encoded dicts with whitespace
(e.g. '{ }') to be accepted as a value for
X-Account-Access-Control in the same way that '{}' is.
These previously resulted in a 400 response.

Closes-bug: 1281626

Change-Id: Ia06ba9c9d16f749f801a8158e73d3898c4a42888
Alphabetized items under "Misc" in source documentation

I alphabetized the items under "Misc" in the source documentation to
make them easier to locate.

Change-Id: I1badca7a97e7d887fefac0be2e2208eec52cec60
Raise error on long or short DLO

The GET response for a DLO has a Content-Length that's computed from
the container listing, but the response body's length is determined by
the segments. If a segment grows or shrinks between when the headers
are sent and when the segment is requested, this confuses clients.

For example, if the DLO is longer than its Content-Length and the
client sends another request on the same TCP connection, then it can
get leftover object bytes instead of an HTTP status line.
Alternately, if the headers it sends fill up the TCP buffers since
Swift won't read them until the first response is done, then deadlock
hilarity ensues.

If the DLO is shorter than its Content-Length, you're pretty much
guaranteed a deadlock: the client is waiting for the rest of the
response, and the server is waiting for a new request.

Now SegmentedIterable detects both these conditions and raises an
exception so that the TCP connection gets torn down. It can't save
this request, but it can stop the next one from getting hosed too.

Change-Id: Icf79ba046ef7aaaab49ce6d0b33147332c967afc
Functional tests for SLO If-Match/If-None-Match

Change-Id: Ib70f579f5edebc7b1586e5f51fee5769bcaa9931
Functional tests for DLO If-Match/If-None-Match

Change-Id: I4a731a3836eb0f58b897ee43477b3b76d2344a81
Alphabetized items under other sections in source documentation

I alphabetized the items under "Proxy", "Account", "Container",
and "Object" in the source documentation to make them easier to
locate.

Change-Id: Ia9cca0ee558cb1e0361c1a88103352bd006da1e3
Refactor a quorum-size calculation

No behavior change, just use the utility function instead of rolling
our own.

Change-Id: I152ccd8f22f424cd7547fa4d67df020f263096a9
Merge "Limit logged headers in proxy_logging middleware"
Merge "Raise error on long or short DLO"
Merge "Allow multiple storage_domain in cname_lookup."
tabs to spaces

Change-Id: Ie3d3af87df8f72792abf345c0d4dcfe2be1f4141
Merge "Functional tests for DLO If-Match/If-None-Match"
Merge "Functional tests for SLO If-Match/If-None-Match"
Merge "Fix invalid account acl generating 500 response."
Merge "tabs to spaces"
Alphabetized items under "Middleware" in source documentation

I alphabetized the items under "Middleware" in the source documentation
to make them easier to locate.

Change-Id: I3a0108c89d16ef07b7623dda518b3096c2686002