diff OrthancFramework/Sources/HttpServer/HttpOutput.cpp @ 5119:bdec57f3cbf2

New configuration KeepAliveTimeout with a default value of 1 second
author Alain Mazy <am@osimis.io>
date Wed, 14 Dec 2022 11:50:43 +0100
parents 43e613a7756b
children 0ea402b4d901
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpOutput.cpp	Fri Dec 09 12:42:17 2022 +0100
+++ b/OrthancFramework/Sources/HttpServer/HttpOutput.cpp	Wed Dec 14 11:50:43 2022 +0100
@@ -47,14 +47,16 @@
 namespace Orthanc
 {
   HttpOutput::StateMachine::StateMachine(IHttpOutputStream& stream,
-                                         bool isKeepAlive) : 
+                                         bool isKeepAlive,
+                                         unsigned int keepAliveTimeout) : 
     stream_(stream),
     state_(State_WritingHeader),
     status_(HttpStatus_200_Ok),
     hasContentLength_(false),
     contentLength_(0),
     contentPosition_(0),
-    keepAlive_(isKeepAlive)
+    keepAlive_(isKeepAlive),
+    keepAliveTimeout_(keepAliveTimeout)
   {
   }
 
@@ -189,7 +191,7 @@
          * HTTP header, so we can't use the milliseconds granularity.
          **/
         s += ("Keep-Alive: timeout=" +
-              boost::lexical_cast<std::string>(CIVETWEB_KEEP_ALIVE_TIMEOUT_SECONDS) + "\r\n");
+              boost::lexical_cast<std::string>(keepAliveTimeout_) + "\r\n");
       }
       else
       {
@@ -299,8 +301,9 @@
 
 
   HttpOutput::HttpOutput(IHttpOutputStream &stream,
-                         bool isKeepAlive) :
-    stateMachine_(stream, isKeepAlive),
+                         bool isKeepAlive,
+                         unsigned int keepAliveTimeout) :
+    stateMachine_(stream, isKeepAlive, keepAliveTimeout),
     isDeflateAllowed_(false),
     isGzipAllowed_(false)
   {