fixed: when connection header is set to keep-alive we should respond 'Connection: keep-alive' too
git-svn-id: svn://ttmath.org/publicrep/libscorpiohttpserver/trunk@1059 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
0c2dfab903
commit
71eb0ef4bf
|
@ -372,8 +372,15 @@ void Server::CheckHeaders(Client & client, size_t input_buffer_index)
|
|||
|
||||
if( client.http_version == http_version_1_0 )
|
||||
{
|
||||
std::cout << "answer generated, closing connection for http 1.0" << std::endl;
|
||||
client.close_connection = true;
|
||||
if( !CompareNoCase(client.in.Text(L"connection"), L"keep-alive") )
|
||||
{
|
||||
std::cout << "answer generated, closing connection for http 1.0" << std::endl;
|
||||
client.close_connection = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "keep-alive is set, not closing connection for http 1.0" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,6 +484,11 @@ void Server::CreateAnswer(Client & client)
|
|||
a += L"Content-Type: text/html; charset=UTF-8\r\n";
|
||||
|
||||
|
||||
if( CompareNoCase(client.in.Text(L"connection"), L"keep-alive") )
|
||||
{
|
||||
a += L"Connection: keep-alive\r\n";
|
||||
}
|
||||
|
||||
|
||||
wchar_t buf[32];
|
||||
swprintf(buf, sizeof(buf)/sizeof(wchar_t), L"%d", c_ascii.size());
|
||||
|
|
Loading…
Reference in New Issue