Mercurial > hg > orthanc
comparison OrthancFramework/Sources/HttpServer/HttpOutput.cpp @ 4301:6919242d2265
Fix keep-alive in the embedded HTTP server by setting the "Keep-Alive" HTTP header
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 06 Nov 2020 09:58:48 +0100 |
parents | db3932f9660d |
children | d9473bd5ed43 |
comparison
equal
deleted
inserted
replaced
4300:b30a8de92ad9 | 4301:6919242d2265 |
---|---|
172 "\r\n"; | 172 "\r\n"; |
173 | 173 |
174 if (keepAlive_) | 174 if (keepAlive_) |
175 { | 175 { |
176 s += "Connection: keep-alive\r\n"; | 176 s += "Connection: keep-alive\r\n"; |
177 | |
178 /** | |
179 * [LIFY-2311] The "Keep-Alive" HTTP header was missing in | |
180 * Orthanc <= 1.8.0, which notably caused failures if | |
181 * uploading DICOM instances by applying Java's | |
182 * "org.apache.http.client.methods.HttpPost()" on "/instances" | |
183 * URI, if "PoolingHttpClientConnectionManager" was in used. A | |
184 * workaround was to manually set a timeout for the keep-alive | |
185 * client to, say, 200 milliseconds, by using | |
186 * "HttpClients.custom().setKeepAliveStrategy((httpResponse,httpContext)->200)". | |
187 * Note that the "timeout" value can only be integer in the | |
188 * HTTP header, so we can't use the milliseconds granularity. | |
189 **/ | |
190 s += ("Keep-Alive: timeout=" + | |
191 boost::lexical_cast<std::string>(CIVETWEB_KEEP_ALIVE_TIMEOUT_SECONDS) + "\r\n"); | |
177 } | 192 } |
178 else | 193 else |
179 { | 194 { |
180 s += "Connection: close\r\n"; | 195 s += "Connection: close\r\n"; |
181 } | 196 } |