comparison Core/HttpServer/HttpOutput.cpp @ 3171:81cd9a4f3018

always add HTTP header "Connection: close" if keep-alive is disabled
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 27 Jan 2019 15:59:36 +0100
parents 6e8822be2f08
children 6d558598d713
comparison
equal deleted inserted replaced
3170:04336d6da2c6 3171:81cd9a4f3018
175 175
176 if (keepAlive_) 176 if (keepAlive_)
177 { 177 {
178 s += "Connection: keep-alive\r\n"; 178 s += "Connection: keep-alive\r\n";
179 } 179 }
180 else
181 {
182 s += "Connection: close\r\n";
183 }
180 184
181 for (std::list<std::string>::const_iterator 185 for (std::list<std::string>::const_iterator
182 it = headers_.begin(); it != headers_.end(); ++it) 186 it = headers_.begin(); it != headers_.end(); ++it)
183 { 187 {
184 s += *it; 188 s += *it;
432 // Turn off Keep-Alive for multipart answers 436 // Turn off Keep-Alive for multipart answers
433 // https://github.com/civetweb/civetweb/issues/727 437 // https://github.com/civetweb/civetweb/issues/727
434 stream_.DisableKeepAlive(); 438 stream_.DisableKeepAlive();
435 header += "Connection: close\r\n"; 439 header += "Connection: close\r\n";
436 #endif 440 #endif
441 }
442 else
443 {
444 header += "Connection: close\r\n";
437 } 445 }
438 446
439 // Possibly add the cookies 447 // Possibly add the cookies
440 for (std::list<std::string>::const_iterator 448 for (std::list<std::string>::const_iterator
441 it = headers_.begin(); it != headers_.end(); ++it) 449 it = headers_.begin(); it != headers_.end(); ++it)