comparison Core/HttpServer/HttpOutput.cpp @ 3178:6d558598d713

Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Jan 2019 12:41:20 +0100
parents 81cd9a4f3018
children 0528a6c36f3d
comparison
equal deleted inserted replaced
3177:053e72ff9fc5 3178:6d558598d713
44 #include <vector> 44 #include <vector>
45 #include <stdio.h> 45 #include <stdio.h>
46 #include <boost/lexical_cast.hpp> 46 #include <boost/lexical_cast.hpp>
47 47
48 48
49 #if ORTHANC_ENABLE_CIVETWEB == 1
50 # if !defined(CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
51 # error Macro CIVETWEB_HAS_DISABLE_KEEP_ALIVE must be defined
52 # endif
53 #endif
54
55
49 namespace Orthanc 56 namespace Orthanc
50 { 57 {
51 HttpOutput::StateMachine::StateMachine(IHttpOutputStream& stream, 58 HttpOutput::StateMachine::StateMachine(IHttpOutputStream& stream,
52 bool isKeepAlive) : 59 bool isKeepAlive) :
53 stream_(stream), 60 stream_(stream),
430 { 437 {
431 #if ORTHANC_ENABLE_MONGOOSE == 1 438 #if ORTHANC_ENABLE_MONGOOSE == 1
432 throw OrthancException(ErrorCode_NotImplemented, 439 throw OrthancException(ErrorCode_NotImplemented,
433 "Multipart answers are not implemented together " 440 "Multipart answers are not implemented together "
434 "with keep-alive connections if using Mongoose"); 441 "with keep-alive connections if using Mongoose");
435 #else 442
443 #elif ORTHANC_ENABLE_CIVETWEB == 1
444 # if CIVETWEB_HAS_DISABLE_KEEP_ALIVE == 1
436 // Turn off Keep-Alive for multipart answers 445 // Turn off Keep-Alive for multipart answers
437 // https://github.com/civetweb/civetweb/issues/727 446 // https://github.com/civetweb/civetweb/issues/727
438 stream_.DisableKeepAlive(); 447 stream_.DisableKeepAlive();
439 header += "Connection: close\r\n"; 448 header += "Connection: close\r\n";
449 # else
450 // The function "mg_disable_keep_alive()" is not available,
451 // let's continue with Keep-Alive. Performance of WADO-RS will
452 // decrease.
453 header += "Connection: keep-alive\r\n";
454 # endif
455
456 #else
457 # error Please support your embedded Web server here
440 #endif 458 #endif
441 } 459 }
442 else 460 else
443 { 461 {
444 header += "Connection: close\r\n"; 462 header += "Connection: close\r\n";