Store Request Fields that are needed later

Because of recent changes to how dbus authentication is done, Requests
might be moved out before they can be used.  This commit is an attempt
to mitigate the problem without needing to revert that patch.

This commit does two relatively distinct things.

First, it moves basic auth types to a model where they're timed out
instead of removed on destruction.  This removes the need for a Request
object to track that state, and arguably gives better behavior, as
basic auth sessions will survive through the timeout.
To prevent lots of basic auth sessions getting created, a basic auth
session is reused if it was:
1. Created by basic auth previously.
2. Created by the same user.
3. Created from the same source IP address.

Second, both connection classes now store the accept, and origin headers
from the request in the connection class itself, removing the need for
them.

Tested: HTML page now loads when pointing at a redfish URL with a
browser.

Change-Id: I623b43cbcbb43d9e65b408853660be09a5edb2b3
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/complete_response_fields.hpp b/http/complete_response_fields.hpp
index bec33fc..a5468a4 100644
--- a/http/complete_response_fields.hpp
+++ b/http/complete_response_fields.hpp
@@ -18,13 +18,10 @@
 namespace crow
 {
 
-inline void completeResponseFields(const Request& req, Response& res)
+inline void completeResponseFields(std::string_view accepts, Response& res)
 {
-    BMCWEB_LOG_INFO("Response:  {} {}", req.url().encoded_path(),
-                    res.resultInt());
-    addSecurityHeaders(req, res);
-
-    authentication::cleanupTempSession(req);
+    BMCWEB_LOG_INFO("Response: {}", res.resultInt());
+    addSecurityHeaders(res);
 
     res.setHashAndHandleNotModified();
     if (res.jsonValue.is_structured())
@@ -32,8 +29,7 @@
         using http_helpers::ContentType;
         std::array<ContentType, 3> allowed{ContentType::CBOR, ContentType::JSON,
                                            ContentType::HTML};
-        ContentType preferred =
-            getPreferredContentType(req.getHeaderValue("Accept"), allowed);
+        ContentType preferred = getPreferredContentType(accepts, allowed);
 
         if (preferred == ContentType::HTML)
         {