2008-05-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Disable http keep-alive if the remote server is not HTTP/1.1.
	* src/HttpConnection.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-05-06 15:22:46 +00:00
parent 4f150057ca
commit e88eedc8f5
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-05-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Disable http keep-alive if the remote server is not HTTP/1.1.
* src/HttpConnection.cc
2008-05-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Receive content body of 302 response so that the connection can be

View File

@ -134,9 +134,12 @@ HttpResponseHandle HttpConnection::receiveResponse()
// OK, we got all headers.
logger->info(MSG_RECEIVE_RESPONSE, cuid, proc->getHeaderString().c_str());
// Disable persistent connection if:
// Connection: close is received or the remote server is not HTTP/1.1.
// We don't care whether non-HTTP/1.1 server returns Connection: keep-alive.
SharedHandle<HttpHeader> httpHeader = proc->getHttpResponseHeader();
if(Util::toLower(httpHeader->getFirst("Connection")).find("close") != std::string::npos) {
if(Util::toLower(httpHeader->getFirst("Connection")).find("close") != std::string::npos
|| httpHeader->getVersion() != "HTTP/1.1") {
entry->getHttpRequest()->getRequest()->supportsPersistentConnection(false);
} else {
entry->getHttpRequest()->getRequest()->supportsPersistentConnection(true);