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
Added docs about the swift_source log field

Change-Id: I934230a006c856de844d8580f3b57f38a9845844
Allow log disable in account/container server

Logging can be disabled in the object server, but not in the
account and container server though both sample configs already
include that setting. This patch allows to disable logging for
account and container server as well.

Functionality is ensured by some additional tests.

Closes-Bug: 1280954
Change-Id: Ia4e87911863089c3bea093d9f181ff29e9e963eb
Merge "Added docs about the swift_source log field"
Merge "Allow log disable in account/container server"
Improve StaticWeb 404 on web-listings/index

A common scenario is for users to make a container public via an ACL.
They can then use a browser to display the objects in the container.
Next, they enable StaticWeb with something such as
"X-Container-Meta-Web-Index:index.html" -- but then get confused
because they get 404 Not Found (when index.html does not exist).

For someone who understands what they are doing, this makes sense.
However, we've had several customer escalations because of this.
Usually, they are just playing with our GUI and have no intention
of using StaticWeb for real -- the 404 looks like something is
broken; not the correct response.

The solution is to provide a better error message. This message is only
shown when StaticWeb is refusing to give a listing -- other 404 situations
are not affected. Also, a custom 404 error page is not affected.

Change-Id: I3ba8c48e0ce148d8e91a1e0dc16a0d37a692a24e
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
Fix misspellings in swift

Fix misspellings detected by:
* pip install misspellings
* git ls-files | grep -v locale | misspellings -f -

Change-Id: I6594fc4ca5ae10bd30eac8a2f2493a376adcadee
Closes-Bug: #1257295
Support If-[None-]Match for object HEAD, SLO, and DLO

I moved the checking of If-Match and If-None-Match out of the object
server's GET method and into swob so that everyone can use it. The
interface is similar to the Range handling; make a response with
conditional_response=True, and you get handing of If-Match and
If-None-Match.

Since the only users of conditional_response are object GET, object
HEAD, SLO, and DLO, this has the effect of adding support for If-Match
and If-None-Match to just the latter three places and nowhere
else. This makes object GET and HEAD consistent for any kind of
object, large or small.

This also fixes a bug where various conditional headers (If-*) were
passed through to the object server on segment requests, which could
cause segment requests to fail with a 304 or 412 response. Now only
certain headers are copied to the segment requests, and that doesn't
include the conditional ones, so they can't goof up the segment
retrieval.

Note that I moved SegmentedIterable to swift.common.request_helpers
because it sprouted a transitive dependency on swob, and leaving it in
utils caused a circular import.

Bonus fix: unified the handling of DiskFileQuarantined and
DiskFileNotFound in object server GET and HEAD. Now in either case, a
412 will be returned if the client said "If-Match: *". If not, the
response is a 404, just like before.

Closes-Bug: 1279076
Closes-Bug: 1280022
Closes-Bug: 1280028

Change-Id: Id2ee78346244d516b980202e990aa38ce6812de5
Merge "Fix misspellings in swift"
Merge "Support If-[None-]Match for object HEAD, SLO, and DLO"
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
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"