Fix keepalive false

When we changed [1] to using a std::move of the Request object instead
of an unsafe reference, we missed one spot where we were using the
request object, post handle.  This commit moves the keepalive function
to be set on the response object before calling handle.

Tested:
curl request with -H "Connection: close", -H "Connection: keep-alive"
and no header all return the correct values.

[1] 2d6cb56b6b47c3fbb0d234ade5c1208edb69ef1f

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I91fe32162407f1e1bdfcc06f1751e02d11f8a697
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 7d83476..1c1bfd9 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -188,6 +188,7 @@
             return;
         }
         thisReq.session = userSession;
+        res.keepAlive(thisReq.keepAlive());
 
         // Fetch the client IP address
         readClientIp();
@@ -300,8 +301,9 @@
             return;
         }
         res = std::move(thisRes);
+
         BMCWEB_LOG_INFO << "Response: " << this << ' ' << req->url << ' '
-                        << res.resultInt() << " keepalive=" << req->keepAlive();
+                        << res.resultInt() << " keepalive=" << res.keepAlive();
 
         addSecurityHeaders(*req, res);
 
@@ -369,8 +371,6 @@
 
         res.addHeader(boost::beast::http::field::date, getCachedDateStr());
 
-        res.keepAlive(req->keepAlive());
-
         doWrite(res);
 
         // delete lambda with self shared_ptr
@@ -533,7 +533,7 @@
                 BMCWEB_LOG_DEBUG << this << " from write(2)";
                 return;
             }
-            if (!res.keepAlive())
+            if (!serializer->get().keep_alive())
             {
                 close();
                 BMCWEB_LOG_DEBUG << this << " from write(1)";