Handle COPY verb in container quota middleware

The patch fix the ability to bypass the account
quota using the COPY verb. The quotas for destination
container are now checked before the copy.

Change-Id: I9f409ea6c0893f36972aa1fabe31fb143e151ab5
Fixes: bug #1259565
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
Small efficiency improvement for SLO range GET

If a client sends a GET request with a Range header for a SLO
manifest, SLO would notice this and perform a second GET request, sans
Range header, to retrieve the manifest body. Most of the time, this is
the sane thing to do: a subset of a SLO manifest is pretty much
useless. However, if the client has requested the first N bytes of the
large object, and the SLO manifest has N or fewer bytes, then the
response will actually have the whole manifest in it, so SLO doesn't
need to make a second request. (It's not wrong, just inefficient.)

Fortunately, ranged GET responses come with a Content-Range header
that tells us first byte, last byte, and total content length. Now SLO
detects whether or not a ranged GET response contains the full
manifest, and if so, just uses the existing response instead of making
another.

Change-Id: I63b991e08a1165eb3e88bd0620a1e64ef056fec6
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 "Small efficiency improvement for SLO range GET"
Merge "Handle COPY verb in container quota middleware"
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 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
Merge "Limit logged headers in proxy_logging middleware"
Merge "Raise error on long or short DLO"