Uses None instead of mutable dicts for default function arguments

Forgot to update dicts with changeset I4a89afad, which updated lists.

Change-Id: Ieca71b9c90ee5dae83a43f6851b6b8b2924bcb8e
Fixes: bug 1174809
Update to flake8 instead of pep8.

Change-Id: I3d4a31111c3044da06611405ce80f208ef8a0ce3
Merge "Update to flake8 instead of pep8."
Enhance log msg to report referer and user-agent

Enhance internally logged messages to report referer and user-agent.

Pass the referering URL and METHOD between internal servers (when
known), and set the user-agent to be the server type (obj-server,
container-server, proxy-server, obj-updater, obj-replicator,
container-updater, direct-client, etc.) with the process PID. In
conjunction with the transaction ID, it helps to track down which PID
from a given system was responsible for initiating the request and
what that server was working on to make this request.

This has been helpful in tracking down interactions between object,
container and account servers.

We also take things a bit further performaing a bit of refactoring to
consolidate calls to transfer_headers() now that we have a helper
method for constructing them.

Finally we performed further changes to avoid header key duplication
due to string literal header key values and the various objects
representing headers for requests and responses. See below for more
details.

====

Header Keys

There seems to be a bit of a problem with the case of the various
string literals used for header keys and the interchangable way
standard Python dictionaries, HeaderKeyDict() and HeaderEnvironProxy()
objects are used.

If one is not careful, a header object of some sort (one that does not
normalize its keys, and that is not necessarily a dictionary) can be
constructed containing header keys which differ only by the case of
their string literals. E.g.:

   { 'x-trans-id': '1234', 'X-Trans-Id': '5678' }

Such an object, when passed to http_connect() will result in an
on-the-wire header where the key values are merged together, comma
separated, that looks something like:

   HTTP_X_TRANS_ID: 1234,5678

For some headers in some contexts, this is behavior is desirable. For
example, one can also use a list of tuples which enumerate the multiple
values a single header should have.

However, in almost all of the contexts used in the code base, this is
not desirable.

This behavior arises from a combination of factors:

   1. Header strings are not constants and different lower-case and
      title-case header strings values are used interchangably in the
      code at times

      It might be worth the effort to make a pass through the code to
      stop using string literals and use constants instead, but there
      are plusses and minuses to doing that, so this was not attempted
      in this effort

   2. HeaderEnvironProxy() objects report their keys in ".title()"
      case, but normalize all other key references to the form
      expected by the Request class's environ field

      swob.Request.headers fields are HeaderEnvironProxy() objects.

   3. HeaderKeyDict() objects report their keys in ".lower()" case,
      and normalize all other key references to ".lower()" case

      swob.Response.headers fields are HeaderKeyDict() objects.

Depending on which object is used and how it is used, one can end up
with such a mismatch.

This commit takes the following steps as a (PROPOSED) solution:

   1. Change HeaderKeyDict() to normalize using ".title()" case to
      match HeaderEnvironProxy()

   2. Replace standard python dictionary objects with HeaderKeyDict()
      objects where possible

      This gives us an object that normalizes key references to avoid
      fixing the code to normalize the string literals.

   3. Fix up a few places to use title case string literals to match
      the new defaults

*****

Reviewer directed comments (to be removed later when folks sign off on
this direction):

  * I don't consider the use of HeaderKeyDict(), and the change to use
    ".title()" case a good solution, as I am not sure of all the
    ramifications

  * This change should address the previous issues found in review
    where double x-trans-id headers were seen, and then adding the
    method use on the referring URL

  * This used to be two commits, the logging changes and the
    consolidation of transfer_header() calls, but with the header key
    issue above, it became part of the above solution to make the
    fixes simpler

    One can envision breaking this commit into separate commits as
    follows:

      1. Commit with the changes to HeaderKeyDict() becoming title()
         case based

      2. Commit with the changes to replace standard python
         dictionaries with HeaderKeyDict() objects

      3. Commit with the generate_headers() routine consolidating
         header construction

    I chose not to do that because the second step would be elminated
    by the third, and the first step seems reviewable in this
    context. I would be happy to take that approach and resubmit this
    work if that would be helpful to reviewers.

Change-Id: Ied56a1df83ffac793ee85e796424d7d20f18f469
Signed-off-by: Peter Portante <peter.portante@redhat.com>