REST: Increase timeout for image upload

The timeout was 10 seconds for:
1. The uploaded contenet is written to tmpfs
2. Wait for software version manager to parse the content and create the
   version object.

For a tarball without compression, the timeout is enough, but for a
compressed tarball, the timeout may not be enough, e.g. Palmetto takes
about 9.x seconds to decompress the PNOR tarball.

Change the timeout to 15 seconds, and start the timer after the file is
written to tmpfs.

Partially resovles openbmc/bmcweb#60
Tested: Verify no more 400 error on uploading gzipped tarball.

Change-Id: I4e621236ed0c10892f8a5fef0d6a3ca2af911e93
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 6bf5661..867d1bc 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -32,9 +32,9 @@
     static boost::asio::deadline_timer timeout(*req.ioService,
                                                boost::posix_time::seconds(5));
 
-    timeout.expires_from_now(boost::posix_time::seconds(10));
+    timeout.expires_from_now(boost::posix_time::seconds(15));
 
-    timeout.async_wait([&res](const boost::system::error_code& ec) {
+    auto timeoutHandler = [&res](const boost::system::error_code& ec) {
         fwUpdateMatcher = nullptr;
         if (ec == asio::error::operation_aborted)
         {
@@ -57,7 +57,7 @@
             {"message", "400 Bad Request"},
             {"status", "error"}};
         res.end();
-    });
+    };
 
     std::function<void(sdbusplus::message::message&)> callback =
         [&res](sdbusplus::message::message& m) {
@@ -110,6 +110,7 @@
                                     std::ofstream::trunc);
     out << req.body;
     out.close();
+    timeout.async_wait(timeoutHandler);
 }
 
 template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app)